Skip to main content

Deployment

Production target architecture for Race Platform. The same source tree that runs in docker-compose locally swaps in managed cloud services through driver environment variables.

Cloud target

LayerLocalProduction
DBPostgres 16 (docker)Supabase Postgres + Auth + Realtime
Object storageMinIO (docker)Cloudflare R2
KVRedis (docker)Cloudflare KV
APIHono on Node (docker)Cloudflare Workers
Realtimews on Node (docker)Cloudflare Durable Objects
Queue(none)Cloudflare Queues (webhook retries, KPI jobs)
Strategy enginePython (docker)Fly.io
Search / AI memory(none yet)Cloudflare Vectorize
Edge ingesterRust binaryRust binary on pit-box laptop

Everything is provisioned via OpenTofu — see infra/opentofu/ for the modules and .tfvars shape.

Environment-driven driver selection

Adapters live in apps/<svc>/src/adapters/, interfaces in apps/<svc>/src/ports/. Selection happens at runtime via these env vars:

Env varChoicesDefault
STORAGE_DRIVERminio / r2minio
KV_DRIVERredis / cf-kvredis
DB_DRIVERpostgres / supabasepostgres
REALTIME_DRIVERws / cf-dows

There is no cloud-provider name in business logic — adding AWS as a future driver target is one new adapter, not a refactor.

Cost target

  • $0 during local development
  • ~$40/month through alpha pilots (Supabase Free + Cloudflare Workers Free tier + R2's zero-egress pricing)
  • Scales linearly with pilot teams added

What you can do today

  • Run the full stack locally with the docker-compose path
  • Run the OpenTofu plan against a Cloudflare + Supabase project in dry-run mode (tofu plan)
  • Build the API for the Workers target (pnpm build)

What's coming

  • First-pilot production rollout — wires up Supabase + R2 + Workers end to end
  • CI deploy pipeline — GitHub Actions → Cloudflare Workers on every main merge
  • Per-environment Secrets management — Doppler / Cloudflare Secrets
  • Database backups — automated nightly Supabase snapshots + S3 dump