Production-ready Node.js backend generator with TypeScript support
Generate a fully configured Express.js backend in seconds with database, authentication, validation, and Docker support.
- 📦 Zero Configuration - Works out of the box
- 🎨 TypeScript & JavaScript - Choose your preferred language
- 🗄️ Multiple Databases - MongoDB, PostgreSQL, MySQL support
- 🔐 JWT Authentication - Ready-to-use auth system
- ✅ Request Validation - Zod or Joi validation
- 📝 Winston/Pino Logging - Production-grade logging
- 🐳 Docker Ready - Docker and docker-compose included
- 🛡️ Security - Helmet, CORS pre-configured
- 🎯 Best Practices - Clean architecture, separation of concerns
- 📚 Comprehensive Docs - In-folder documentation for every component
- MVC Pattern - Organized folder structure
- Service Layer - Business logic separation
- Error Handling - Centralized error management
- Response Utilities - Consistent API responses
- Environment Config - Type-safe environment variables
- Migration Support - Database migration setup (Sequelize)
- Interactive CLI - Beautiful prompts and clear output
- Info Files - Helpful guides in every folder
- Code Examples - Real-world usage patterns
- Clean Logs - Emoji-based, readable console output
- Fast Setup - From zero to running API in under 2 minutes
# Install globally
npm install -g create-node-advance-app
# Create a new project
create-node-advance-app my-api
# Follow the interactive prompts
# cd into your project
cd my-api
# Install dependencies
npm install
# Start development server
npm run devThat's it! Your API is now running on http://localhost:5000 🎉
npm install -g create-node-advance-appnpx create-node-advance-app my-api- Node.js >= 14.0.0
- npm or yarn
# Generate project with default name
create-node-advance-app
# Generate project with custom name
create-node-advance-app my-awesome-api
# The CLI will ask you:
# - Language: TypeScript or JavaScript
# - Database: MongoDB, PostgreSQL, MySQL, or None
# - Authentication: JWT or None
# - Validation: Zod, Joi, or None
# - Logger: Winston, Pino, or None
# - Error Handling: Yes or No
# - Docker: Yes or No📸 See example prompts
🔥 Create-node-advance-app
? Select language: TypeScript
? Select database: PostgreSQL (Sequelize)
? Setup JWT authentication? Yes
? Select validation library: Zod (recommended for TypeScript)
? Select logger: Winston
? Include AppError and response utilities? Yes
? Include Docker support? Yes
📋 Configuration Summary:
──────────────────────────────────────────────────
Project: my-api
Language: TypeScript
Database: PostgreSQL (Sequelize)
Auth: JWT ✓
Validation: Zod
Logger: Winston
Error Utils: ✓
Docker: ✓
──────────────────────────────────────────────────
? Proceed with this configuration? Yes
my-api/
├── src/
│ ├── config/ # Configuration files
│ │ ├── env.ts # Environment variables (type-safe)
│ │ ├── database.ts # Database connection
│ │ └── logger.ts # Logging configuration
│ │
│ ├── routes/ # API routes
│ │ └── info.ts # 📚 How to create routes
│ │
│ ├── controllers/ # Request handlers
│ │ └── info.ts # 📚 How to create controllers
│ │
│ ├── services/ # Business logic
│ │ └── info.ts # 📚 How to create services
│ │
│ ├── models/ # Database models
│ │ └── info.ts # 📚 How to create models
│ │
│ ├── validators/ # Request validation schemas
│ │ └── info.ts # 📚 How to create validators
│ │
│ ├── middlewares/ # Custom middleware
│ │ └── info.ts # 📚 How to create middleware
│ │
│ ├── utils/ # Utility functions
│ │ ├── AppError.ts # Custom error class
│ │ └── response.ts # Response helpers
│ │
│ ├── types/ # TypeScript types (TS only)
│ │ └── index.ts # Shared type definitions
│ │
│ ├── app.ts # Express app setup
│ └── server.ts # Server entry point
│
├── .env # Environment variables
├── .env.example # Environment template
├── .gitignore # Git ignore rules
├── package.json # Dependencies and scripts
├── tsconfig.json # TypeScript config (TS only)
├── Dockerfile # Docker image (optional)
└── docker-compose.yml # Docker services (optional)
Every folder includes an info.ts/js file with:
- ✅ Purpose - What the folder is for
- ✅ Examples - Complete code examples
- ✅ Best Practices - How to structure your code
- ✅ Common Patterns - Real-world use cases
| Option | Description |
|---|---|
| TypeScript | Fully typed, recommended for large projects |
| JavaScript | Simpler, faster to write |
| Option | Description | ORM |
|---|---|---|
| MongoDB | NoSQL document database | Mongoose |
| PostgreSQL | Advanced relational database | Sequelize |
| MySQL | Popular relational database | Sequelize |
| None | No database setup | - |
- JWT - JSON Web Token authentication with bcrypt password hashing
- None - No auth setup
| Option | Description | Best For |
|---|---|---|
| Zod | TypeScript-first, type inference | TypeScript projects |
| Joi | Mature, feature-rich | JavaScript projects |
| None | No validation | Simple APIs |
| Option | Description |
|---|---|
| Winston | Flexible, widely used |
| Pino | High performance, JSON logging |
| None | Console.log only |
- Error Handling - AppError class and response utilities
- Docker - Dockerfile and docker-compose.yml
Base Dependencies:
{
"express": "^4.18.2",
"dotenv": "^16.3.1",
"cors": "^2.8.5",
"helmet": "^7.1.0"
}Database-Specific:
- MongoDB:
mongoose - PostgreSQL:
sequelize,pg,pg-hstore,sequelize-cli - MySQL:
sequelize,mysql2,sequelize-cli
Auth-Specific:
jsonwebtoken,bcryptjs
Validation-Specific:
- Zod:
zod - Joi:
joi
Logger-Specific:
- Winston:
winston - Pino:
pino,pino-pretty
{
"scripts": {
"dev": "nodemon --exec ts-node src/server.ts", // Development
"start": "node dist/server.js", // Production
"build": "tsc", // Build (TS only)
"db:migrate": "npx sequelize-cli db:migrate", // Run migrations
"db:migrate:undo": "npx sequelize-cli db:migrate:undo",
"db:seed": "npx sequelize-cli db:seed:all"
}
}# Server
NODE_ENV=development
PORT=5000
# Database (PostgreSQL example)
DATABASE_URL=postgresql://postgres:root@localhost:5432/my-back
DB_HOST=localhost
DB_PORT=5432
DB_NAME=my-back
DB_USER=postgres
DB_PASSWORD=root
# JWT (if auth enabled)
JWT_SECRET=your-super-secret-jwt-key-change-in-production
JWT_EXPIRES_IN=7d
# CORS
CORS_ORIGIN=http://localhost:3000- Helmet.js for HTTP headers
- CORS configuration
- Environment variables
- Password hashing (bcrypt)
- JWT token authentication
- Separation of concerns (MVC pattern)
- Service layer for business logic
- Centralized error handling
- Type-safe environment config
- Consistent response format
- Hot reload with nodemon
- TypeScript type safety
- Comprehensive logging
- Clear error messages
- In-folder documentation
- Docker support
- Environment-based config
- Database migrations
- Graceful shutdown
- Error stack traces (dev only)
# Change PORT in .env file
PORT=3000# PostgreSQL
# Make sure PostgreSQL is running
brew services start postgresql # macOS
sudo service postgresql start # Linux
# MongoDB
brew services start mongodb-community # macOS
sudo service mongod start # Linux# Rebuild TypeScript
npm run build
# Check tsconfig.jsonContributions are welcome! Here's how you can help:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
# Clone the repo
git clone https://github.com/yourusername/Create-node-advance-app.git
# Install dependencies
cd Create-node-advance-app
npm install
# Link for local testing
npm link
# Test the CLI
Create-node-advance-app test-projectThis project is licensed under the MIT License - see the LICENSE file for details.
If you find this project helpful, please consider giving it a star! ⭐
- 📫 Issues: GitHub Issues
- 💬 Discussions: GitHub Discussions
- 📧 Email: pathak1420@gmail.com
- Built with Inquirer.js for interactive CLI
- Styled with Chalk for beautiful terminal output
- Inspired by popular backend generators and best practices
Made with ❤️ by Ashish