create-nextjs-backend
v2.0.2
Published
Complete Next.js 16.1.1 backend structure generator with production-ready files
Downloads
67
Maintainers
Readme
🚀 Create Next.js Backend
A powerful CLI tool to scaffold production-ready Next.js 16+ backend structures with 365 pre-built templates across 4 skill levels.
✨ Features
- 🎯 365 Production-Ready Templates - Pre-built modules for every backend need
- 📊 4 Skill Levels - Beginner, Intermediate, Advanced, Expert
- 🎨 3 Setup Modes - Basic, Full Auto, Modular (Pick & Choose)
- ⚡ Next.js 16+ Optimized - Built for App Router architecture
- 🔧 TypeScript First - Fully typed templates
- 📦 Modular Design - Add/remove templates anytime
- 🎭 Interactive CLI - Beautiful prompts with boxen & chalk
- 🔄 Smart Structure - Follows Next.js best practices
📦 Installation
NPX (Recommended)
npx create-nextjs-backendGlobal Installation
npm install -g create-nextjs-backend
create-nextjs-backendLocal Development
git clone https://github.com/yourusername/create-nextjs-backend.git
cd create-nextjs-backend
npm install
npm link
create-nextjs-backend🚀 Quick Start
1. Run the CLI
npx create-nextjs-backend2. Follow Interactive Prompts
┌─────────────────────────────────────────────────┐
│ │
│ Next.js 16.1.1 Backend Generator │
│ │
│ Create production-ready backend structure │
│ 365 templates across 4 skill levels │
│ │
└─────────────────────────────────────────────────┘
? Select App Router Type:
❯ App Router (Next.js 13+) - Recommended
Pages Router - Classic Next.js
? Choose Your Backend Complexity Level:
❯ 🟢 Beginner - Essential features (50 templates)
🟡 Intermediate - Common features (150 templates)
🟠 Advanced - Complex features (100 templates)
🔴 Expert - Cutting-edge features (65 templates)
? Choose structure type:
❯ ⚡ Basic Structure - Essential files only
🚀 Full Auto - All templates automatically
🎛️ Modular (Pick & Choose) - Select specific templates3. Project Created!
✅ Successfully created 247 files!
📂 Created Structure Preview
Location: D:\projects\my-nextjs-backend
Total Files: 247
Run "tree /f" to see full structure📚 Skill Levels
🟢 Beginner (50 Templates)
Perfect for: Small projects, MVPs, learning Next.js
Includes:
- ✅ API Routes
- ✅ Database Connections (MongoDB, PostgreSQL, MySQL)
- ✅ Basic Auth (JWT, Sessions)
- ✅ File Upload (Cloudinary, AWS S3)
- ✅ Email (SendGrid, Nodemailer)
- ✅ Payment Gateways (Stripe, PayPal)
- ✅ Caching (Redis, Memory)
- ✅ Validation (Zod, Yup)
🟡 Intermediate (150 Templates)
Perfect for: Production apps, SaaS products, team projects
Includes Everything in Beginner +
- 📊 Analytics (Google, Mixpanel, PostHog)
- 🔐 Advanced Auth (OAuth, SAML, WebAuthn)
- 📬 Background Jobs (BullMQ, Agenda)
- 🔄 Real-time (Socket.io, Pusher, Ably)
- 🌍 i18n & Localization
- 🧪 Testing (Jest, Vitest, Playwright)
- 🐳 Docker & CI/CD
- 🔍 Search (Elasticsearch, Algolia)
- 🤖 AI/ML Basics (OpenAI, Langchain)
- 📈 Monitoring (Sentry, DataDog)
🟠 Advanced (100 Templates)
Perfect for: Enterprise apps, complex systems, microservices
Includes Everything Above +
- 🔷 Microservices Architecture
- 🌊 Event Streaming (Kafka, RabbitMQ)
- 🔗 Distributed Tracing (Jaeger, OpenTelemetry)
- 🏗️ Infrastructure as Code (Terraform, CDK)
- 🔬 MLOps (Model deployment, monitoring)
- 💾 Data Pipelines (Airflow, Dagster)
- 🔒 Advanced Security (Zero Trust, HSM)
- 🌐 Edge Computing
- 📊 Data Warehouses (Snowflake, BigQuery)
- 🚰 Stream Processing (Flink, Spark)
🔴 Expert (65 Templates)
Perfect for: Cutting-edge projects, research, innovation
Includes Everything Above +
- ⚛️ Quantum Computing (Qiskit)
- 🧠 Brain-Computer Interface
- 🌐 Metaverse & Web3
- 🏦 DeFi (Smart Contracts, DAOs)
- 🖼️ NFT Marketplaces
- 🧬 Bioinformatics
- 🔭 Astronomy & Space Tech
- ☢️ Nuclear Facility Systems
- 🗳️ E-Government & Voting
- 🚑 Emergency Services
📁 Project Structure
Generated Structure
my-nextjs-backend/
├── 📄 .env.example
├── 📄 .gitignore
├── 📄 middleware.ts
├── 📄 next.config.ts
├── 📄 tsconfig.json
├── 📄 package.json
├── 📄 README.md
│
└── 📂 src/
├── 📂 app/
│ ├── 📂 api/
│ ├── layout.tsx
│ └── page.tsx
│
├── 📂 lib/
├── 📂 types/
├── 📂 utils/
│
├── 📂 database/ # MongoDB, PostgreSQL, MySQL, etc.
├── 📂 auth/ # JWT, OAuth, Sessions
├── 📂 api-routes/ # REST endpoints
├── 📂 services/ # Business logic
├── 📂 middleware/ # Auth, validation, logging
├── 📂 caching/ # Redis, Memcached
├── 📂 email/ # Email templates & sending
├── 📂 storage/ # S3, Cloudinary
├── 📂 payments/ # Stripe, PayPal
├── 📂 analytics/ # Tracking & metrics
└── 📂 [selected templates...]🎨 Template Categories
🔧 Core & Infrastructure (14)
- API Routes, Database, Config, Middleware, Types, Validators, etc.
🔐 Authentication & Security (25)
- JWT, OAuth, SAML, WebAuthn, Passkey, 2FA, IP Control, etc.
💳 Payments & Commerce (15)
- Stripe, PayPal, Crypto, Subscriptions, Invoicing, etc.
📊 Data & Analytics (30)
- Analytics, BI Tools, Data Warehouses, ETL, Streaming, etc.
🤖 AI & Machine Learning (20)
- OpenAI, Anthropic, Vector DBs, MLOps, NLP, Computer Vision, etc.
🌐 Communication & Social (18)
- Email, SMS, Push, Chat, Video, Social Media APIs, etc.
🏗️ DevOps & Infrastructure (25)
- Docker, Kubernetes, CI/CD, Monitoring, Logging, etc.
🎮 Gaming & Entertainment (12)
- Leaderboards, Achievements, Matchmaking, Live Streaming, etc.
🏥 Industry-Specific (50+)
- Healthcare, FinTech, E-Learning, Real Estate, AgriTech, etc.
🔬 Advanced & Research (20+)
- Quantum, Blockchain, IoT, Bioinformatics, Space Tech, etc.
🎯 Use Cases
💼 SaaS Platforms
# Select: Intermediate Level → Full Auto
# Gets: Auth, Payments, Analytics, Background Jobs, Email, etc.🏪 E-Commerce
# Select: Intermediate → Modular
# Pick: Payments, Inventory, Email, Analytics, Reviews, etc.🏥 Healthcare Apps
# Select: Advanced → Modular
# Pick: HIPAA, FHIR, Telemedicine, Medical Imaging, etc.🎮 Gaming Backend
# Select: Advanced → Modular
# Pick: Leaderboards, Matchmaking, Real-time, Anti-cheat, etc.🌐 Web3 Projects
# Select: Expert → Modular
# Pick: Smart Contracts, NFTs, DeFi, Blockchain Indexing, etc.🛠️ Commands
After Installation
# Install dependencies
npm install
# Development
npm run dev
# Build
npm run build
# Start production
npm start
# Lint
npm run lint📖 Examples
Example 1: Basic Blog API
npx create-nextjs-backend
# Selections:
# - App Router
# - Beginner Level
# - Modular Mode
# - Select: database, api-routes, auth-strategies, cms, mediaResult: Blog backend with MongoDB, JWT auth, Contentful CMS, image uploads
Example 2: Full-Stack SaaS
npx create-nextjs-backend
# Selections:
# - App Router
# - Intermediate Level
# - Full AutoResult: Complete SaaS backend with 150+ features ready
Example 3: AI Platform
npx create-nextjs-backend
# Selections:
# - App Router
# - Advanced Level
# - Modular Mode
# - Select: ai-ml, vector-db, mlops, api-keys, rate-limitingResult: AI platform with OpenAI, Pinecone, model deployment, API management
🔄 Modular Workflow
Add Templates Later
# Run CLI again in same project
npx create-nextjs-backend
# Choose: Modify → Add
# Select new templatesRemove Templates
# Run CLI again
npx create-nextjs-backend
# Choose: Modify → Remove
# Select templates to remove📝 Configuration
Environment Variables
Generated .env.example:
# Database
DATABASE_URL="postgresql://user:password@localhost:5432/mydb"
# API Keys
NEXT_PUBLIC_API_URL="http://localhost:3000/api"
# Authentication
NEXTAUTH_SECRET="your-secret-here"
NEXTAUTH_URL="http://localhost:3000"
# Payment (if selected)
STRIPE_SECRET_KEY=""
STRIPE_WEBHOOK_SECRET=""
# AI/ML (if selected)
OPENAI_API_KEY=""
PINECONE_API_KEY=""
# Storage (if selected)
AWS_ACCESS_KEY_ID=""
AWS_SECRET_ACCESS_KEY=""
CLOUDINARY_URL=""Next.js Config
Generated next.config.ts:
import type { NextConfig } from "next";
const nextConfig: NextConfig = {
experimental: {
serverActions: {
bodySizeLimit: '2mb',
},
},
};
export default nextConfig;🧩 All Templates
- api - API Routes
- app - App Directory
- config - Configuration
- constants - Constants
- database - Database Connections
- docs - Documentation
- exceptions - Error Handling
- helpers - Helper Functions
- lib - Core Library
- middleware - Request Middleware
- public - Public Assets
- root - Root Files
- types - TypeScript Types
- validators - Input Validation
- api-docs - API Documentation
- caching - Redis, Memcached, CDN
- calendar - Google Calendar, Calendly
- cms - Contentful, Strapi, Sanity
- compression - Gzip, Brotli
- crm - Salesforce, HubSpot
- currency - Exchange Rates
- custom-middleware - CORS, Helmet
- data-transfer - CSV, JSON, XML
- feedback - User Feedback
- file-formats - CSV, Excel, PDF
- graceful-shutdown - Clean Shutdown
- health-checks - Liveness, Readiness
- invoicing - Invoice Generation
- language-detection - Auto Detect
- licensing - License Management
- media - Image/Video Processing
- notifications - Email, SMS, Push
- onboarding - User Onboarding
- payments - Stripe, PayPal
- referrals - Referral System
- regional - Regional Formats
- reports - Dashboard, Charts
- sanitization - Input Sanitization
- search - Elasticsearch, Algolia
- smoke-testing - Basic Tests
- subscriptions - Subscription Management
- support - Zendesk, Intercom
- teams - Team Management
- timezone - Timezone Handling
- validation - Zod, Yup, Joi
- api-versioning - API Versioning
- email-marketing - Email Campaigns
- sms-marketing - SMS Campaigns
- push-campaigns - Push Notifications
- docker - Containerization
All Beginner templates +
- services - Business Services
- repositories - Data Access Layer
- providers - Service Providers
- decorators - Custom Decorators
- filters - Request Filters
- interceptors - Request Interceptors
- hooks - Lifecycle Hooks
- events - Event System
- jobs - Scheduled Jobs
- schemas - Data Schemas
- dto - DTOs
- policies - Authorization
- scripts - Utility Scripts
- tests - Testing Suites
- locales - Translations
- drizzle - Drizzle ORM
- prisma - Prisma ORM
- graphql - GraphQL API
- github - GitHub Actions
- husky - Git Hooks
- vscode - VS Code Settings
- api-clients - Third-party APIs
- auth-providers - OAuth Providers
- auth-strategies - Auth Methods
- analytics - Google Analytics, Mixpanel
- realtime - Socket.io, Pusher
- background-jobs - BullMQ, Agenda
- geolocation - Google Maps, Mapbox
- communication - Twilio, Zoom
- social-media - Facebook, Twitter APIs
- rate-limiting - Rate Limiting
- security - XSS, CSRF Protection
- error-tracking - Sentry, Rollbar
- feature-flags - LaunchDarkly, Split
- ab-testing - A/B Testing
- load-balancing - Load Balancing
- api-tracking - Usage Tracking
- api-keys - API Key Management
- audit-logging - Audit Trails
- data-masking - PII Protection
- ip-control - IP Whitelist/Blacklist
- password-policies - Password Rules
- bot-protection - reCAPTCHA, hCaptcha
- compliance - GDPR, HIPAA
- data-privacy - Consent Management
- data-retention - Retention Policies
- multi-tenancy - Multi-tenant
- api-mocking - Mock APIs
- load-testing - k6, JMeter
- contract-testing - Contract Tests
+ 50 more intermediate templates...
All Intermediate templates +
- ai-ml - AI/ML Services
- ai-agents - AI Agents
- vector-db - Vector Databases
- mlops - MLOps
- computer-vision - Computer Vision
- predictive-analytics - Predictions
- workflow-automation - Workflow
- rpa - RPA
- rules-engine - Business Rules
- microservices - Microservices
- data-pipeline - Data Pipelines
- message-queues - Kafka, RabbitMQ
- circuit-breakers - Circuit Breakers
- service-discovery - Service Discovery
- throttling - Throttling
- distributed-tracing - Distributed Tracing
- observability - Observability
- chaos-testing - Chaos Testing
- chaos-engineering - Chaos Engineering
- iac - Infrastructure as Code
+ 80 more advanced templates...
All Advanced templates +
- metaverse - Metaverse
- quantum - Quantum Computing
- quantum-crypto - Quantum Crypto
- digital-twins - Digital Twins
- bci - Brain-Computer Interface
- defi - DeFi
- nft-marketplace - NFT Marketplace
- crypto-wallets - Crypto Wallets
- bridges - Blockchain Bridges
- oracles - Blockchain Oracles
- tokenomics - Tokenomics
- did - Decentralized Identity
- blockchain-indexing - Blockchain Indexing
- ipfs - IPFS
- decentralized-storage - Decentralized Storage
+ 50 more expert templates...
🤝 Contributing
We welcome contributions! Please see CONTRIBUTING.md for details.
Development Setup
git clone https://github.com/prem015/create-nextjs-backend.git
cd create-nextjs-backend
npm install
npm run devAdding New Templates
- Create folder in
templates/your-template/ - Add TypeScript files
- Create
index.jsexport file - Add category to
structures/categories.js - Update documentation
📄 License
MIT © Your Name
🙏 Acknowledgments
- Next.js - The React Framework
- Vercel - Hosting & deployment
- Inquirer - CLI prompts
- Chalk - Terminal styling
- Boxen - Terminal boxes
- Ora - Loading spinners
📞 Support
- 📧 Email: [email protected]
- 💬 Discord: Join our community
- 🐦 Twitter: @nextjs_backend
- 📖 Docs: docs.create-nextjs-backend.com
🗺️ Roadmap
- [ ] React Native backend templates
- [ ] GraphQL federation support
- [ ] Supabase integration
- [ ] Terraform/CDK templates
- [ ] Video tutorials
- [ ] VSCode extension
- [ ] Web-based configurator
⭐ Star History
Made with ❤️ for the Next.js community
⭐ Star on GitHub • 📦 NPM Package • 📖 Documentation
Perfect production-ready README with:
- ✅ Badges
- ✅ Clear features
- ✅ Quick start guide
- ✅ All 365 templates documented
- ✅ Use cases & examples
- ✅ Configuration guides
- ✅ Contributing section
- ✅ Professional formatting
