Clean-repo migration

Cloudflare stack proposal

Proposed replacement map for moving the clean repo away from Supabase and toward Cloudflare-first dev and production infrastructure.

Cloudflare stack proposal

Status: proposal, not confirmed canon.

Repo Inventory Response

Current writing-system stack is not Cloudflare-native today.

  • Frontend: React 19 + Vite + TanStack Query + Zustand + TipTap/Monaco/CodeMirror, with direct Supabase client dependency in web/package.json.
  • Backend: FastAPI + Uvicorn + Strawberry GraphQL + SQLAlchemy + SQLAdmin + Supabase Python SDK + boto3 + NATS client in services/platform-api/requirements.txt.
  • Runtime: local Docker platform-api on 127.0.0.1:7640; current production target is Cloud Run, not Cloudflare Workers, per pm-manifest.mdx.
  • Current production split: hosted Supabase Postgres/Auth, Cloudflare R2, Vercel web, Cloud Run API, per local-production-parity-map.mdx.
  • Supabase is still embedded in auth, JWT validation, migrations, env vars, SDK usage, and backend admin paths. It is not just "a database host."

Architecture Decision Response

Best overall base: new Cloudflare-first repo, not a fork, not a migration inside this repo.

Current ItemBest TargetDecision
React/Vite webCloudflare Workers Static Assets + Cloudflare Vite pluginMove. Strong fit. Replace Vercel.
FastAPI platform-apiCloudflare Containers first, then rewrite stable APIs to TypeScript WorkersDo not try to lift current FastAPI directly into Python Workers. Current API has SQLAlchemy, SQLAdmin, psycopg2, process pools, background workers.
Python-heavy conversion/workersCloudflare ContainersKeep Python where Python is needed. Do not force this into Workers isolates.
Product DB if Postgres staysManaged Postgres outside Cloudflare + HyperdriveCloudflare does not host Postgres. Hyperdrive connects/pools to Postgres.
Product DB if Cloudflare-onlyD1Only if you accept a rewrite from Postgres semantics to SQLite semantics.
Supabase AuthWorkOS AuthKit for product/B2B auth; Cloudflare Access only for internal/adminAccess is not a full Supabase Auth replacement for customer auth.
Supabase Storage / MinIOCloudflare R2Move. This is the cleanest Cloudflare replacement.
NATS / coordinationDurable Objects + Queues + WorkflowsRemove NATS unless you need NATS-specific pub/sub semantics.
Realtime/collab/session stateDurable Objects + WebSocketsBest Cloudflare-native fit.
Background jobsQueues for job dispatch; Workflows for durable multi-step jobs; Containers for heavy executionDo not run job loops inside the request API.
SecretsWrangler envs + Workers Secrets + Secrets StoreMove out of repo SOPS for Cloudflare runtime. Keep local secret process only for migration.
ObservabilityWorkers Logs/Traces + Logpush/exportReplace ad hoc container logs/OpenTelemetry collector unless you keep non-CF backend.
Agent runtimeCloudflare Agents SDK + Durable Objects + AI Gateway + VectorizeUse for Cloudflare-native agents. Keep external agent repos as reference, not runtime base.
Vector searchVectorize, or pgvector in external PostgresUse Vectorize if moving RAG/search into Cloudflare. Use pgvector only if Postgres remains central.

Provider / OSS Response

Best practical target:

Cloudflare Workers Static Assets
+ TypeScript Worker API for normal product endpoints
+ Cloudflare Containers for Python/conversion/legacy-heavy services
+ R2 for files
+ Durable Objects for live/session/collab/agent state
+ Queues + Workflows for async jobs
+ WorkOS AuthKit for product auth
+ Cloudflare Access for internal/admin gates
+ managed Postgres + Hyperdrive unless you rewrite data to D1

The hard truth: "all Cloudflare" means D1, not Postgres. If Postgres remains a requirement, the best Cloudflare-compatible answer is Hyperdrive plus an external Postgres host. If eliminating Supabase is the goal, that external Postgres can be Neon/RDS/Cloud SQL/Crunchy/etc., but it is still outside Cloudflare.

Current docs checked: Cloudflare Static Assets, Hyperdrive, D1, R2, Access, Durable Objects, Queues, Workflows, Containers, Python Workers/FastAPI, Secrets Store, Workers Observability, Agents SDK, Workers AI, AI Gateway, Vectorize, WorkOS AuthKit.

Key docs: Static Assets, Hyperdrive, D1, R2 S3, Access, Durable Objects, Containers, Python Workers packages, WorkOS AuthKit.

On this page