Boilerplate
A full-stack product starter you can demo in an afternoon and still run in production a
year later: sign-up and sign-in (passwords with emailed verification codes, passkeys,
two-factor, Google), workspaces with roles and invitations, billing, notifications on
every channel, file uploads with virus scanning, an AI assistant over your documents, a
mobile app, a REST API with keys, and the infrastructure to ship all of it.
Everything is in the repo and off by default. The core profile starts in minutes on a
laptop; each optional feature switches on when its settings are present.
Day 1: a demo or a hackathon
You need Node 24 (nvm use), Bun 1.3, Docker, and uv:
code generation runs the Python service's exporter, so setup, bun dev, types and tests
need it even if you never touch Python. bun run doctor checks all of it. Nothing to
install: with VS Code or Codespaces, the devcontainer (.devcontainer/) has Node, Bun,
uv, Docker and what shipping needs (OpenTofu, kubectl, Helm with helm-unittest, kind,
sops, age and gh), and runs setup when it's created.
bun run setup # once: .env with fresh secrets, dependencies, local services, migrations
bun dev # web :3000, api :3001, worker :3002, notifications :3003, webhooks :3004
bun run db:seed # optional: demo users, workspaces and data
Open http://localhost:3000 and sign up. Verification codes and every other email land
in Mailpit at http://localhost:58025. bun dev:full adds the AI service (:8000) and its
worker, RustFS and ClamAV, the Stalwart mail server, Jaeger, the Expo bundler for the
mobile app and the email previews (:3030). Uploads switch on with
bun run env:set S3_BUCKET=uploads, and billing with the Stripe variables or the fake
Stripe (docs/files-and-billing.md).
Local services run in Docker with memory limits on their own ports (55432 for
Postgres, 56379 for Valkey, 5xxxx for the rest), so they sit beside other projects. The
core needs about 1.4 GB of Docker's memory free, the full profile about 3.9 GB; the start
refuses when they don't fit. bun run docker:clean removes everything this repo created
in Docker.
When something is off, bun run doctor says what and how to fix it, and
docs/troubleshooting.md covers the rest. Then
CONTRIBUTING.md has the conventions and
docs/README.md the rest of the docs.
Going to production
docs/new-project.md is the checklist from the first clone to the
first production release, in order: making it yours, the GitHub settings, secrets per
environment, machines and DNS, the first deploy and what only a real cluster shows, and
the first release. docs/deploy.md explains how changes then flow to
staging and production.
What's inside
| Path | What |
|---|
apps/web | Next.js, render-only: every read and write goes through the API |
apps/api | NestJS on Fastify: auth (better-auth), the oRPC API for web and mobile, REST at /api/v1 with an OpenAPI document, an MCP server |
apps/worker | Outbox relay, audit log, file scanning, scheduled jobs |
apps/notifications | Email, in-app, SMS and push, with preferences, digests and unsubscribe |
apps/webhooks | Inbound provider webhooks (Stripe) and signed outbound webhooks for customers |
apps/ai | Python: FastAPI, Pydantic AI, LangGraph, pgvector search, evals, an MCP server |
apps/mobile | Expo (iOS, Android, web) on the same API client and translations |
packages/* | Contracts, the API client and hooks, database, jobs, i18n, email templates, UI kit, shared Nest plumbing |
deploy/ | Container images, Helm charts, Argo CD, the local kind cluster |
infra/tofu | OpenTofu: k3s on machines you run anywhere, Cloudflare in front, the Argo CD bootstrap |
flowchart LR
browser[Browser / mobile app] -->|pages| web[web]
browser -->|/rpc, /api| api[api]
api --> pg[(Postgres, row-level security)]
api -->|outbox| pg
worker[worker] -->|relays outbox| q[(Valkey queues)]
q --> notifications[notifications]
q --> webhooks[webhooks]
api -->|documents, answers, streaming| ai[ai]
ai -->|indexing jobs| q
webhooks -->|Stripe events| q
Every tenant row is guarded by forced row-level security and each service connects as
its own least-privileged database role. Writes that other services react to go through
a transactional outbox, so nothing is lost between a commit and a queue.
docs/architecture.md has the whole picture.
Everyday commands