Overview
A full-featured TanStack Start SaaS starter for Cloudflare Workers.
The TanStack template is a full-featured SaaS starter built with TanStack Start, TanStack Router, React 19, and Vite. It targets Cloudflare Workers and includes D1 database access, R2 object storage, authentication, payments, email, content, internationalization, and AI examples.
Auth, database, storage, email, and content/i18n are integrated end to end. Examples and UI starters still need your product's policies, limits, data, and operational hardening — the feature status table below spells out each one.
The runtime is part of the architecture: DB and UPLOADS are per-request
Cloudflare bindings, the database is SQLite-compatible D1, and production ships
with wrangler deploy rather than a Node server or container.
Tech stack
| Concern | Technology |
|---|---|
| Framework | TanStack Start + TanStack Router, built by Vite |
| UI runtime | React 19 + TypeScript |
| Authentication | Better Auth (email/password, GitHub/Google OAuth, admin plugin) |
| Database | Cloudflare D1 (SQLite) + Drizzle ORM |
| Storage | Cloudflare R2 |
| Payments | Creem |
| Resend + React Email | |
| Internationalization | i18next + react-i18next |
| Docs and content | Fumadocs MDX, blog, and legal collections |
| AI chat | Vercel AI SDK + OpenAI |
| AI media | Replicate image, video, and audio tasks |
| Styling | Tailwind CSS v4 + shadcn/ui |
| Tooling | Biome, Vitest, pnpm, Wrangler |
Feature status
These labels are used throughout this guide:
- Integrated — connected end to end in the template.
- Example — a working reference that needs product-specific policy, limits, or data.
- UI starter — a designed surface with mock/static data or unfinished actions.
| Area | Status | Scope |
|---|---|---|
| Authentication | Integrated | Email/password, required verification, reset, GitHub/Google OAuth, sessions, account linking, and admin plugin |
| Database | Integrated | D1/SQLite, Drizzle auth and payment schemas, and committed SQL migrations |
| Payments | Example | Authenticated Creem checkout, order query, signature verification, and selected webhook events |
| Email/contact | Integrated | Resend delivery for verification, reset, and contact messages |
| Newsletter | UI starter | Email template only; no subscription route or persistence |
| AI | Example | OpenAI chat streaming and Replicate media task flows; production quotas and rate limits are not included |
| Content and i18n | Integrated | Fumadocs docs, blog/legal collections, and English/Chinese i18next routing |
| Dashboard/admin | UI starter | Several pages use mock/static data; route guards and authenticated APIs provide connected foundations |
| Storage | Integrated (example policy) | Authenticated upload to durable R2 and Worker-served objects; add product limits and stronger validation |
Application surfaces
TanStack Router uses pathless layout routes to share UI without adding segments to the public URL:
- Marketing (
_marketing) — landing, pricing, blog, legal, contact, payment success, and AI pages. - Authentication (
auth) — login, registration, verification guidance, forgot password, and reset password. - Dashboard (
_dashboard) — authenticated dashboard, account/settings, and admin surfaces. - Content (
_docs) — Fumadocs-powered documentation, alongside blog and legal collections. - Service routes (
src/routes/api) — Better Auth, contact email, Creem, storage, user/admin, chat, and media APIs.
The optional {-$locale} segment wraps these layouts: English URLs are
unprefixed, while Chinese URLs use /zh.
Start here
Follow the primary journey from a local Worker to a production deployment:
