Skip to content

Create-Node-App/nextjs-saas-ai-template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

16 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Next.js SaaS AI Template

Production-ready Next.js boilerplate for multi-tenant SaaS with AI built-in

GitHub stars License: MIT TypeScript Next.js React Tailwind CSS pnpm

Built with create-awesome-node-app

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.


πŸ› οΈ How to Use This Template

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.

⚑ Option 1 β€” CLI (Recommended β€” always up to date)

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

Browse 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.


πŸ™ Option 2 β€” GitHub Template (quick start, may be outdated)

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

Warning

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.


πŸš€ Getting Started

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 dev

Or with the DevContainer CLI:

npm install -g @devcontainers/cli

cd my-saas-app
devcontainer up --workspace-folder .
devcontainer exec --workspace-folder . pnpm dev

The DevContainer automatically configures PostgreSQL + pgvector, environment variables, and all tooling.

Open http://localhost:3000.

Note: Create .env.local only if you need to override specific values (e.g., OPENAI_API_KEY for AI features).


✨ 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

πŸ› οΈ Tech Stack

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

πŸ“ Project Structure

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)

πŸ“œ Scripts

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

πŸ“– Documentation

The single source of truth is docs/.


🀝 Contributing

Contributions, issues, and feature requests are welcome! See CONTRIBUTING.md for development guidelines.


πŸ“„ License

MIT β€” see LICENSE for details.


Part of the Create-Node-App ecosystem β€” spin up production-ready applications with best practices baked in.

About

This boilerplate is a Next.js, multi-tenant SaaS with AI built-in

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages