A TypeScript monorepo implementing pieces of Better Auth in a Hono API, with a TanStack Start web app consuming it to demonstrate how they work together. 🎓 It’s a starter template with no business logic, so you could even grab the files and use them to kick-start your own project.
flowchart LR
subgraph "monorepo"
A["📁 apps/api<br/>Hono API<br/>Better Auth"]
W["📁 apps/web<br/>TanStack Start<br/>React + SSR"]
S["📁 packages/*<br/>Zod schemas<br/>shared utilities"]
end
U((User))
D[(PostgreSQL)]
E{{Emails}}
S -.-> A
S -.-> W
U <-->|Web| W
U <-->|Mobile| A
W <-->|HTTP| A
A <--> D
A -->|SMTP| E
| User | Admin | Docker Compose |
|---|---|---|
| 🔹 Register and verify your email 🔹 Update your profile 🔹 Log in with cookies or bearer tokens |
🔹 View users 🔹 Revoke sessions |
▪️ db▪️ mail▪️ api▪️ web |
Click Here for the demo!
It’s an ephemeral database. 🛡️
Register, or use a test credential to sign in.
Working defaults in the compose config and in .env files.
Just run:
docker compose up -dDocker Compose mounts the PostgreSQL data in the ./pgdata folder.
Open http://localhost:3000 to access the UI.
More details on the dev page.
A wise man once told me the source code is the best documentation. Share it with your favourite AI agent and ask for the details.
That Jekyll page is anything but RTFM.
| Package | API | Web | Description |
|---|---|---|---|
| Better Auth | ✓ | ✓ | Authentication framework on PostgreSQL |
| Biome | ✓ | ✓ | Code format and linter |
| Bun | ✓ | ✓ | TypeScript runtime |
| Hono | ✓ | API framework | |
| Lucide | ✓ | Icons | |
| Nodemailer | ✓ | Send emails | |
| Pino | ✓ | Logger | |
| React | ✓ | ✓ | Library for user intrfaces (emails in API) |
| Tailwind CSS | ✓ | Utility-first CSS framework | |
| TanStack Form | ✓ | Headless UI for type-safe forms | |
| TanStack Query | ✓ | Data fetching | |
| TanStack Start | ✓ | Full-stack framework powered by Vite | |
| TanStack Table | ✓ | Headless UI for tables & datagrids | |
| Zod | ✓ | ✓ | Schema validation with static type inference |