# BloomERP Demo Deployment

The demo version must be deployed as a separate app copy so demo users never touch the live database.

## Required setup

1. Create a separate subdomain, for example `demo.bloomerp.probitdata.co.ke`.
2. Copy the frontend app into the demo web root.
3. Copy the backend API into a separate demo backend path.
4. Create separate database files or databases for both apps.
5. Copy `.env.demo.example` to `.env` in the demo frontend, then fill in `APP_KEY`, `GOOGLE_CLIENT_ID`, `GOOGLE_CLIENT_SECRET`, and mail credentials.
6. Copy the backend `.env.demo.example` to `.env` in the demo backend and fill in its `APP_KEY`.
7. Run migrations for both demo apps.
8. Build the frontend with the demo environment so `VITE_BLOOMERP_API_URL` points to the demo API.

## Google OAuth

In Google Cloud Console, create an OAuth web client.

Add this authorized JavaScript origin. It must include only the scheme and host, with no path and no trailing slash:

```text
https://demo.bloomerp.probitdata.co.ke
```

Add this authorized redirect URI. Redirect URIs are allowed to include the callback path:

```text
https://demo.bloomerp.probitdata.co.ke/demo/auth/google/callback
```

Put the generated client ID and client secret in the demo frontend `.env`.

## Trial behavior

Demo registration is enabled only when `DEMO_ENABLED=true`. New Google users are marked as demo accounts and receive a trial expiry date based on `DEMO_TRIAL_DAYS`, currently 14. When the trial expires, the user is logged out and sent to the demo expired page.

## Data separation rule

Do not reuse the production `.env`, production database, or production backend API URL for the demo deployment. The demo frontend should point to the demo backend API, and both should use demo-only database storage.
