A modern fullstack web application boilerplate with a unified monorepo structure. Both frontend and backend share a single src directory with a common TypeScript configuration, allowing selective imports of only what's needed.
The project uses a monorepo approach where:
- Frontend (
src/client/) - React application built with Vite - Backend (
src/server/) - Express server with tRPC API - Shared (
src/shared/) - Utilities and types shared between client and server - Single
tsconfig.json- Unified TypeScript configuration for both frontend and backend
This architecture enables type-safe communication between frontend and backend while maintaining clean separation of concerns.
- React 19 - UI library
- Vite - Build tool with HMR
- React Router - Client-side routing
- TailwindCSS - Utility-first CSS framework
- Express - Web server framework
- tRPC - End-to-end typesafe APIs
- Better Auth - Authentication library
- Prisma - ORM for database management
- PostgreSQL - Database
- TypeScript - Type safety
- Vitest - Unit testing framework
- ESLint - Code linting
- React Query - Server state management
- Prettier - Code formatter with Tailwind plugin
- Node.js 18+
- PostgreSQL database
npm installCopy .env.example to .env and configure your database connection:
cp .env.example .envGenerate Prisma client and push schema to database:
npm run db:generate
npm run db:pushRun both frontend and backend in development mode:
npm run devThis starts:
- Frontend on
http://localhost:5173(Vite dev server) - Backend on
http://localhost:5000(Express server)
The frontend proxies tRPC and API requests to the backend.
npm run dev- Start frontend and backend in development modenpm run client:dev- Start only frontend dev servernpm run server:dev- Start only backend dev servernpm run build- Build both frontend and backend for productionnpm run client:build- Build frontend onlynpm run server:build- Build backend onlynpm run start- Start production servernpm run test- Run tests with Vitestnpm run lint- Run ESLintnpm run db:generate- Generate Prisma clientnpm run db:push- Push schema changes to databasenpm run db:migrate- Create and apply database migrations
src/
├── client/ # React frontend
│ ├── components/ # Reusable React components
│ ├── pages/ # Page components
│ ├── app.tsx # Root component
│ ├── main.tsx # Entry point
│ ├── trpc.ts # tRPC client setup
│ └── auth.ts # Client auth utilities
├── server/ # Express backend
│ ├── router.ts # tRPC router definition
│ ├── trpc.ts # tRPC server setup
│ ├── main.tsx # Server entry point
│ ├── prisma.ts # Prisma client instance
│ └── env.ts # Environment variables
├── shared/ # Shared utilities
│ └── utils.ts # Common utilities
└── auth.ts # Shared auth configuration
- Type-Safe APIs - tRPC ensures end-to-end type safety between frontend and backend
- Authentication - Better Auth integration for secure user authentication
- Database ORM - Prisma for type-safe database queries
- Styling - TailwindCSS with Prettier integration for consistent formatting
- Testing - Vitest for unit and integration tests
- Protected Routes - Built-in protected route component for authenticated pages