A CLI tool for scaffolding production-ready Next.js boilerplate projects.
scaffold is a code generator that creates customized Next.js projects based on your selected template. It provides multiple pre-configured templates to jumpstart your development with best practices, conventions, and modern tooling already set up.
npm add @jeftecaro/next-scaffoldpnpm add @jeftecaro/next-scaffoldyarn add @jeftecaro/next-scaffoldView all available templates:
pnpm scaffold listStart an interactive setup wizard:
pnpm scaffold setupYou'll be prompted to:
- Enter your project name
- Select a template
- Choose output directory (defaults to current directory)
| Parameter | Description |
|---|---|
-n, --name <name> |
Project Name |
-t, --template <template> |
Template type |
-d, --dir <dir> |
Output directory |
Create a project with specific template:
pnpm scaffold create my-app --template basic
pnpm scaffold create my-app --template full-stack --dir ./projectsscaffold provides a comprehensive collection of templates, including local starters and curated templates from Vercel. Templates are organized by category:
| Parameter | Description |
|---|---|
basic |
Minimal Next.js setup with TypeScript and ESLint |
dashboard |
|
analytics |
|
calendars |
|
chat |
|
cms |
Content management with markdown and SEO optimization |
crm |
|
ecommerce |
Product catalog, shopping cart, and checkout flows |
files |
|
inbox |
|
payment |
|
projects |
|
shop |
|
video-call |
|
workspace |
Basic - Minimal Next.js setup with TypeScript and ESLint
Full-stack - Next.js with API routes and database integration
E-commerce - Product catalog, shopping cart, and checkout flows
SaaS - Authentication, billing, multi-tenant architecture
Blog - Content management with markdown and SEO optimization
Monorepo - Turborepo workspace with multiple apps and shared packages
- Chatbot - Full-featured AI chatbot
- Gemini AI Chatbot - Gemini-powered chat interface
- Hume AI Voice Interface - Voice chat with empathic AI
- Lead Agent - Lead qualification agent with Slack integration
- Morphic - AI-powered answer engine
- Pinecone RAG - Retrieval-augmented generation with vector database
- Customer Reviews AI - Summarize customer feedback with LLM
- qrGPT - AI QR code generator
- AI Headshot Generator - Professional headshot generation
- Next.js Commerce - Shopify integration
- Medusa Store - Medusa ecommerce platform
- Stripe Subscription - SaaS billing with Stripe
- Platforms Starter - Multi-tenant architecture
- Next.js SaaS Starter - Complete SaaS setup
- Enterprise Boilerplate - Enterprise-grade setup
- Liveblocks Starter - Real-time collaboration
- Sanity Personal Website - Sanity CMS integration
- Sanity Clean App - Sanity with visual editor
- Nextra Docs - Documentation site generator
- Blog Starter Kit - Markdown-based blog
- Contentlayer Blog - Blog with Contentlayer
- ISR WordPress Blog - Headless WordPress integration
- Portfolio Starter - Portfolio with markdown
- Portfolio with Blog - Portfolio + blog combination
- App Router Playground - Examples of App Router features
- Image Gallery - Cloudinary image gallery
- Supabase Starter - Supabase authentication
- Email Client - Email management app
- Preview Mode - Content preview functionality
packages/scaffold/
├── src/
│ ├── cli.ts # CLI entry point
│ ├── index.ts # Public API
│ ├── commands/ # CLI commands
│ │ ├── setup.ts
│ │ ├── list.ts
│ │ └── create.ts
│ ├── utils/ # Utility functions
│ │ ├── logger.ts
│ │ ├── generator.ts
│ │ └── templates.ts
│ └── templates/ # Template presets
│ └── presets/
│ └── basic/ # Template files
├── tests/ # Test files
├── package.json
├── tsconfig.json
└── README.md
Local Templates - Custom templates maintained in this workspace
- Located in
packages/scaffold/src/templates/presets/ - Local customization and full control
- Workspace conventions and best practices
Vercel Templates - Curated templates from the Vercel community
- Referenced via metadata (URL, description, features)
- Community-tested and maintained
- Wide variety of use cases and technologies
- Ideal for learning and quick starts
pnpm buildRun CLI in development mode with ts-node:
pnpm run dev -- list
pnpm run dev -- setupRun tests:
pnpm testRun tests with coverage:
pnpm test:coveragepnpm check-typespnpm lintTo add a new local template:
- Create a new directory in
src/templates/presets/<template-name> - Add template files (package.json, layout.tsx, etc.)
- Update
src/templates/index.tswith template metadata - Update
src/commands/list.tsto include the new template - Add tests in
tests/
Example:
mkdir -p src/templates/presets/my-template
# Add template filesThen update src/templates/index.ts:
export const TEMPLATES_METADATA: Record<string, TemplateMetadata> = {
// ... existing templates
"my-template": {
name: "My Template",
description: "Description of your template",
category: "basic",
features: ["Feature 1", "Feature 2"],
nextVersion: "14+",
source: "local",
},
};To add a reference to a Vercel template (without downloading it):
- Update
src/templates/index.tswith the template metadata:
"template-id": {
name: "Template Name",
description: "Description from Vercel",
category: "category",
features: ["Feature 1", "Feature 2"],
nextVersion: "14+",
repository: "https://vercel.com/templates/...",
source: "vercel",
}- The template will automatically appear in
pnpm scaffold list - Users can see details about it without it being pre-packaged
The CLI can be invoked from any directory in the workspace:
# From root
pnpm scaffold setup
# From an app
cd apps/web
pnpm scaffold create my-project --template basic
# From another location
pnpm scaffold listRoot workspace scripts that use scaffold:
pnpm scaffold # Show help
pnpm scaffold:setup # Run setup wizard
pnpm scaffold:list # List templatesUse scaffold programmatically:
import {
setupCommand,
createCommand,
getTemplates,
getTemplateMetadata,
} from "@repo/scaffold";
// List all templates
const templates = getTemplates();
// Get template metadata
const basic = getTemplateMetadata("basic");
// Programmatically create a project
await createCommand("my-app", {
template: "basic",
dir: "./projects",
});After creating a project:
cd my-app
pnpm install
pnpm devYour project will be available at http://localhost:3000
When contributing new features or templates:
- Follow the existing code structure
- Add tests for new functionality
- Update documentation
- Ensure TypeScript types are correct
- Follow the workspace ESLint configuration
Categories help organize templates by their primary use case:
basic- Minimal starter projectsfull-stack- Backend + frontend integratione-commerce- Online store and commercesaas- Multi-tenant and subscription appsblog- Content and documentation sitesmonorepo- Multi-package workspacesai- AI/ML and generative featurescms- Content management systemsportfolio- Personal websites and portfoliosdocumentation- Doc sites and knowledge basesenterprise- Large-scale applications
Add new categories by updating the TemplateMetadata interface category type union.
MIT