# Run the development workspace

Choose the isolated local profile or the MongoDB-backed hosting profile deliberately.

Version 0.1.0 · Early pilot · unreleased SDK · Reviewed 4 November 2026

## The default local profile

With Node 24+ and pnpm 10.29.3, pnpm dev starts Next.js at http://127.0.0.1:3000, the independent support API at http://127.0.0.1:4010 and the local durable-outbox worker. PGlite persists real PostgreSQL records under .data/lobby. One API process owns that embedded database; the worker leases jobs over the API instead of opening the same directory.

```
pnpm install --frozen-lockfile
pnpm assets:build
pnpm dev
```

## Start empty or seed deliberately

A fresh local database is empty. Create a local workspace and an app in the inbox, or explicitly run pnpm demo:seed to load fictional evaluation data. Never mix the fixture with a workspace intended for your own customer testing. The local operator-session route is loopback development tooling and is not used by the hosted MongoDB service.

```
# Optional, in a second terminal; local fixture data only:
pnpm demo:seed
```

## The hosting profile

The owner’s later architecture decision selects MongoDB and Better Auth for hosting. On Vercel, or with LOBBY_PROFILE=hosted or MONGODB_URI set, the Next.js /v1 route runs the MongoDB service rather than forwarding to the loopback API. Better Auth handles operator email/password sessions at /api/auth; embedded customers still use separate hej support credentials. Configure a MongoDB replica set/Atlas connection and the server-only MONGODB_URI, MONGODB_DB_NAME, BETTER_AUTH_SECRET and BETTER_AUTH_URL values. Additional trusted origins use LOBBY_ALLOWED_ORIGINS. Never expose these as NEXT_PUBLIC values.

## Run a configured hosting profile locally

Provide the server environment before starting the web package, or use its uncommitted .env.local file. BETTER_AUTH_SECRET must be at least 32 characters; BETTER_AUTH_URL must match the actual origin. Use only an isolated test database. MongoDB transaction tests run against a local replica set; they are not Atlas or Vercel deployment proof. The default local worker command does not establish an operational hosted provider worker.

```
# After configuring the isolated hosting-profile environment:
pnpm --filter @lobby/web dev
```

## Checks and restart

Ctrl+C stops the default development processes. Restarting preserves accepted local records. pnpm check includes strict types, the API suites and asset checks; the suites cover the independent PostgreSQL profile and the expanded MongoDB/Better Auth hosting service. The two API shortcuts below intentionally run the same suite. MongoDB tests may download their pinned local test binary on first use.

```
pnpm check
pnpm build
pnpm test:access
pnpm test:flows
pnpm test:ios
pnpm assets:build
pnpm assets:check
```
