Skip to content
STACK IT FIRST
Install the skills
01 · Web · Growth · SEO-driven

Astro SSR + Postgres on Cloudflare

Thousands of dynamic, indexable pages from a database, rendered at the edge, with islands only where users act.
Agent fit5/5 Growth · Charge for it Reviewed

The stack

Framework
Astro (server output, Cloudflare adapter)
Data
Postgres (Supabase or Neon) via Drizzle
Auth
Supabase Auth or Lucia, only where pages need it
Hosting
Cloudflare Pages / Workers
Also
  • Tailwind CSS
  • Static pre-rendering for pages that rarely change
  • Programmatic sitemap and JSON-LD per route
AGENTS.md + real projects on STACK IT FAST (opens in a new tab)

Why agents do well here

5/5
  • Astro's per-route choice between static and server rendering is one line, so the agent can reason about caching without a CDN configuration.
  • Directory and marketplace pages are templates over rows; the agent handles "one query, one template" patterns reliably.
  • The rendering model stays HTML-first, which keeps SEO regressions visible in the page source instead of hidden in hydration.

Avoid at this tier

  • Moving to a full app framework because a few pages need state; use islands.
  • Client-side data fetching for anything that should be indexed.
  • Bespoke caching layers before you have measured a slow route.

How it fits together

This is the same Astro you started with, now with a database behind the templates. Pre-render what rarely changes, server-render what depends on data, and keep both in src/pages/ so the agent sees the whole site map.

Folder layout

src/
  pages/          [category]/[slug].astro, sitemap.xml.ts, api/
  db/             schema.ts, migrations/, queries/
  components/     .astro by default; islands in components/islands/
  lib/            seo.ts (meta + JSON-LD helpers), env.ts

First five decisions

Lock these in before the agent writes the second feature. Each one removes a choice it would otherwise make differently every time.

  1. 01 Server output with per-route prerender
  2. 02 Drizzle queries in one folder
  3. 03 SEO helpers in one file
  4. 04 Islands in one folder
  5. 05 A build-time check that every indexable route has a canonical URL

When to move on

Stay here until the product forces the next tier. You are ready for Scale when:

  • More than one team owns part of the product
  • You serve users from more than one region or under data-residency rules
  • An auditor will ask how a change got to production
  • A single deploy touching everything is no longer acceptable
Scale · SEO-driven Next.js + Postgres + edge caching Millions of indexable pages with incremental regeneration, a CDN in front, and a content pipeline separate from the app. Next tier

Same tier, other profiles