---
title: Stack recipes
summary: Proven tool combinations for common kinds of projects, each with a starter prompt.
section: stacks
phase: plan
order: 2
last_reviewed: 2026-11-20
---

# Stack recipes

Each recipe is a known-good combination of tools. Pick the closest one and adapt it.

> **Note:** Tools change quickly. Recipes are reviewed regularly (check `last_reviewed`). The *roles* in each recipe stay stable even when specific products change.

## How to use a recipe

1. **Pick the closest one** to what you are building. Don't mix several.
2. **Keep the roles, change the products** where your constraints differ (budget, skills, data location, compliance). The roles stay stable even when products change.
3. **Pin versions** and put them in `AGENTS.md`, then have the agent **plan first**.
4. **Verify** with the checks on the relevant topic pages (auth, deployment, testing), not just "it runs".

---

## 1. Marketing / content site
**For:** Business sites, portfolios, blogs, docs.
| Role | Choice |
|---|---|
| Framework | Astro or Next.js (static export) |
| Styling | Tailwind CSS |
| Content | MDX files or a headless CMS (Sanity, Payload) |
| Forms | Server action/route → Resend email |
| Hosting | Vercel / Netlify / Cloudflare Pages |
| Analytics | Plausible or Vercel Analytics |

```text
Scaffold a <business type> marketing site with Next.js (App Router, TypeScript),
Tailwind, and MDX for blog posts. Pages: home, services, about, blog, contact.
Contact form posts to a server action that validates with Zod, rate-limits, and
emails via Resend. Excellent Lighthouse scores, proper metadata/OG images,
sitemap.xml, robots.txt, and JSON-LD for a LocalBusiness.
```
*Why it works:* It lists the pages, the contact-form behaviour (validate, rate-limit, email) and the search and sharing basics, so the agent doesn't stop at a pretty homepage.

## 2. SaaS web app
**For:** Dashboards, B2B tools, anything with accounts and billing.
| Role | Choice |
|---|---|
| Framework | Next.js + TypeScript |
| UI | Tailwind + shadcn/ui |
| DB | Postgres (Neon/Supabase) + Drizzle |
| Auth | Better Auth / Clerk |
| Payments | Stripe (Checkout + Billing + webhooks) |
| Email | Resend + React Email |
| Errors | Sentry |
| Hosting | Vercel |

```text
Scaffold a multi-tenant SaaS: Next.js 15 App Router, TypeScript, Tailwind,
shadcn/ui, Drizzle + Postgres, <Better Auth> with organizations and roles
(owner/admin/member), Stripe subscription billing per organization with
webhook handling (signature verified, idempotent), Resend transactional email.
Include: typed env validation, a can() authorization helper used everywhere,
Vitest + Playwright setup, GitHub Actions CI, and AGENTS.md. Plan first.
```
*Why it works:* It names the hard parts agents skip (verified, idempotent webhooks, one authorization helper, typed env) and ends with "Plan first", so you approve the architecture before any code.

## 3. API / backend service
**For:** A public API, a mobile backend, a service shared by many clients.
| Role | Choice |
|---|---|
| Framework | Hono or Fastify (TS), FastAPI (Python) |
| Validation & docs | Zod + OpenAPI / Pydantic + FastAPI docs |
| DB | Postgres + Drizzle / SQLAlchemy |
| Jobs | Inngest, Trigger.dev, or a Postgres-backed queue |
| Hosting | Railway / Fly / Render / Cloud Run (container) |

```text
Scaffold a REST API in Hono + TypeScript with Drizzle and Postgres for <domain>.
Resources: <list with fields>. Auth: session cookie for our web app and API keys
for third parties. Rules: validate every input with Zod; users reach only their
own records (404 for others'); one error shape { error: { code, message } };
cursor pagination on lists; an Idempotency-Key on POST endpoints that create
things. Generate an OpenAPI spec and a Dockerfile. Write integration tests for
auth, ownership, validation, pagination and replayed requests, and run them.
```
*Why it works:* It carries the API checklist from [Building an API](/docs/backend/building-an-api.md) into the scaffold, so ownership, pagination and retries aren't afterthoughts.

