A production-ready monorepo template built with modern technologies, featuring authentication, payments, file storage, and more.
- Next.js 16 - React framework with App Router and Turbopack
- React 19 - UI library
- TypeScript 5.9 - Type safety
- Turborepo - High-performance build system
- pnpm - Fast, disk space efficient package manager
- Turbo - Incremental builds and caching
- shadcn/ui - Re-usable component library built with Radix UI
- Radix UI - Accessible, unstyled component primitives
- Tailwind CSS 4 - Utility-first CSS framework
- Lucide React - Icon library
- next-themes - Dark mode support
- TanStack Query (React Query) - Server state management
- tRPC - End-to-end typesafe APIs
- Zod - Schema validation and type inference
- Better Auth - Modern authentication library
- Better Auth Polar Plugin - Payment integration
- PostgreSQL - Database (works with Neon, Supabase, etc.)
- Drizzle ORM - TypeScript ORM with SQL-like syntax
- Neon HTTP - Serverless PostgreSQL driver
- Polar - Payment and subscription management
- AWS S3 - File storage via AWS SDK
- S3 Request Presigner - Secure file uploads
- AWS SES - Transactional email service
- React Hook Form - Performant forms
- Hookform Resolvers - Zod integration for forms
- Fumadocs - MDX-based documentation system
- ESLint - Code linting
- Prettier - Code formatting
- TypeScript - Type checking
packages/
βββ auth/ # Authentication logic (Better Auth)
βββ drizzle/ # Database schema and connection
βββ email/ # Email templates and logic
βββ hooks/ # Shared React hooks
βββ storage/ # File storage (S3) logic
βββ trpc/ # tRPC routers and client
βββ ui/ # Shared UI components (shadcn/ui)
apps/
βββ web/ # Main web application
βββ admin/ # Admin dashboard
- Node.js >= 20
- pnpm >= 10.4.1
- PostgreSQL database (Neon, Supabase, or self-hosted)
# Install dependencies
pnpm install
# Set up environment variables (see Environment Variables section)
cp .env.example .env
# Run database migrations
pnpm db:push
# Start development server
pnpm devTo add shadcn/ui components to your app, run:
pnpm dlx shadcn@latest add button -c apps/webThis will place the UI components in the packages/ui/src/components directory.
Import components from the ui package:
import { Button } from "@workspace/ui/components/button";- Root
.envfile - Your local environment variables - All apps - If used by multiple apps (web, admin), add to each app's environment
- Drizzle package - If it's
DATABASE_URL, also update inpackages/drizzle/.env(if using separate config) - turbo.json - Add the variable to the
envarray in thebuildtask so Turbo passes it during builds
Let's say you want to add NEW_API_KEY:
-
Add to
.envfile:NEW_API_KEY="your-key-here" -
Add to
turbo.jsonbuild task:{ "tasks": { "build": { "env": [ "DATABASE_URL", "NEW_API_KEY" // β Add here // ... other vars ] } } } -
If it's
DATABASE_URL, also update:packages/drizzle/.env(if you have one)packages/drizzle/drizzle.config.ts(if using dotenv there)
-
For production (Vercel, etc.):
- Add the variable in your hosting platform's environment variable settings
See apps/web/app/setup/SETUP_DOCUMENTATION.md for the complete list of required and optional environment variables.
Minimum required:
DATABASE_URL- PostgreSQL connection stringBETTER_AUTH_SECRET- Authentication secret (generate withopenssl rand -base64 32)BETTER_AUTH_URL- Your app URL (e.g.,http://localhost:3000)
pnpm dev # Start all apps in development mode
pnpm build # Build all apps
pnpm lint # Lint all packages
pnpm typecheck # Type check all packages
# Database
pnpm db:generate # Generate database migrations
pnpm db:push # Push schema changes to database
pnpm db:migrate # Run database migrations
pnpm db:studio # Open Drizzle Studio (database GUI)cd apps/web
pnpm dev # Start web app on port 3000
pnpm build # Build web app
pnpm start # Start production server- Setup Guide:
apps/web/app/setup/SETUP_DOCUMENTATION.md - API Documentation:
apps/web/app/api/API_DOCUMENTATION.mdx - Email Documentation:
packages/email/emails/EMAIL_DOCUMENTATION.mdx
.
βββ apps/
β βββ web/ # Main web application
β βββ admin/ # Admin dashboard
βββ packages/
β βββ auth/ # Authentication
β βββ drizzle/ # Database schema & connection
β βββ email/ # Email templates
β βββ hooks/ # Shared React hooks
β βββ storage/ # File storage logic
β βββ trpc/ # tRPC setup
β βββ ui/ # UI components
βββ turbo.json # Turborepo configuration
βββ pnpm-workspace.yaml # pnpm workspace config
- Never commit
.envfiles - Use strong, randomly generated secrets
- Rotate API keys regularly
- Use different keys for development/staging/production
Private template - see license file for details.