A modern, full-stack foundation for authenticated web applications built with Next.js 16, React 19, and TypeScript 6. Designed for performance, type safety, and developer experience.
- Framework: Next.js 16 (App Router) with React 19 & React Compiler
- Auth: Robust session-based authentication with
better-auth - Database: Prisma ORM with PostgreSQL 17
- Validation: Type-safe Server Actions and schema validation with
next-safe-actionandzod - UI: Tailwind CSS 4, shadcn/ui, and Base UI primitives
- Testing: Integrated Vitest and React Testing Library setup
- DX: Biome for ultra-fast linting/formatting, Husky for Git hooks, and Conventional Commits
| Technology | Version | Purpose |
|---|---|---|
| Next.js | 16.2.6 | Full-stack framework with App Router & Type-safe Routes |
| React | 19.2.6 | UI library with concurrent features & React Compiler |
| TypeScript | 6.0.0+ | Modern type-safe JavaScript |
| Technology | Version | Purpose |
|---|---|---|
| PostgreSQL | 17 | Relational database for persistent storage |
| Prisma | 7.8.0 | Type-safe ORM with auto-generated client |
| @prisma/adapter-pg | 7.8.0 | Native PostgreSQL adapter for Next.js |
| Technology | Version | Purpose |
|---|---|---|
| better-auth | 1.6.10 | Lightweight, secure authentication framework |
| Technology | Version | Purpose |
|---|---|---|
| Vitest | 4.1.5 | High-performance Vite-native test runner |
| React Testing Library | 16.3.2 | User-centric UI component testing |
| jsdom | 29.0.2 | Browser environment simulation for Node.js |
| Technology | Version | Purpose |
|---|---|---|
| Tailwind CSS | 4.x | Utility-first CSS framework |
| shadcn/ui | - | Accessible UI components built on Base UI |
| @base-ui/react | 1.3.0 | Headless UI primitives |
| Lucide React | 1.6.0 | Modern icon library |
| Technology | Version | Purpose |
|---|---|---|
| @tanstack/react-form | 1.27.7 | Performance-focused form state management |
| next-safe-action | 8.1.8 | Type-safe Server Actions with middleware |
| Zod | 4.3.6 | Schema-first validation |
- Node.js 22+
- pnpm 9+ (recommended)
- Docker Desktop/Engine
-
Clone the repository and install dependencies:
pnpm install
-
Setup environment variables: Run this command to create a
.envfile with default values and a generated secret:cat << EOF > .env # Authentication BETTER_AUTH_SECRET=$(openssl rand -base64 32) BETTER_AUTH_URL=http://localhost:3000 # Database DATABASE_USER=postgres DATABASE_PASSWORD=postgres DATABASE_NAME=nextjs_template DATABASE_URL=postgresql://postgres:postgres@localhost:5432/nextjs_template # Application NODE_ENV=development EOF
-
Start local infrastructure (Docker):
docker compose up -d
-
Initialize database:
pnpm db:generate pnpm db:seed # Optional -
Start development server:
pnpm dev
Open http://localhost:3000 to see your app.
├── src/
│ ├── actions/ # Type-safe Server Actions (mutations)
│ ├── app/ # Next.js App Router (pages, layouts, APIs)
│ ├── components/ # UI components (UI primitives, feature components)
│ ├── dal/ # Data Access Layer (cached database reads)
│ ├── hooks/ # Custom React hooks
│ ├── lib/ # Core logic (Auth, Prisma, Logger, Schemas)
│ └── __tests__/ # Test suites
├── prisma/ # Database schema and migrations
└── public/ # Static assets
| Command | Description |
|---|---|
pnpm dev |
Start development server |
pnpm build |
Production build |
pnpm start |
Start production server |
pnpm test |
Run Vitest test suite |
pnpm lint |
Lint code with Biome |
pnpm format |
Format code with Biome |
pnpm db:studio |
Interactive database GUI |
pnpm db:generate |
Generate Prisma client |
pnpm commit |
Interactive Conventional Commit CLI |
pnpm analyze |
Analyze bundle size |
Optimized for performance with:
reactCompiler: truecacheComponents: truetypedRoutes: true
Used for both linting and formatting. Extremely fast and replaces ESLint/Prettier.
- Configuration found in
biome.json.
MIT