# Local testing

Run the whole site — including the account system — on your machine, no
API keys and no production build needed.

## Start it

Double-click **`start-local.cmd`** (or run `npm run local`). First time only:
run `npm install` beforehand.

Then open:

| What | URL |
| --- | --- |
| Homepage | http://localhost:3000/en |
| Account login | http://localhost:3000/account/login |
| Beyond orders | http://localhost:3000/account/orders |
| Set IPD | via an order's "Change IPD" button |
| Email-link login test | http://localhost:3000/token2/login/anytoken |

## The mock API (why no keys are needed)

When no API env vars are set, the account pages automatically talk to a
built-in mock of the Bigscreen API (`/api/mock`) that covers every flow:
login, signup, password reset, orders, IPD changes, tickets, token logins.

**Demo account:** `demo@bigscreenvr.com` / `beyond2`
(wrong credentials show the real error state)

The mock has two sample Beyond orders (one with lens inserts). IPD changes
persist until the dev server restarts.

## Testing against the REAL API (later)

Put the values from `Server_Keys/local/webapps/website/.env` (Brandon) into
`.env.local` at the repo root:

```
BIG_API_SERVER_URL=...
BIG_CLOUD_API_URL=...
BIG_API_KEY=...
BIG_RDC_SERVER_HOST=...
```

Restart the dev server — the pages now talk to the live API. Remove the
file (or the vars) to fall back to the mock. The deployed site gets the same
vars from GitHub Actions secrets at build time (see
`docs/STAGE-TEST-RELEASE.md`).

Note: the API servers reject a bare `localhost:3000` browser origin. The mock
doesn't care, but to hit the *real* API from local dev add a hosts-file line
`127.0.0.1 local.bigscreencloud.com` and browse via
`http://local.bigscreencloud.com:3000` — that origin is allowlisted.

## Editing pages

Page sources live in `src/site/pages/` + `src/site/partials/`. After editing,
re-run `node scripts/build-pages.mjs` (start-local does this on launch) —
`public/landing/` is generated output, never edit it directly.
