Introduction
Welcome to the Next.js SaaS Template documentation
Welcome
This is a production-ready Next.js SaaS template built with modern best practices, extensive AI/agent support, and a focus on developer experience. The template emphasizes type safety, feature-based architecture, and clean code patterns.
What's Included
Everything you need to build a modern SaaS application:
- Feature-Based Architecture - Organized 5-file pattern for scalable modules
- Type-Safe APIs - tRPC with full-stack TypeScript
- Database - PostgreSQL with Drizzle ORM, caching, and RLS
- Authentication - Better-Auth with OAuth and role-based access
- Internationalization - next-intl with declarative routing
- UI Components - Shadcn UI with Tailwind CSS
- Error Handling - Comprehensive error translation system
- File Storage - Firebase/S3 integration
- AI Agent Support - Configurations for Claude, Cursor, Copilot, and more
Quick Links
- Getting Started - Installation and setup
- Architecture - Understand the tech stack and design
- Patterns - Learn code conventions and best practices
- Templates - Step-by-step guides for common tasks
- Development - Commands, workflows, and AI agents
Tech Stack
| Category | Technology |
|---|---|
| Framework | Next.js 16+ (App Router) |
| Language | TypeScript |
| Database | PostgreSQL + Drizzle ORM |
| API | tRPC |
| Authentication | Better-Auth |
| UI | Shadcn UI + Tailwind CSS |
| Forms | React Hook Form + Zod |
| State | React Query (via tRPC) |
| i18n | next-intl |
Documentation Structure
This documentation is organized into focused sections:
Core Concepts
- Architecture - Tech stack, middleware, and design principles
- Patterns - Feature modules, error handling, and type safety
- Database - Schema, operations, migrations, and RLS
- API - tRPC procedures, OpenAPI, and rate limiting
Development
- Templates - Step-by-step guides for creating features, pages, and tables
- Development - Commands, AI agent setup, and workflows
- Configuration - Environment variables and app settings
Frontend
- Routing & i18n - Declarative routing and translations
- Components & UI - Icons, typography, forms, and styling
- Auth & Access - Authentication flows and authorization
Key Principles
This template follows strict conventions:
- Always use
typenotinterface - Use double quotes for strings
- Feature-based organization - 5-file pattern for all features
- Type safety first - Zod schemas and TypeScript everywhere
- Component standards -
<Icon>,<H1>-<H6>,<Section>components - Error handling -
ActionResponsepattern with translations - No arbitrary values - Use design tokens from config
See Patterns for the complete list of conventions.