| name | run |
| description | Launch the Flux exchange locally or with full production wiring. Use when asked to run, start, boot, or demo the app, the API, the workers, the frontend, or the whole stack, or to verify a change works in the real app. Covers the RUNTIME_MODE split, Prisma setup, required env vars, and ports. |
Running Flux
Two modes, selected by RUNTIME_MODE. Default to local unless the task specifically needs
Postgres, Redis, or real market data.
Local mode (default) — no infrastructure needed
createApiApp() uses InMemoryApiRuntime + InMemoryStreamBus, and apps/api/src/index.ts
drives runtime.drain() on a setInterval, so matching and persistence run in-process.
bun run --filter api dev
bun run --filter web dev
The API dev script loads ../../.env explicitly (bun --env-file=../../.env). There is no
root .env.example despite the README referencing one; local mode runs without it.
Worker cadence: WORKER_INTERVAL_MS (default 50ms for the API's in-process loop).
Frontend env — apps/web/.env.local:
NEXT_PUBLIC_API_URL=http://localhost:3000
NEXT_PUBLIC_WS_URL=ws://localhost:3000/ws
Without these it warns and falls back to those same defaults.
Production wiring
1. Infrastructure
docker compose up -d postgres redis
Postgres perp:perp@localhost:5432/perp_v3, Redis . Both have healthchecks.