Enable BetterAuth's emailOTP plugin for password resets: a 6-digit code, valid for 10 minutes with 3 attempts, stored hashed in `verifications` (no migration). The code goes out through the existing Resend mailer with a new Spanish template, and other sessions are revoked after the reset. The web app gets a two-step /forgot-password route (request the code, then set the new password) linked from sign-in. Unknown emails get the same responses as known ones so the form doesn't reveal accounts. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Superlist
Monorepo with a Bun + Hono API and a React + Vite admin app.
| Workspace | What it is |
|---|---|
apps/api |
Bun + Hono backend, Prisma (Postgres), Zod validation, Pino logging |
apps/web |
React + Vite + TypeScript frontend, shadcn/ui, TanStack Router + Query |
packages/shared |
@superlist/shared — Result pattern and RFC 9457 Problem Details types |
See STACK.md for the stack and AGENTS.md for the architecture conventions.
Requirements
- Bun (workspace package manager and API runtime)
- Postgres (only needed once you run migrations)
Getting started
bun install
# API
cp apps/api/.env.example apps/api/.env # then edit DATABASE_URL / BETTER_AUTH_SECRET
bun run db:generate # prisma generate
bun run db:migrate # requires a reachable Postgres
# Web
cp apps/web/.env.example apps/web/.env
Run everything in parallel:
bun run dev # turbo run dev → api on :4100, web on :7153
Or a single workspace: bun run dev --filter=@superlist/web.
Verification
bun run build # turbo run build
bun run lint # biome check per package (lint + format + import order)
bun run typecheck # tsc
bun run test # bun test (api) / vitest (web, shared)
There is no hosted CI: run these locally (in that order) before pushing. bun run lint:ci runs the exact
same Biome check as biome ci would.
Deployment (Dokploy)
docker-compose.yml at the repo root defines the two runtime services — api (Bun + nginx-free Hono server)
and web (static build behind nginx, proxying /api/* to the API). The database is external (provided by
Dokploy). Only web joins the external dokploy-network so Traefik can reach it; web and api talk over
the stack-private internal network, where the API answers to the unique alias superlist-api (a generic
name like api on the shared network could resolve to another project's container).
- One public domain: nginx serves the SPA and proxies
/api/*→http://superlist-api:4100. All API routes are mounted under/apifor that reason — never mount a route at the root of the API. - Env vars are interpolated from the Dokploy service env (
docker-compose.ymlmarksDATABASE_URL,BETTER_AUTH_SECRET,BETTER_AUTH_URL,CORS_ORIGINandWEB_APP_URLas required). See.env.example. - Point the domain in Dokploy's Domains UI at the
webservice, container port80(the compose file publishes no host ports on purpose). - Migrations run automatically on API startup (
prisma migrate deploybeforebun run start).
Local smoke test of the same setup:
docker network create dokploy-network # once, mimics Dokploy's network
docker compose up --build
Useful scripts
| Command | Effect |
|---|---|
bun run lint:fix |
Apply Biome fixes: lint, formatting and import sorting (whole repo) |
bun run lint:ci |
biome ci — whole-repo check, stricter than lint |
bun run format |
Format with Biome (format:check to verify only) |
bun run db:generate |
Regenerate the Prisma client into apps/api/src/generated |
bun run db:migrate |
Create and apply a migration (development) |
bun run db:studio |
Open Prisma Studio |
Auth
BetterAuth is mounted by the API under /api/auth/* and uses the Prisma adapter. The web app talks to it
through apps/web/src/lib/auth-client.ts; the _authenticated route layout redirects to /sign-in when there
is no session.