Docs

Local dev

Emulator, seed, auth bypass, and verify scripts.

Quick start

npm run dev:setup

Runs in one terminal:

  1. Starts Firebase Realtime DB emulator (if not already running)
  2. Pulls prod sites into the emulator (seed:pull -- -y --clone-all)
  3. Starts Next.js dev server with Turbopack

Auth is bypassed locally. You'll auto-login as dev@nertia.local.

Manual setup

# Terminal 1: Firebase emulator
npm run emulator

# Terminal 2: Once emulator is ready
npm run seed:pull              # or: npm run seed:pull -- -y --clone-all

# Terminal 3: Dev server
npm run dev

Test data

dev:setup runs npm run seed:pull -- -y --clone-all, which wipes the emulator and clones all production sites for the owner email (default ps2pdx@gmail.com; override with DEV_AUTH_EMAIL in .env.local).

Optional client recipe:

npm run seed:pull -- -y --recipes=bend-cleaning

Set DEV_AUTH_EMAIL to match the seed owner so auth bypass sees those sites.

Auth bypass

Recommended for day-to-day local work:

  • Client: NEXT_PUBLIC_DEV_BYPASS_AUTH=true injects mock user in auth context
  • Server: DEV_BYPASS_AUTH=true accepts dev-bypass as a valid token in API routes
  • Email: Defaults to dev@nertia.local; set DEV_AUTH_EMAIL to match seed owner

npm run dev:setup exports emulator env vars automatically. With bypass on, app routes skip the login gate.

Auth emulator (optional)

When bypass is off, email/password sign-up uses the Auth emulator (port 9099) whenever the DB emulator is active. Google sign-in is not available on the emulator. Restart the emulator after pulling: npm run emulator now starts database + auth.

Emulator ports

ServicePort
RTDB9000
Auth9099
Emulator UI4000

Inspect/edit the database at http://localhost:4000.

Verify scripts

npm run verify       # typecheck + lint
npm test             # Vitest
npm run test:e2e     # Playwright

Quick reference

One shot:   npm run dev:setup
Emulator:   npm run emulator
Seed:       npm run seed:pull -- -y --clone-all
Dev URL:    http://localhost:3000
Auth:       dev-bypass (local only)
Local dev — nertia docs