Why should you pick the deploy target before the framework? #
Deploy target decides cost, cold starts, and tenancy; BYOB ships SvelteKit on Cloudflare Workers for Platforms with content prerendered to CDN, dash plus API as edge functions, and user projects isolated as platform workers with a KV domain map. Scope: SaaS teams in BYOB shipping content plus auth plus API pockets. D1 holds per-project edge data while Supabase holds control-plane auth plus billing.
Framework threads run hot and decide little. React or Svelte will both render your hero. What decides your bill, your cold starts, your tenancy model, and your 3am pages is where the code runs and how traffic finds it.
Our answer is boring on purpose. SvelteKit compiled to the edge, content prerendered to CDN, auth plus API as functions, user projects isolated as platform workers, data split between D1 at the edge and Supabase at the core. Target first, framework second, drama never.
How is our route table split? #
The Svelte config says it plainly. Adapter cloudflare with routes include for dash plus API, exclude for files plus blog plus tools plus prompts plus quiz and the rest. Layout prerenders by default, dash opts into auto. That split is the whole cost story.
Content routes build once and serve from CDN. Crawlers get instant HTML, users get cache hits, we pay no invocation per read. Only signed in paths and API routes burn edge compute. A commented out static adapter import sits above the cloudflare import, marking the choice as deliberate rather than accidental.
Try it: Deploy Checklist — it catches route-split mistakes before they burn edge compute here.
| Layer | Where it runs | Why |
|---|---|---|
| Blog plus tools plus docs | Prerendered CDN | Instant crawl, no per read cost |
| Dash plus API | Edge functions | Auth plus live data need compute |
| User projects | Platform workers | Full isolation, no origin hop |
| Custom domains | KV domain map plus dispatcher | Hostname to worker lookup at edge |
| Per project data | D1 at edge | Thousands of DBs, no pooling pain |
| Control plane | Supabase Postgres | Auth plus billing plus projects |
Why do user projects never touch our origin? #
The dispatcher worker owns the project zone. Root maps to the marketing site, reserved names get 403, everything else resolves through KV. Byob hostnames map to slugs directly, custom hostnames map through a domain entry, canonical checks redirect when a custom domain is active, then the request fetches from the named project worker.
Traefik never sees that traffic. Our proxy handles control plane hosts for prim plus air APIs, while project traffic stays on the edge from first byte to last. Scale comes from the platform, not from boxes we babysit. The tradeoff is eventual consistency on KV writes, so a reconciler keeps custom domains in sync, and debug moves to worker tooling.
What does the split cost in upkeep? #
Two small taxes. The route exclude list must grow with every new content section or pages silently burn compute. KV writes need a reconciler because reads are eventually consistent. Both are cheap when owned in code and painful when forgotten, so we review the list in the same commit that adds the route.
Where do you start once the target is chosen? #
Start with the route table, because everything else hangs off it. List every content path that must prerender to CDN and every signed-in plus API path that needs edge compute, then encode that split in adapter cloudflare routes include plus exclude. Next verify the dispatcher worker: root to marketing, reserved names to 403, platform hosts to slugs, custom hosts through the KV domain map, canonical checks before fetch. Then confirm the data split: per-project D1s for app rows, Supabase for control truth, and a reconciler keeping custom domains in sync. Review the exclude list in the same commit that adds any route.
Who this is for? #
Teams choosing a stack for sites plus apps with user data. If your pages are mostly content with pockets of auth and API, the split above fits. If everything is live per request, budget for more edge compute and keep the same isolation.
- Best for startups picking a target for content plus auth and API pockets.
- Best for developers splitting routes between static and edge compute.
- Best for small teams planning isolation before framework debates.
What we learned building this? #
The route exclude list is a living doc. Every new content section must join it or it silently burns compute. We learned to review that list in the same commit that adds the route. Small discipline, real savings. Framework taste fades, target bills monthly. Choose the target with care and let the framework serve it.