
Next Forge
OfficialFreeA robust template for Next.js SaaS applications.
Free · Opens the source repo
What Next Forge does
Next Forge is a comprehensive Turborepo template designed for developers building production-grade SaaS applications with Next.js. It offers a monorepo structure that includes multiple applications and shared packages, facilitating the development of complex systems with ease. The template comes pre-configured with essential integrations for authentication, database management, payments, email handling, and more, allowing developers to focus on building features rather than setting up infrastructure.
The setup process is straightforward. By running npx next-forge init, developers can quickly scaffold a new project, specifying their preferred package manager. The template includes a variety of applications such as a main authenticated SaaS app, a marketing website, and a serverless API, each running on designated ports. This organization promotes a clear separation of concerns, making it easier to manage and develop each component independently.
Next Forge also emphasizes flexibility and safety through its environment variable management. Each app and package can define its own environment variables, which are validated at build time using Zod. This ensures that developers are alerted to any missing configurations without causing runtime errors. Additionally, the template's architecture supports graceful degradation, allowing optional features to be disabled if their corresponding environment variables are not set.
With comprehensive documentation available in the bundled references, developers can easily navigate through setup, customization, and deployment processes. Whether you are a seasoned developer or new to building SaaS applications, Next Forge provides the tools and structure necessary to accelerate your development workflow.
When to use it
Use Next Forge when starting a new SaaS project with Next.js, especially if you prefer a monorepo structure and need built-in integrations.
When not to use it
This skill may not be suitable for simple projects or applications that do not require the full suite of features offered by Next Forge.
What you can build with it
Starting a New SaaS Project
Quickly scaffold a new SaaS application using Next Forge to leverage its built-in features and integrations.
Managing Multiple Applications
Use the monorepo structure to manage multiple related applications and shared packages efficiently.
Integrating with Third-Party Services
Easily add integrations for services like Stripe or Clerk by configuring environment variables without extensive setup.
How to install Next Forge
View source1. Install with the skills CLI
npx skills add vercel/vercel-plugin/next-forge --agent claude-code2. Or install it manually
Download the skill folder and drop it into ~/.claude/skills/ for all projects, or .claude/skills/ to scope it to one repo. Restart Claude Code so it picks up the new skill.
Anthropic's agentic coding CLI, and the reference implementation of Agent Skills. Drop a skill folder into ~/.claude/skills and Claude Code loads it automatically whenever a task matches the skill's description. Claude Code docs
Inside SKILL.md
Written by vercelnext-forge
next-forge is a production-grade Turborepo template for building Next.js SaaS applications. It provides a monorepo structure with multiple apps, shared packages, and integrations for authentication, database, payments, email, CMS, analytics, observability, security, and more.
Quick Start
Initialize a new project:
npx next-forge@latest init
The CLI prompts for a project name and package manager (bun, npm, yarn, or pnpm). After installation:
- Set the
DATABASE_URLinpackages/database/.envpointing to a PostgreSQL database (Neon recommended). - Run database migrations:
bun run migrate - Add any optional integration keys to the appropriate
.env.localfiles. - Start development:
bun run dev
All integrations besides the database are optional. Missing environment variables gracefully disable features rather than causing errors.
Architecture Overview
The monorepo contains apps and packages. Apps are deployable applications. Packages are shared libraries imported as @repo/<package-name>.
Apps (in /apps/):
| App | Port | Purpose |
|---|---|---|
app | 3000 | Main authenticated SaaS application |
web | 3001 | Marketing website with CMS and SEO |
api | 3002 | Serverless API for webhooks, cron jobs |
email | 3003 | React Email preview server |
docs | 3004 | Documentation site (Mintlify) |
storybook | 6006 | Design system component workshop |
studio | 3005 | Prisma Studio for database editing |
Core Packages: auth, database, payments, email, cms, design-system, analytics, observability, security, storage, seo, feature-flags, internationalization, webhooks, cron, notifications, collaboration, ai, rate-limit, next-config, typescript-config.
For detailed structure, see references/architecture.md.
Key Concepts
Environment Variables
Environment variable files live alongside apps and packages:
apps/app/.env.local— Main app keys (Clerk, Stripe, etc.)apps/web/.env.local— Marketing site keysapps/api/.env.local— API keyspackages/database/.env—DATABASE_URL(required)packages/cms/.env.local— BaseHub tokenpackages/internationalization/.env.local— Languine project ID
Each package has a keys.ts file that validates environment variables with Zod via @t3-oss/env-nextjs. Type safety is enforced at build time.
Inter-App URLs
Local URLs are pre-configured:
NEXT_PUBLIC_APP_URL=http://localhost:3000NEXT_PUBLIC_WEB_URL=http://localhost:3001NEXT_PUBLIC_API_URL=http://localhost:3002NEXT_PUBLIC_DOCS_URL=http://localhost:3004
Update these to production domains when deploying (e.g., app.yourdomain.com, www.yourdomain.com).
Server Components First
page.tsx and layout.tsx files are always server components. Client interactivity goes in separate files with 'use client'. Access databases, secrets, and server-only APIs directly in server components and server actions.
Graceful Degradation
All integrations beyond the database are optional. Clients use optional chaining (e.g., stripe?.prices.list(), resend?.emails.send()). If the corresponding environment variable is not set, the feature is silently disabled.
Common Tasks
Running Development
bun run dev # All apps
bun dev --filter app # Single app (port 3000)
bun dev --filter web # Marketing site (port 3001)
Database Migrations
After changing packages/database/prisma/schema.prisma:
bun run migrate
This runs Prisma format, generate, and db push in sequence.
Adding shadcn/ui Components
npx shadcn@latest add [component] -c packages/design-system
Update existing components:
bun run bump-ui
Adding a New Package
Create a new directory in /packages/ with a package.json using the @repo/<name> naming convention. Add it as a dependency in consuming apps.
Linting and Formatting
bun run lint # Check code style (Ultracite/Biome)
bun run format # Fix code style
Testing
bun run test # Run tests across monorepo
Building
bun run build # Build all apps and packages
bun run analyze # Bundle analysis
Deployment
Deploy to Vercel by creating separate projects for app, web, and api — each pointing to its respective root directory under /apps/. Add environment variables per project or use Vercel Team Environment Variables.
For detailed setup and customization instructions, see:
references/setup.md— Installation, prerequisites, environment variables, database and Stripe CLI setupreferences/packages.md— Detailed documentation for every packagereferences/customization.md— Swapping providers, extending features, deployment configurationreferences/architecture.md— Full monorepo structure, Turborepo pipeline, scripts
Frequently asked questions about Next Forge
Similar skills
Python PyPI Package Builder
Streamline the process of creating and publishing Python packages.
Minecraft Plugin Development
Streamline your Minecraft server plugin creation.
MCP Server Builder
Easily build .NET MCP servers with the latest standards.
CommunityToolkit.Mvvm Messenger
Decoupled communication for ViewModels in .NET applications.
MVVM Toolkit DI
Streamline ViewModel integration with Dependency Injection in .NET.
MCP Apps Builder
Essential guidelines for MCP server development.
