Runtime topology (October 2026)
Components
Backend
Project layout, services and conventions.
Arena web app
Structure, routing and API client.
Admin panel
Access model, pages and endpoint map.
Design choices worth knowing
The API talks to Postgres over PostgREST, not a driver
The API talks to Postgres over PostgREST, not a driver
SupabaseService and AdminSupabaseClient call {SUPABASE_URL}/rest/v1/... with HttpClient and filter strings. There is no ORM and no migrations project. Every request carries the service-role key in both the apikey and Authorization headers (the September 2026 fix), so row-level security doesn’t apply to API calls; authorization is done in the controllers.Roles come from the database, not the token
Roles come from the database, not the token
Supabase tokens don’t carry an app role.
RoleClaimsTransformation reads public.users.role for the sub of every authenticated request and adds it as a role claim. The AdminOnly policy requires admin. See Authentication.One container instance
One container instance
The Worker sends every request to a single named container (
default). A multi-instance setup was tried in August 2026 and reverted the next day. The API keeps some state in memory (the model cache and provider key cooldowns), so several instances would need that state shared first. See Cloudflare Containers.Providers behind one interface
Providers behind one interface
IChatProvider has ChatAsync and StreamAsync. ChatProviderFactory maps provider_name to GroqService, GoogleService or CloudflareWorkersAiService, defaulting to Groq. See Provider integration.Most responses use camelCase, with snake_case exceptions
Most responses use camelCase, with snake_case exceptions
Controllers serialize with Newtonsoft’s camelCase resolver and omit
nulls. Admin DTOs set explicit snake_case JsonProperty names that match the database columns, so admin responses are snake_case. GET /api/arena/model-stats is the public exception: it returns snake_case aliases next to the camelCase fields.Where to go next
Request lifecycle
A battle and a vote, step by step through the code.
Invariants
Rules the code relies on. Read before you change behaviour.