LapStream is an event operations platform for lane/slot based races.
The current repo includes a working backend (lapstream_server) and a working terminal dev client (lapstream_dev_client).
Implemented today:
- Server-side authentication and authorization
- Admin-protected OTP generation
- Device enrollment via OTP
- JWT access tokens + refresh token rotation
- Role guards on protected endpoints
- Player management API (reception role)
- Lane assignment API (lane_assign role)
- Dev TUI client for enrollment, OTP generation, player registration, and lane assignment
- Integration test covering auth + player + lane flows
Not implemented yet:
- Lane count workflow/menu
- Realtime lap event streaming and dashboards
- Admin generates one-time OTPs with role + device name (
POST /auth/admin/otp). - Device enrolls with OTP (
POST /auth/device) and receives:- short-lived JWT
- refresh token
- Protected routes require a valid JWT with matching role (
adminbypasses role checks). - Dev client auto-refreshes expired JWTs through
POST /auth/refreshand persists updated credentials.
Roles:
adminreceptionlane_assignlane_count(reserved; menu not implemented yet)
Prerequisites:
- Node.js 22+
- Docker
- Start Postgres:
cd lapstream_server
docker compose up -d- Configure server env:
cp .env.example .envSet required values in lapstream_server/.env:
DATABASE_URL=postgres://postgres:postgres@127.0.0.1:5432/lapstreamCONFIG_PATH=../serverconfig.dev.jsonADMIN_API_TOKEN=<your-admin-token>JWT_SECRET=<base64-secret>REFRESH_TOKEN_PEPPER=<base64-secret>
- Install and prepare DB schema:
npm install
npm run drizzle:migrate- Run server:
npm run dev- In a second terminal, run the dev client:
cd lapstream_dev_client
npm install
npm run devThe dev client default API is http://localhost:4000. Override via API_BASE_URL if needed.
- Public:
GET /GET /lane/pace-groups
- Auth:
POST /auth/admin/otp(requiresAuthorization: Bearer <ADMIN_API_TOKEN>)POST /auth/devicePOST /auth/refresh
- Reception:
POST /playerGET /playerGET /player/:id
- Lane assign:
PUT /lane/:paceGroup/:position/playerDELETE /lane/:paceGroup/:position/player
lapstream_server: Express + TypeScript API, Drizzle schema/migrations, integration testslapstream_dev_client: Interactive terminal client for OTP/auth and role-based workflowslapstream_client: Tauri client scaffold (not part of current tested workflow)