Options
Every option in the stack builder: what it does and why you would pick it.
Repository
- Monorepo
Apps in apps/, shared code in packages/.
Pick it when the app, the API or shared packages will grow apart and need their own builds.
Try it in the builder - Single repo
One package; folders follow a structure preset.
Pick it for one app with one build: less config, and everything is one import away.
Try it in the builder
Apps
- One app
Front end, back end for front end and API share one app.
One app to run and deploy; the API lives beside the pages that call it.
Try it in the builder - Split apps
The API is its own app beside the front end.
The API gets its own app, so it can ship, scale or be reused without the front end.
Only a Hono API is its own app; pick Hono as back end.
Try it in the builder
App names
- web / apiTry it in the builder
- client / serverTry it in the builder
Structure
- Layered
src/client, src/server and src/lib: split by where code runs.
Easy to see what runs in the browser and what runs on the server.
Try it in the builder - Feature folders
src/features/<name> holds a feature's router, schema and UI together.
Keeps one feature's UI, API and schema together, so a change stays in one folder.
Try it in the builder - Flat
src/routes, src/server, src/db: one folder per kind.
The fewest decisions: one folder per kind of file, fine for a small app.
Try it in the builder
App source
- src/client
Routes, router and pages in src/client; server code beside it in src/server.
Mirrors src/server, so client and server code are never mixed in one folder.
Try it in the builder - src
TanStack's default: routes and router at the top of src.
TanStack's own layout, so its docs and examples match your paths one to one.
Try it in the builder - src/app
Named like Next's app folder: routes and router in src/app.
Familiar if you come from Next's app folder.
Try it in the builder
Import alias
Front end
- TanStack Router
A client-rendered single-page app.
A client-only app: the simplest to host, when pages need no server rendering.
Try it in the builder - TanStack Start
Router's typed routes plus server rendering and server functions in one app.
Try it in the builder - Next.js
The largest ecosystem and the most hosting guides, built around React Server Components.
Try it in the builder
Back end
- Hono
A small, fast server that runs on Workers, Bun and Node alike, so the API is portable.
Try it in the builder - TanStack Start
Server routes inside the Start app.
No second server: server routes and functions live inside the Start app.
Start's server routes need the Start front end.
Try it in the builder - Next.js
Route handlers inside the Next app.
No second server: route handlers live inside the Next app.
Next route handlers need the Next front end.
Try it in the builder - None
A front end only; data comes from somewhere you already have.
Try it in the builder
Runtime
- Cloudflare Workers
Runs at the edge with no servers to manage, and D1, R2 and KV are one binding away.
Try it in the builder - Bun
Fast installs and startup, with TypeScript run directly.
Try it in the builder - Node
The most widely supported runtime, for hosts and libraries that expect it.
Try it in the builder
API
- oRPC
End-to-end types plus OpenAPI output, so other clients can call the same API.
Needs a back end.
Try it in the builder - tRPC
End-to-end types with the most mature React Query integration.
Needs a back end.
Try it in the builder - None
The back end's own typed calls: Hono RPC, server functions or route handlers.
No extra layer: the back end's own typed calls are enough for one app.
Try it in the builder
Database
- SQLite
One file locally and D1 or Turso when hosted: cheap, fast and simple to back up.
Needs a back end.
Try it in the builder - Postgres
The default for relational data at scale, with the richest types and extensions.
Needs a back end.
Try it in the builder - None
No database yet; add one when the app has something to keep.
Try it in the builder
ORM
- Drizzle
SQL-shaped, light and edge-friendly, with schemas that are plain TypeScript.
Try it in the builder - Prisma
A schema language and generated client, with the most mature migration tooling.
Try it in the builder
Database setup
- Cloudflare D1
SQLite managed by Cloudflare and bound to the Worker: no connection strings.
D1 is SQLite. D1 is bound to a Worker; pick the Workers runtime.
Try it in the builder - Turso
Hosted SQLite reachable from any runtime, with replicas near the users.
Turso is SQLite.
Try it in the builder - Docker
Runs the database locally in a container that matches production.
The Docker setup runs Postgres.
Try it in the builder - Supabase
Hosted Postgres with a dashboard and one connection string any runtime can use.
Supabase hosts Postgres; pick Postgres as database.
Try it in the builder - NeonPlanned
- Local file
A local file only: nothing to sign up for while you build.
A Worker has no local disk; use D1 or Turso. Postgres needs a server.
Try it in the builder
Schema files
- schema/ folder
schema/index.ts re-exports one file per area: auth.ts, todo.ts and so on.
One file per area keeps each table near its feature as the schema grows.
Try it in the builder - One file
schema.ts, with the auth tables in auth-schema.ts.
Every table in one place, which is easier to read while the schema is small.
Try it in the builder
File storage
- None
No file storage yet; add it when the app has uploads or large files to keep.
Try it in the builder - Cloudflare R2
Object storage with no egress fees, bound to the Worker like D1: no keys to manage.
R2 binds to a Worker; pick the Workers runtime. Needs a back end.
Try it in the builder - S3-compatible
AWS S3, MinIO, Backblaze and other S3 APIs; works on any runtime.
The S3 API most clouds and MinIO speak, so one client moves between providers.
Needs a back end.
Try it in the builder
Deploy
- Cloudflare
Workers and assets on Cloudflare's network: global by default and free to start.
Cloudflare deploys the Workers runtime.
Try it in the builder - Docker
A container image that runs on any host that runs containers.
A Worker deploys to Cloudflare.
Try it in the builder - Vercel
Next.js on Vercel, built from the repository: no config file to write.
Next.js from its makers: a preview for every push, and no server to run.
Vercel hosts Next.js; pick Next as front end. Vercel runs Next on Node or Bun; pick one as runtime.
Try it in the builder - None
Build now and choose a host later.
Try it in the builder
Deployables
- One deployable
One Worker or container serves pages and API.
One thing to deploy and roll back; pages and API always ship together.
Split apps ship as two.
Try it in the builder - Two deployables
The API ships on its own.
The API deploys on its own schedule and can serve other clients.
Only a Hono API can ship apart.
Try it in the builder
Auth
- Better Auth
Self-hosted, typed, and plugin-based, so sessions and users stay in your database.
Needs a back end. Better Auth keeps users in a database.
Try it in the builder - None
No accounts; add auth when something needs a signed-in user.
Try it in the builder
Auth client
- Auth package
packages/auth/src/client.ts, beside the server config in server.ts.
Server and client config live together, so every app imports the same auth.
Only a monorepo has an auth package.
Try it in the builder - auth/client.ts
In the app, in an auth folder of its own.
The app owns its auth client, in a folder that can grow.
Try it in the builder - lib/auth-client.ts
In the app's lib folder.
One file beside the other helpers, the least ceremony.
Try it in the builder
Payments
- Stripe
Through Better Auth's Stripe plugin.
Subscriptions tied to Better Auth users, with the webhook handled by the plugin.
The Stripe plugin needs Better Auth.
Try it in the builder - NoneTry it in the builder
Package manager
- bun
The fastest installs, and the same tool runs scripts and tests.
Try it in the builder - pnpm
Strict, disk-efficient installs with mature workspace support.
Try it in the builder - npm
Ships with Node, so nothing extra to install.
Try it in the builder
Add-ons
- PWA
Installable on phones and desktops, with offline caching.
Try it in the builder - Fumadocs
A docs site from MDX, inside the same repository.
Fumadocs renders on a server; pick Start or Next.
Try it in the builder - StarlightPlanned
- Biome
Formatting and linting in one fast tool with one config.
Try it in the builder - Oxlint
A very fast linter that catches bugs ESLint rules would, in a fraction of the time.
Try it in the builder - Husky
Runs checks before commits with the most widely known Git hooks setup.
Try it in the builder - Lefthook
Git hooks in one YAML file, run in parallel, with no Node install script.
Try it in the builder - GitHub Actions
Checks every push to main and every pull request from a clean install of the lockfile.
Try it in the builder - Vitest
Unit tests in Vite's own toolchain: one test of each port, run without a database.
The tests check the API's ports; pick a back end. The tests check each example's port; pick an example.
Try it in the builder - Turborepo
Caches and orders monorepo tasks, so unchanged packages are not rebuilt.
Only for a monorepo.
Try it in the builder - Nx
Monorepo task running with a project graph and generators.
Only for a monorepo.
Try it in the builder - Changesets
Versions and changelogs from small notes written with each change.
Try it in the builder - Tegami
Release notes as files, versioned and published from CI by one command.
Try it in the builder - evlogPlanned
- UltracitePlanned
- RulerPlanned
Examples
- Todo
List, add and toggle through the API and the database.
Shows a full round trip: page, API, database and back.
Needs a back end. Stores todos; needs a database.
Try it in the builder - Notes
Each signed-in user's own notes, behind auth.
Shows the same round trip behind a signed-in user.
Notes belong to a user; needs auth.
Try it in the builder - Bookmarks
Saved links per user: search, favorites, add and delete, behind auth.
Exercises the whole setup: a query that takes input, filters, and every kind of write, per user.
Bookmarks belong to a user; needs auth.
Try it in the builder