A modern fullstack web project template with:
- Runtime: Native Bun (no Node.js, no Turborepo)
- Frontend: TanStack Start + React 19
- Backend: ElysiaJS + Eden Treaty (type-safe API)
- Auth: Better Auth with Drizzle adapter
- Database: Drizzle ORM + Bun SQLite
- UI: Tailwind CSS v4 with custom shadcn-style components
- Bun v1.1.0 or later
-
Install dependencies:
bun install
-
Copy environment file:
cp .env.example .env
-
Generate and run database migrations:
bun run db:generate bun run db:migrate
-
Start the development servers:
bun run dev
The frontend will be available at http://localhost:3000 and the API at http://localhost:3001.
bun-fullstack-template/
├── apps/
│ ├── web/ # TanStack Start frontend
│ │ └── src/
│ │ ├── routes/ # File-based routing
│ │ ├── components/ui/ # Custom UI components
│ │ └── lib/ # Utilities
│ │
│ └── api/ # ElysiaJS backend
│ └── src/
│ ├── app.ts # Main app with type export
│ └── routes/ # API routes
│
└── packages/
├── database/ # Drizzle ORM + Bun SQLite
├── auth/ # Better Auth config
└── api-client/ # Eden Treaty client
| Script | Description |
|---|---|
bun run dev |
Start all development servers |
bun run dev:api |
Start API server only |
bun run dev:web |
Start frontend only |
bun run build |
Build all packages and apps |
bun run db:generate |
Generate Drizzle migrations |
bun run db:migrate |
Run migrations |
bun run db:studio |
Open Drizzle Studio |
bun run lint |
Run Biome linter |
bun run lint:fix |
Fix lint issues |
The API types flow from backend to frontend:
apps/api/src/app.ts
└─> export type App = typeof app
│
▼
packages/api-client
└─> treaty<App>(url)
│
▼
apps/web
└─> api.api.demo.greeting({ name }).get()
// Full autocomplete & type checking!
Custom shadcn-style components are available in apps/web/src/components/ui/:
Button- Variant-based button with loading statesInput- Styled input with label and error supportCard- Card container with header/content/footerBadge- Status badges with variantsSpinner- Loading spinner
All components use the cn() utility for class merging.
Swagger documentation is available at http://localhost:3001/swagger when the API is running.
MIT