<!-- Markdown rendering of https://superslate.dev/tanstack-start/ -->

> Full-stack SaaS boilerplate on TanStack Start, Cloudflare Workers, and D1: auth, teams, Polar billing, one deploy command, and rules your coding agent follows.

[failure modes 01](#failure-modes) [coding agents 02](#agent-native) [features 03](#features) [the stack 04](#stack) [deployment 05](#deployment) [pricing 06](#pricing) [faq 07](#faq)

# The full-stack starter kit for Cloudflare

TanStack Start renders every page at the edge, server functions replace the API, and D1 holds the data. One Worker, one deploy command.

[Get lifetime access](#pricing)

-   ![React 19](https://superslate.dev/_astro/react.Bcz6PY-l_1IVCIB.webp)

-   ![Bun](https://superslate.dev/_astro/bun.CFdaJjQX_Z14C4BF.webp)
-   ![Better Auth](https://superslate.dev/_astro/betterauth.D1IKSGL6_27obII.webp)
-   ![Resend](https://superslate.dev/_astro/resend.osf0KMJX_ZXVQXj.webp)

guardrails your AI agents follow so their code fits the repository boundaries

the app your customers log into it runs the minute you clone it

sign-up, teams, payments, email working on day one, not stubbed

your product the only part left to build

one repo with the boring parts already finished so you start on what makes your product different

What actually goes wrong.

## Agents don't break your codebase in one commit.

They break it gradually: reading context nobody maintained, inventing a route through the code, and passing every check on the way to a regression you find two weeks later.

-   ![An AGENTS.md file last updated eight months ago, behind a terminal showing recent commits that changed the code since](https://superslate.dev/_astro/agents-stale-context.BRgSgWf0.svg)
    
    Someone wrote the context file months ago. Your agent is still working from it.
    
-   ![The same invoices feature created three times in three different directories: features, domains, and lib](https://superslate.dev/_astro/agents-no-route.COPHue8k.svg)
    
    There's no established route for how features get built, so every agent takes a different one.
    
-   ![A pull request reporting 33 successful checks, overlaid by two production error reports](https://superslate.dev/_astro/agents-late-regression.B-iE9TNS.svg)
    
    The run comes back green and the PR looks right, but a regression shows up two weeks later.
    

A first task for your coding agent

## “Add a subscriber-only reports page.”

Your agent has a server function to follow, a subscription check to reuse, and tests for what happens when a customer cancels. It can run those tests against D1 before you deploy.

### Keep billing decisions on the server

apps/start/AGENTS.md

> Do not grant billing access from anything but a verified webhook.

Your agent can reuse the subscription state the Worker already checks.

### Put the change in the right place

apps/start/docs/architecture.md

The guide shows where to validate a request, check team permissions, and read from D1.

### Check who gets access

apps/start/tests/billing.test.ts

Run the existing tests for duplicate webhooks, canceled subscriptions, and expired plans.

### Catch a database mismatch

pnpm typecheck

The app checks that its query types match the migrations, then checks the TypeScript that uses them.

## A working SaaS on one Worker.

Your customers can create an account, invite a teammate, and manage a subscription. The pages and server functions for those flows ship together.

### Sign-in and accounts

[![](https://superslate.dev/_astro/betterauth.D1IKSGL6_ZRixjt.webp)Better Auth](https://better-auth.com)

-   Offer password, magic link, or Google sign-in
-   Verify email and revoke sessions on password reset

### Subscriptions

[![](https://superslate.dev/_astro/polar.BkhZpLLY_Z1nUMqt.webp)Polar](https://polar.sh) · [![](https://superslate.dev/_astro/stripe.gSjBl1wZ_2eNgSn.webp)Stripe](https://stripe.com) · [![](https://superslate.dev/_astro/dodo.BuRK7Kqw_ZYenBd.webp)Dodo](https://dodopayments.com)

-   Choose one provider for checkout
-   Reject invalid signatures and ignore duplicate events

### Teams and permissions

personal + team

-   Create a personal workspace at sign-up
-   Invite teammates, assign roles, and transfer ownership

### Server functions

[![](https://superslate.dev/_astro/tanstack.BjjlKjV0_Z1ibTvo.svg)TanStack Start](https://tanstack.com/start) + [![](https://superslate.dev/_astro/zod.D42PXtoy_WzPQs.webp)Zod](https://zod.dev)

-   Validate submitted data
-   Check the session and team before accessing records

### Database migrations

[![](https://superslate.dev/_astro/d1.B2P1NCXt_15kSww.webp)D1](https://developers.cloudflare.com/d1/) + [![](https://superslate.dev/_astro/kysely.BZ7jlpUx_Z13ExBy.webp)Kysely](https://kysely.dev)

-   Keep related writes in one atomic batch
-   Apply pending migrations during deployment

### Transactional email

[![](https://superslate.dev/_astro/resend.osf0KMJX_IuQlb.webp)Resend](https://resend.com)

-   Send verification links and team invitations
-   Test email flows locally without a provider key

### Request security

on by default

-   Set a content security policy
-   Check server functions for cross-site requests

### Rate limiting

[![](https://superslate.dev/_astro/workers.pnCeZEPH_Z1bT9Ve.webp)Workers](https://developers.cloudflare.com/workers/) bindings

-   Limit sign-in attempts by IP
-   Limit changes per signed-in user

### Scheduled cleanup

[![](https://superslate.dev/_astro/workers.pnCeZEPH_Z1bT9Ve.webp)Cron Triggers](https://developers.cloudflare.com/workers/configuration/cron-triggers/)

-   Expire old sessions and invites
-   Run cleanup on the same Worker as the app

### UI components

[![](https://superslate.dev/_astro/zag.DtVyY7IK_Z1FfcjM.webp)Zag.js](https://zagjs.com) + [![](https://superslate.dev/_astro/css-modules.rpWc2Ruh_Z2fLWSl.webp)CSS Modules](https://github.com/css-modules/css-modules)

-   Build screens with keyboard-accessible controls
-   Customize the shared design tokens

### Automated tests

[![](https://superslate.dev/_astro/vitest.sI85Ucxh_y1iY0.webp)Vitest](https://vitest.dev) in [![](https://superslate.dev/_astro/workers.pnCeZEPH_Z1bT9Ve.webp)workerd](https://github.com/cloudflare/workerd)

-   Exercise team permissions against local D1
-   Check webhook replay and out-of-order events

### Marketing site

[![](https://superslate.dev/_astro/astro.pmAa_jJ3_2oXIEw.webp)Astro](https://astro.build) + [![](https://superslate.dev/_astro/workers.pnCeZEPH_Z1bT9Ve.webp)Workers](https://developers.cloudflare.com/workers/)

-   Publish a fast static site in your own brand
-   Includes a sitemap and Markdown pages

### Get the TanStack Start source

Customize the app and use it for every product you own.

[Compare licenses](#pricing)

## How the app fits together.

Pages and server functions share a Worker. Follow a form submission from the React screen to the D1 query that saves it.

framework

[![](https://superslate.dev/_astro/tanstack.BjjlKjV0_Z1ibTvo.svg)TanStack Start](https://tanstack.com/start) + [![](https://superslate.dev/_astro/react.Bcz6PY-l_1wG8s2.webp)React 19](https://react.dev)

Render pages on the server and call typed server functions directly from the app.

contracts

[![](https://superslate.dev/_astro/typescript.Da_hSd_Y_Z1ibTvo.svg)TypeScript](https://www.typescriptlang.org) + [![](https://superslate.dev/_astro/zod.D42PXtoy_WzPQs.webp)Zod](https://zod.dev)

Validate submitted data with shared schemas so forms and server functions agree on the input.

runtime

[![](https://superslate.dev/_astro/workers.pnCeZEPH_Z1bT9Ve.webp)Cloudflare Workers](https://developers.cloudflare.com/workers/)

One Worker handles page requests, billing webhooks, and nightly cleanup.

database

[![](https://superslate.dev/_astro/d1.B2P1NCXt_15kSww.webp)D1](https://developers.cloudflare.com/d1/) + [![](https://superslate.dev/_astro/kysely.BZ7jlpUx_Z13ExBy.webp)Kysely](https://kysely.dev)

Query D1 with typed SQL. Atomic batches keep related writes together.

tests

[![](https://superslate.dev/_astro/vitest.sI85Ucxh_y1iY0.webp)Vitest](https://vitest.dev)

Run tests in the Workers runtime against local D1 with the same migrations you deploy.

## Deploy to Cloudflare in one command.

Once your Cloudflare account and D1 database are configured, `pnpm deploy:worker` builds the app, applies its migrations, and publishes the Worker.

What runs on Cloudflare Wrangler

piece

runs on

configured in

pages

[![](https://superslate.dev/_astro/workers.pnCeZEPH_Z1bT9Ve.webp)Workers](https://developers.cloudflare.com/workers/), server-rendered

src/routes

server functions

[![](https://superslate.dev/_astro/workers.pnCeZEPH_Z1bT9Ve.webp)Workers](https://developers.cloudflare.com/workers/), same request

src/functions

auth + webhooks

[![](https://superslate.dev/_astro/workers.pnCeZEPH_Z1bT9Ve.webp)Workers](https://developers.cloudflare.com/workers/) server routes

src/routes/api

cron

[![](https://superslate.dev/_astro/workers.pnCeZEPH_Z1bT9Ve.webp)Cron Triggers](https://developers.cloudflare.com/workers/configuration/cron-triggers/)

wrangler.jsonc

database

[![](https://superslate.dev/_astro/d1.B2P1NCXt_15kSww.webp)D1](https://developers.cloudflare.com/d1/)

db/migrations

rate limits

[![](https://superslate.dev/_astro/workers.pnCeZEPH_Z1bT9Ve.webp)Workers](https://developers.cloudflare.com/workers/) bindings

wrangler.jsonc

**Verified live** The reference app runs on Workers with a remote D1 database. **Still to verify** Deployment on a custom domain.

## One license for every product you own.

Pay once for the source. Buy as an individual or cover your whole company, with no per-developer fees or runtime royalties.

### TanStack Start

40% off

For a server-rendered web product on Cloudflare Workers and D1.

One-time price

$149 Standard price $249

-   Full source for this edition
-   Your own branded project from the CLI
-   Credit toward All-access if you upgrade

First 50 licenses at this price. Then **$199**.

[Buy TanStack Start](https://buy.polar.sh/polar_cl_xGsQJzMkxwFSyS5vZZP1ChZbzQuRWhZeAipLg2l6Cfo)

### All-access

38% off

React + Hono, TanStack Start, and Expo.

One-time price

$249 Standard price $399

-   Full source for all three editions
-   Private GitHub repo for releases and issues
-   Save $99 over buying Expo and TanStack Start separately

First 50 licenses at this price. Then **$329**.

[Buy All-access](https://buy.polar.sh/polar_cl_gYnaILCHzagi3duUNSet74EzRipCw0Dyy13HY3XoLqQ)

Both licenses include updates while we maintain and distribute your editions. Already own an edition? Use the one-time code in your license email for credit toward All-access, with at least $49 to pay. The license excludes client work and source redistribution. [Read the full license](https://superslate.dev/license/).

## FAQ

When should I choose TanStack Start?

Choose it when you want server-rendered pages and app logic on Cloudflare. React + Hono suits a dashboard with a separate API and Postgres.

What should I know about D1?

Cloudflare manages the database. D1 uses SQLite and supports atomic batches for related writes. If your product needs interactive transactions or Postgres extensions, choose React + Hono.

Which agent tools come with this edition?

You get repo instructions, an architecture guide, and tests that run against local D1. The evaluation harness and optional MCP server come with the React + Hono foundation.

How do I get the source after checkout?

Your receipt includes a license key. Run pnpm dlx superslate@latest my-app and enter the key. The tool verifies the release, applies your brand, and installs the project on your machine.

Can I use it for multiple products or client work?

One license covers one person or company and unlimited products that buyer owns. Your whole development team can use it. Separate companies need their own licenses, and client delivery is outside the license.

Is there a public site for my product?

Yes. Every edition includes an Astro marketing site that shares the app’s colors and typography. Change the sample copy, add your terms, and publish it separately on Cloudflare.

Can I get a refund after downloading the source?

Sales are final once source access is delivered, subject to your statutory rights. If delivery fails or you see a duplicate charge, contact support with your order ID.

## Start your next app with one command.

Get your license key at checkout. Then run `pnpm dlx superslate@latest my-app` to create a project with your name on it.

[Buy TanStack Start for $149](https://buy.polar.sh/polar_cl_xGsQJzMkxwFSyS5vZZP1ChZbzQuRWhZeAipLg2l6Cfo) [Read the setup guide](https://docs.superslate.dev/docs/setup)
