Authentication Model
Guests can create live simulations without signing in. Signed-in users send a Clerk session token as a Bearer token and get private saved runs, replays, and exports.
Authorization: Bearer <clerk-session-token>
Core Endpoints
/api/healthReturns service status and active session count.
GET/api/auth/configReturns Clerk browser configuration when auth is enabled.
POST/api/sessionsCreates a live simulation session.
GET/api/sessions/:id/eventsStreams live or replayed simulation events through SSE.
DELETE/api/sessions/:idCancels an active native worker.
Create A Session
POST /api/sessions
Content-Type: application/json
{
"seed": 42,
"scheduler": "deterministic",
"navigation": "bfs",
"hunters": ["Ada", "Grace"]
}
The response includes the session id, event stream URL, replay URL, and whether the run was persisted.
Sharing And Exports
/api/runs?limit=20Lists signed-in user's private run history.
POST/api/runs/:id/shareMakes a completed run public.
DELETE/api/runs/:id/shareRevokes a public share token.
GET/api/shares/:token/eventsStreams a public replay.
GET/api/runs/:id/export?format=jsonDownloads a signed-in run export.
Operational Limits
Session creation is rate-limited per client address. Render Free should use a low worker count such as MAX_CONCURRENT_SESSIONS=2 and a timeout such as SESSION_TIMEOUT_MS=60000.