Documentation
Documentation
Introduction

Getting Started

Getting started
Getting StartedInstallationQuick StartProject Structure

Configuration

Configuration
ConfigurationEnvironment ConfigurationEdge ConfigDatabaseAuth SecretStripeFirebaseStorageGoogle Maps And Cloud Service AccountOAuth ProvidersEmail DeliverySentryFeature Flags

Architecture

Architecture
Architecture OverviewTech StackoRPC MiddlewareDesign Principles

Patterns

Patterns
Code Patterns & ConventionsFeature ModulesError HandlingType Safety

Database

Database
DatabaseSetupSchema DefinitionDatabase OperationsMigrationsCaching
Data Tables

API

oRPCProceduresRoutersoRPC Proxy Setup
APIsOpenAPIREST Endpoints

Auth & Access

AuthenticationConfigurationOAuth ProvidersRolesSession Management
AuthorizationUser RolesPermissions

Routing & i18n

RoutingDeclarative RoutingNavigation
InternationalizationTranslationsLocale Routing

Components & UI

ComponentsButtonsFormsNavigationDialogs
StylesTailwind CSSThemingTypography

Storage

Storage
StorageConfigurationUsageBuckets
Stripe Billing

Extra

Caching

Templates

Templates
Template GuidesCreate New FeatureCreate New PageCreate Database TableCreate oRPC RouterAdd Translations

Development

Development
DevelopmentCommandsAI AgentsBest Practices
Pulling Updates

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 - oRPC 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

CategoryTechnology
FrameworkNext.js 16+ (App Router)
LanguageTypeScript
DatabasePostgreSQL + Drizzle ORM
APIoRPC
AuthenticationBetter-Auth
UIShadcn UI + Tailwind CSS
FormsReact Hook Form + Zod
StateReact Query (via oRPC)
i18nnext-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 - oRPC 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:

  1. Always use type not interface
  2. Use double quotes for strings
  3. Feature-based organization - 5-file pattern for all features
  4. Type safety first - Zod schemas and TypeScript everywhere
  5. Component standards - <Icon>, <H1>-<H6>, <Section> components
  6. Error handling - ActionResponse pattern with translations
  7. No arbitrary values - Use design tokens from config

See Patterns for the complete list of conventions.

On this page

Welcome
What's Included
Quick Links
Tech Stack
Documentation Structure
Core Concepts
Development
Frontend
Key Principles