## 4. AI-powered app
**For:** Chat, RAG over documents, agentic features.
| Role | Choice |
|---|---|
| Framework | Next.js + Vercel AI SDK (or Python + FastAPI) |
| Models | Anthropic / OpenAI / Google APIs, routed through a gateway if you use several |
| Retrieval | Postgres + pgvector |
| Evals | A test set of graded examples, run in CI |
| Observability | LLM tracing (Langfuse, Braintrust, or similar) |

```text
Build a RAG feature: users upload PDFs, we chunk and embed them into Postgres
with pgvector, and a chat UI answers questions with citations to the source
chunk. Stream responses. Treat model output as untrusted (no HTML injection).
Add an eval script with 20 question/expected-source pairs (draft them from
<sample documents> and show them to me before using them) and report retrieval
hit rate. Keep the model provider behind one interface so it's swappable.
```
*Why it works:* It treats model output as untrusted, requires an eval with a pass criterion, and keeps the provider swappable. See [Building with LLM APIs](/docs/ai-agents/building-with-llm-apis.md) and [Security of agentic workflows](/docs/ai-agents/agent-security.md).

## 5. Real-time / collaborative app
**For:** Chat, multiplayer, live dashboards.
| Role | Choice |
|---|---|
| Sync | Convex, Liveblocks, PartyKit, or Supabase Realtime |
| Raw transport | WebSockets / Server-Sent Events |
| Alt. framework | Phoenix LiveView (Elixir) |

```text
Build a shared checklist that several people can edit at once, using <Supabase Realtime / Convex / Server-Sent Events>. Choose between a sync service and raw WebSockets or Server-Sent Events and justify the choice for this app. Requirements: updates appear for everyone within a second, edits stay correct when two people change the same item, the connection recovers after a drop, and only signed-in members of the list receive its updates. Include a test that simulates two clients and a disconnect.
```
*Why it works:* It asks for the transport decision to be justified and names the real-time failure cases (conflicts, reconnects, who may listen), which are where these apps break.

## 6. Internal tool / script
**For:** Automations, admin panels, data jobs.
| Role | Choice |
|---|---|
| Language | Python (uv) or TypeScript (Bun) |
| UI (if needed) | Streamlit, Retool, or a minimal Next.js page |
| Scheduling | GitHub Actions cron, or the platform's cron |

```text
Write a Python script (managed with uv) that every night pulls <source>, validates each record, and writes the results to <destination>. It must be safe to run twice (idempotent), have a --dry-run flag, log what it did without logging secrets, exit non-zero on failure, and read credentials from environment variables. Add a GitHub Actions workflow that runs it on a schedule and notifies me on failure. Test it with sample data and show the output.
```
*Why it works:* Idempotency, a dry run and a loud failure are what make an unattended script trustworthy.

## Worked example: adapting a recipe

**Task:** Build a SaaS for dental clinics that must keep patient data in the EU, on a small budget.

Start from recipe 2 (SaaS web app). The roles stay the same: framework, UI, database, auth, payments, email, errors, hosting. What changes is some of the products and where they run.

The agent's first answer swaps the whole stack for a collection of unfamiliar "EU-friendly" tools. The better approach keeps the boring roles and changes only what the constraint touches: choose an EU region for the database and the host, decide whether auth is a library you host or a provider whose data location you have checked, and review where email and error tracking send personal data. For each service, read the provider's own documentation for where it stores data, and don't take the agent's word for it.

```text
Adapt recipe 2 (SaaS web app) for this constraint: <patient data must stay in the EU; small budget>. For each role in the recipe, say whether to keep it or change it and why. List every service that would store or process personal data, where it runs, and how I can verify that from its documentation. Change as little as possible, and tell me what you are unsure about. Don't scaffold anything yet.
```
*Why it works:* "Keep or change, and why" per role stops a wholesale swap, and the data-location list is the check that the constraint is actually met.

## Check your understanding

```quiz
Q: What should stay stable when the specific products in a recipe change?
- [ ] The brand names
- [x] The roles (framework, database, auth, payments, hosting) and the decisions each one stands for
- [ ] The version numbers
> Why: Products come and go quickly. The roles describe what a stack needs, so you can swap a product without redesigning.

---

Q: Your project is close to a recipe but has one unusual constraint. What is the best approach?
- [ ] Combine two or three recipes
- [x] Start from the closest recipe and change only the roles that the constraint affects
- [ ] Ignore the recipes and start from scratch
> Why: Changing less keeps you on well-known tools, which is where agents are most reliable.
```
