This project was created with Better-T-Stack, a modern TypeScript stack that combines Next.js, Hono, ORPC, and more.
- TypeScript - For type safety and improved developer experience
- Next.js - Full-stack React framework
- TailwindCSS - Utility-first CSS for rapid UI development
- Shared UI package - shadcn/ui primitives live in
packages/ui - Hono - Lightweight, performant server framework
- oRPC - End-to-end type-safe APIs with OpenAPI integration
- Bun - Runtime environment
- Drizzle - TypeScript-first ORM
- SQLite/Turso - Database engine
- Authentication - Better-Auth
First, install the dependencies:
bun installThis project uses SQLite with Drizzle ORM.
- Start the local SQLite database (optional):
bun run db:local-
Update your
.envfile in theapps/serverdirectory with the appropriate connection details if needed. -
Apply the schema to your database:
bun run db:pushIf you changed the schema (for example adding archived_at) and your API starts failing with no such column, run bun run db:push again for the current environment.
Then, run the development server:
bun run devOpen http://localhost:3001 in your browser to see the web application. The API is running at http://localhost:3000.
For cross-domain auth (cm-web -> cm-api) configure these server variables in cm-api:
BETTER_AUTH_URL=https://<your-api>.onrender.comCORS_ORIGIN=https://<your-web>.onrender.comTRUSTED_ORIGINS=https://<your-web>.onrender.com,https://<your-api>.onrender.comGOOGLE_CLIENT_ID=...GOOGLE_CLIENT_SECRET=...BETTER_AUTH_SECRET=...
And in cm-web:
NEXT_PUBLIC_SERVER_URL=https://<your-api>.onrender.com
Google OAuth redirect URI must match exactly:
https://<your-api>.onrender.com/api/auth/callback/google
React web apps in this stack share shadcn/ui primitives through packages/ui.
- Change design tokens and global styles in
packages/ui/src/styles/globals.css - Update shared primitives in
packages/ui/src/components/* - Adjust shadcn aliases or style config in
packages/ui/components.jsonandapps/web/components.json
Run this from the project root to add more primitives to the shared UI package:
npx shadcn@latest add accordion dialog popover sheet table -c packages/uiImport shared components like this:
import { Button } from "@cm/ui/components/button";If you want to add app-specific blocks instead of shared primitives, run the shadcn CLI from apps/web.
cm/
├── apps/
│ ├── web/ # Frontend application (Next.js)
│ └── server/ # Backend API (Hono, ORPC)
├── packages/
│ ├── ui/ # Shared shadcn/ui components and styles
│ ├── api/ # API layer / business logic
│ ├── auth/ # Authentication configuration & logic
│ └── db/ # Database schema & queries
bun run dev: Start all applications in development modebun run build: Build all applicationsbun run dev:web: Start only the web applicationbun run dev:server: Start only the serverbun run check-types: Check TypeScript types across all appsbun run db:push: Push schema changes to databasebun run db:generate: Generate database client/typesbun run db:migrate: Run database migrationsbun run db:studio: Open database studio UIbun run db:local: Start the local SQLite database