A production-ready Next.js web application template for rapidly scaffolding modern full-stack projects. This template provides a complete authentication system, database setup, and UI component library out of the box.
This is a template repository designed to quickly bootstrap new web applications with a modern, type-safe tech stack. It includes:
- Full-stack type safety with tRPC connecting frontend and backend
- Authentication pre-configured with email and Google OAuth
- Database layer set up with Prisma ORM and PostgreSQL
- UI components from shadcn/ui built on Radix primitives
- Form handling with React Hook Form and Zod validation
- State management using TanStack React Query
- Styling with Tailwind CSS 4
Use this template to skip the initial project setup and jump straight into building your application features.
- Framework: Next.js 16.1 (App Router)
- Language: TypeScript
- Database: PostgreSQL with Prisma ORM
- API Layer: tRPC for end-to-end type safety
- Authentication: Better Auth with Email & Google OAuth
- UI Components: shadcn/ui + Radix UI
- Styling: Tailwind CSS 4
- State Management: TanStack React Query
- Form Handling: React Hook Form + Zod
- Development: mprocs for running multiple processes
.
├── Makefile # Database and dev commands
├── mprocs.yaml # Multi-process development setup
├── prisma/
│ └── schema.prisma # Database schema
├── public/ # Static assets
├── src/
│ ├── app/ # Next.js App Router pages
│ │ ├── (auth)/ # Auth pages (login, signup)
│ │ ├── api/ # API routes (tRPC, auth)
│ │ └── clippers/ # Example feature pages
│ ├── components/
│ │ ├── app/ # App-specific components
│ │ └── ui/ # shadcn/ui components
│ ├── features/ # Feature modules
│ │ ├── auth/ # Authentication components
│ │ └── entity/ # Example CRUD feature
│ ├── lib/ # Utilities and configs
│ │ ├── auth.ts # Better Auth configuration
│ │ ├── db.ts # Prisma client
│ │ └── utils/ # Helper functions
│ └── trpc/ # tRPC configuration
│ ├── routers/ # API route definitions
│ └── client.tsx # tRPC React client
└── tsconfig.json
- Node.js 20+
- PostgreSQL database
- npm package manager
- Use this template to create a new repository or clone it:
git clone <your-repo-url>
cd <your-project-name>- Install dependencies:
npm install-
Set up environment variables (see Environment Variables section below)
-
Initialize the database:
make db/resetThis will create the database schema and run migrations.
Start the development server with all processes:
npm run dev:allThis uses mprocs to run the Next.js dev server and other development processes concurrently.
Open http://localhost:3000 in your browser.
npm run build
npm startCreate a .env file in the root directory with the following required variables:
# Database
DATABASE_URL=""
# Auth
BETTER_AUTH_SECRET=""
BETTER_AUTH_URL="http://localhost:3000"
GOOGLE_CLIENT_ID=""
GOOGLE_CLIENT_SECRET=""
# Next server config
NEXT_PUBLIC_APP_URL="http://localhost:3000"- DATABASE_URL: PostgreSQL connection string in the format:
postgresql://username:password@localhost:5432/database_name
- BETTER_AUTH_SECRET: Secret key for session encryption. Generate with:
openssl rand -base64 32
- BETTER_AUTH_URL: Base URL where your app is hosted (use
http://localhost:3000for local development) - GOOGLE_CLIENT_ID: OAuth 2.0 client ID from Google Cloud Console
- GOOGLE_CLIENT_SECRET: OAuth 2.0 client secret from Google Cloud Console
Setting up Google OAuth:
- Go to Google Cloud Console
- Create a new project or select existing one
- Enable Google+ API
- Create OAuth 2.0 credentials
- Add authorized redirect URIs:
http://localhost:3000/api/auth/callback/google
- NEXT_PUBLIC_APP_URL: Public-facing URL of your application (same as BETTER_AUTH_URL for most cases)
npm run dev- Start Next.js development servernpm run dev:all- Start all development processes with mprocsnpm run build- Build for productionnpm start- Start production servermake db/reset- Reset database and run migrationsnpx prisma studio- Open Prisma Studio to view/edit databasenpx prisma generate- Regenerate Prisma client
- Email/password authentication
- Google OAuth integration
- Protected routes and API endpoints
- Session management
- User navigation component
- Prisma ORM with PostgreSQL
- Example models (User, Session, Account, Verification)
- Example CRUD feature in
src/features/entity
Full shadcn/ui component library including buttons, forms, dialogs, tables, and more.
- tRPC setup with type-safe API routes
- React Query integration
- Example router in
src/trpc/routers/_app.ts
- Update the app name and branding in
src/components/app/AppLogo.tsx - Modify the Prisma schema in
prisma/schema.prismaand run migrations - Add new tRPC routers in
src/trpc/routers/ - Create new feature modules in
src/features/ - Add new pages in
src/app/
- Next.js Documentation
- tRPC Documentation
- Prisma Documentation
- Better Auth Documentation
- shadcn/ui Documentation
- Tailwind CSS Documentation
MIT