A production-ready Next.js 15 template with modern tooling and best practices.
- Next.js 15 with App Router
- React 19 with TypeScript
- Tailwind CSS for styling
- Atomic Design component structure
- ESLint 9 with strict rules
- Prettier for code formatting
- Husky + lint-staged for commit hooks
- Turbopack for fast development
- Prisma ORM with PostgreSQL
- Redis integration for caching and data store
- GitHub Actions for CI/CD
- Docker for production deployment
# Install dependencies
pnpm install
# Setup environment
cp .env.example .env
# Edit .env with your database and Redis URLs
# For Docker Compose, also set POSTGRES_PASSWORD to a secure value
# Setup database
pnpm docker:up
pnpm db:generate
pnpm db:push
# Start development server
pnpm dev
# Build for production
pnpm build
# Start production server
pnpm start
# Or run with Docker
pnpm docker:prod:build# Run all checks
pnpm check
# Individual checks
pnpm lint # ESLint
pnpm typecheck # TypeScript
pnpm format # Prettier formatting# Generate Prisma client
pnpm db:generate
# Push schema changes to database
pnpm db:push
# Create and run migrations
pnpm db:migrate
# Open Prisma Studio
pnpm db:studio- Redis is included in
docker-compose.ymland runs onlocalhost:6379by default. - The Redis connection string is set via
REDIS_URLin your.envfile:REDIS_URL="redis://localhost:6379" - A health check API route is available at
/api/redis.
# Development environment
pnpm docker:up # Start dev services (PostgreSQL, Redis)
pnpm docker:down # Stop dev services
pnpm docker:logs # View logs
pnpm docker:reset # Reset and restart services
# Production environment
pnpm docker:build # Build production image
pnpm docker:prod # Run production stack
pnpm docker:prod:build # Build and run production stackThis project uses Husky and lint-staged to ensure code quality:
- Pre-commit: Automatically runs ESLint and Prettier on staged files
- Commit-msg: Validates commit message format
Use conventional commit format:
type(scope): description
Examples:
feat: add user authentication
fix(auth): resolve login issue
docs: update README
style: format code
refactor: improve component structure
test: add unit tests
chore: update dependencies
- Install PostgreSQL locally (or use Docker Compose)
- Create a database:
createdb webapp_template - Update
.env:DATABASE_URL="postgresql://postgres:postgres@localhost:5432/webapp_template"
Use a cloud PostgreSQL service like:
- Supabase (free tier available)
- Neon (free tier available)
- Railway (free tier available)
- Render (free tier available)
- Create a PostgreSQL database
- Copy the connection string to your
.envfile - Run
pnpm db:pushto create tables
- Sign up at Prisma Accelerate
- Create a new project
- Copy the connection string to your
.envfile - Run
pnpm db:pushto create tables
src/
├── app/ # Next.js App Router
│ ├── api/ # API routes
│ │ ├── auth/ # Authentication endpoints
│ │ │ ├── cleanup/ # Session cleanup
│ │ │ ├── google/ # Google OAuth
│ │ │ └── logout/ # Logout endpoint
│ │ ├── hello/ # Example API route
│ │ └── redis/ # Redis test endpoint
│ ├── login/ # Login page
│ ├── profile/ # User profile page
│ ├── layout.tsx # Root layout
│ ├── page.tsx # Home page
│ └── globals.css # Global styles
├── components/
│ ├── atoms/ # Basic building blocks
│ │ └── Button.tsx
│ ├── molecules/ # Simple combinations
│ ├── organisms/ # Complex UI sections
│ │ └── SampleButton.tsx
│ └── templates/ # Page layouts
├── lib/ # Core business logic and utilities
│ ├── auth.ts # Authentication utilities
│ ├── db.ts # Database client (Prisma)
│ ├── redis.ts # Redis client
│ ├── session.ts # Session management
│ ├── user.ts # User management
│ ├── user.test.ts # User unit tests
│ └── session.test.ts # Session unit tests
├── types/ # TypeScript definitions
│ └── auth.ts # Authentication types
├── hooks/ # Custom React hooks
├── constants/ # App constants
├── utils/ # Utility functions
└── styles/ # Additional styles
tests/
└── integration/ # Integration tests
├── session.test.ts # Session integration tests
└── user.test.ts # User integration tests
prisma/
├── schema.prisma # Database schema
└── migrations/ # Database migrations
- Framework: Next.js 15 (App Router)
- Language: TypeScript 5
- Styling: Tailwind CSS 4
- Package Manager: pnpm
- Linting: ESLint 9 + Prettier
- Git Hooks: Husky + lint-staged
- Development: Turbopack
- Database: PostgreSQL + Prisma ORM
- Cache/Store: Redis (ioredis)
- CI/CD: GitHub Actions
- Deployment: Docker + Docker Compose
GET /api/hello- Returns hello message and database statusGET /api/redis- Returns Redis health check
MIT