Splitting Edge SSR and APIs with Astro, Cloudflare Workers, Bun, and Elysia
When you are a very small team building a multi-surface web platform on a tight budget, most architectural decisions come down to drawing clear boundaries early so one part of the stack does not drag down the rest.
We are building Yomumi (yomumi.moe), an independent platform for original web novels, manga, webtoons, illustration, music, and seasonal anime discovery. Ahead of opening our Public Beta on 18 December 2026 (00:00 Asia/Bangkok), the public surface sits behind a pre-launch gate while we finish testing in an invite-only Alpha.
Along the way, we settled on a split architecture: Astro running on Cloudflare Workers at the edge, paired with a Bun and Elysia backend backed by PostgreSQL and Drizzle. Here is why we separated the edge from the API, what actually runs where today, and a few practical lessons from treating edge routing, fonts, and crawler rules as first-class engineering work.
Why split the edge from the API?
It is tempting for a small team to put everything into one full-stack framework or one container. The reason we kept them apart is that public pages and interactive creator/reader workflows have very different traffic patterns and failure modes.
On the public side, pages like our pre-launch /coming-soon/ page, /manifesto/, /press/, and /legal/ notices are read-heavy, cacheable, and mostly static or lightweight edge SSR. They should respond cleanly even when backend services are restarting or under load.
Meanwhile, the core application - authentication, watchlists, Creator Studio drafts, chapter unlocking, and search - needs stateful database transactions, background checks, and strict input validation.
Splitting yomumi.moe (Astro on Cloudflare Workers, with static assets and covers in Cloudflare R2) from api.yomumi.moe (Bun + Elysia on Google Cloud Run with PostgreSQL) keeps those concerns isolated:
- Edge changes stay fast to ship: Updating legal copy, press assets, or SEO metadata does not require touching the core API runtime.
- TypeScript stays shared in spirit, not coupled at runtime: Both Astro and Elysia let us stay in TypeScript across frontend and backend without forcing every request through one monolithic process.
- Asset delivery stays off the API server: Web fonts, logos, and media cards serve directly from the edge/R2 rather than tying up application workers.
Edge routing, pre-launch gates, and asset traps
A pre-launch gate sounds trivial - redirect unauthenticated routes to /coming-soon/ with a 302 - until you inspect what crawlers and browsers actually hit. Two real edge bugs we ran into and fixed during pre-launch audits are good reminders for anyone running a holding gate on Cloudflare Workers:
- Do not gate your own static assets or fonts. Early on, a broad route gate caught font files (
/fonts/*.woff2), redirecting font requests to/coming-soon/HTML instead of serving binary font files. Browsers fell back to system fonts, layout shifted on load, and page weight ballooned for no reason. Explicitly bypassing/fonts/*,/press/assets,/robots.txt, and/sitemap.xmlbefore any gate redirect eliminated the layout shift immediately. - Keep your sitemap honest about what returns
200. If 25 or 30 routes behind an invite or dev gate return302redirects, listing them in/sitemap.xmltells search engines to crawl redirects. Trimming/sitemap.xmldown to only the five genuinely public200routes (/coming-soon/,/legal/privacy/,/legal/terms/,/manifesto/, and/press/) cleaned up crawl waste right away.
Treating crawlers and edge formats explicitly
Because Yomumi is built for creators publishing original novels, comics, and art, crawler policy was not an afterthought. We wanted our stance - no AI training on creators' work - to be unambiguous both in legal terms and at the HTTP edge.
At the same time, we learned an important distinction: robots.txt and noai meta tags are policy signals, not access control. A scraper that spoofs a browser user agent will not obey a Disallow line. Still, being explicit matters:
- Every public HTML page sends
index, followalongsidenoai, noimageai, and our defaultrobots.txtgroup setsai-train=noandai-input=no. - When we later decided to allow AI search-retrieval bots (
OAI-SearchBot,Claude-SearchBot,PerplexityBot) to answer search questions strictly from our public/coming-soon/page - while keeping training blocked - we scopedAllow: /coming-soon/$andContent-Signal: /coming-soon/ ai-input=yesnarrowly to that single path rather than opening the whole domain. - We also added edge text/markdown negotiation on public informational pages (
/coming-soon/,/manifesto/,/press/,/legal/*), appending a clear notice that catalogue and chapter data load separately via the API and are not part of the static edge document.
Separately, on private surfaces like our invite-only Alpha host (alpha.yomumi.moe), returning X-Robots-Tag: noindex, nofollow at the HTTP header level plus Disallow: / ensures preview hosts never leak into search results even if someone links to them.
Why Bun + Elysia for the API
On the backend (api.yomumi.moe), running Bun with Elysia gave us a single TypeScript toolchain for REST endpoints, schema validation, WebSockets, and Drizzle ORM against PostgreSQL. Keeping the API cleanly separated behind its own subdomain also makes security boundaries easier to reason about: authentication, OAuth callbacks, and Studio endpoints live behind one API surface, while the Astro edge layer only handles rendering and public marketing routes.
What is next toward Beta
As we move toward Public Beta on 18 December 2026, the remaining edge work is mostly discipline: flipping the gate cleanly without breaking public URLs, expanding sitemap.xml to live localized routes with proper hreflang, and keeping main-thread JavaScript lean on our Astro pages.
If you have built a similar split between Astro on Cloudflare Workers and a Bun/Elysia backend - especially around pre-launch gating, localized routing, or edge caching - we would love to compare notes in the comments.
Written by the Yomumi team with AI assistance, and reviewed against our live configuration before publishing.
Comments
No comments yet. Start the discussion.