Production-ready Next.js boilerplate for multi-tenant SaaS with AI built-in
A fully-featured, production-ready Next.js 15 template for building multi-tenant SaaS applications with AI capabilities built-in. Part of the Create-Node-App ecosystem.
Tip
Using the CLI is always recommended over cloning this repo directly. This template repository may become outdated over time. The CLI always fetches the latest version of the template plus lets you add extensions (Tailwind, shadcn/ui, Auth.js, Drizzle, i18n, and more) in a single command.
Use create-awesome-node-app to scaffold the latest version of this template with optional addons:
npx create-awesome-node-app my-saas-app \
--template nextjs-saas-ai-starterBrowse all available templates, extensions, and docs at create-awesome-node-app.vercel.app.
Note
The CLI automatically pulls the latest template version and lets you compose extensions on top of it. This repo snapshot may lag behind. Always prefer the CLI for new projects.
Click the "Use this template" button at the top of this page, or:
gh repo create my-saas-app --template Create-Node-App/nextjs-saas-ai-template --clone
cd my-saas-appWarning
This repository is a point-in-time snapshot. It may not include the latest updates, bug fixes, or new extensions available through the CLI. For production projects, Option 1 is strongly recommended.
Once you have created your project (via the CLI or GitHub template above), start the local development environment using DevContainer β no manual setup needed.
Prerequisites: Docker + IDE with Dev Containers support (VS Code, Cursor)
cd my-saas-app
# Open in VS Code/Cursor and click "Reopen in Container"
pnpm devOr with the DevContainer CLI:
npm install -g @devcontainers/cli
cd my-saas-app
devcontainer up --workspace-folder .
devcontainer exec --workspace-folder . pnpm devThe DevContainer automatically configures PostgreSQL + pgvector, environment variables, and all tooling.
Open http://localhost:3000.
Note: Create
.env.localonly if you need to override specific values (e.g.,OPENAI_API_KEYfor AI features).
- π’ Multi-tenant architecture β tenant-scoped routes (
/t/[tenant]), full tenant isolation in DB - π Auth.js v5 + Auth0 β SSO, database sessions, development credentials provider
- ποΈ PostgreSQL 17 + pgvector + Drizzle ORM β type-safe queries, vector similarity search
- π€ AI assistant β OpenAI/Anthropic via Vercel AI SDK, RAG with embeddings
- π Permission-Based Access Control (PBAC) β roles are bundles of permissions, multi-role support
- π Integration architecture β GitHub OAuth2 example, extensible via
integration_sync_control - π‘οΈ Admin panel β member management, roles, settings, webhooks, bulk import
- π£ Outbound webhooks β configurable with delivery tracking
- π Audit logging β all sensitive operations are tracked
- π File uploads β AWS S3 in production, MinIO for local dev
- π¦ DevContainer + direnv β zero-config local development environment
- π i18n β next-intl with English and Spanish out of the box
- π Storybook β component development and visual testing
- β‘ GitHub Actions CI β build, lint, type-check, tests, mega-linter
- π§© Feature template β
_feature-template_scaffold for adding new features
| Category | Technology |
|---|---|
| Framework | Next.js 15 (App Router, RSC, Turbopack) |
| Language | TypeScript 5+ (strict) |
| Styling | Tailwind CSS v4 + shadcn/ui |
| Database | PostgreSQL 17 + pgvector + Drizzle ORM |
| Auth | Auth.js v5 + Auth0 (SSO) + database sessions |
| AI | OpenAI / Anthropic via Vercel AI SDK + RAG/embeddings |
| File Storage | AWS S3 (production) / MinIO (local dev) |
| i18n | next-intl (EN + ES) |
| Testing | Jest + React Testing Library |
| Linting | ESLint 9 (flat config) + Prettier + Mega Linter |
| CI/CD | GitHub Actions |
| Dev Env | DevContainer + direnv |
src/
βββ app/ # Next.js App Router
β βββ (auth)/ # Auth routes (login, tenant selection)
β βββ (tenant)/t/[tenant]/ # Tenant-scoped routes
β βββ api/ # API routes
β βββ layout.tsx # Root layout
βββ features/ # Feature modules
β βββ admin/ # Admin panel
β βββ assistant/ # AI assistant
β βββ auth/ # Authentication
β βββ _feature-template_/ # Template for new features
βββ shared/ # Shared infrastructure
β βββ components/ui/ # shadcn/ui components
β βββ db/ # Database (Drizzle + pgvector)
β βββ lib/ # Utilities (auth, permissions, env)
βββ i18n/ # Translations (EN, ES)
| Command | Description |
|---|---|
pnpm dev |
Start development server |
pnpm build |
Build for production |
pnpm lint |
Run ESLint |
pnpm type-check |
Run TypeScript check |
pnpm test |
Run tests |
pnpm storybook |
Start Storybook (port 6006) |
pnpm db:push |
Push schema to database (dev) |
pnpm db:migrate |
Run pending migrations |
pnpm db:studio |
Open Drizzle Studio |
The single source of truth is docs/.
- Full index: docs/README.md
- Architecture: docs/PROJECT_STRUCTURE.md
- Auth: docs/AUTHENTICATION.md
- Database: docs/DATABASE.md
- Permissions (PBAC): docs/ROLES_AND_PERMISSIONS.md
- API: docs/API.md
- Integrations: docs/INTEGRATIONS.md
- Deployment: docs/DEPLOYMENT.md
- Contributing: CONTRIBUTING.md
Contributions, issues, and feature requests are welcome! See CONTRIBUTING.md for development guidelines.
MIT β see LICENSE for details.
Part of the Create-Node-App ecosystem β spin up production-ready applications with best practices baked in.