@sachin-thakur/create-nodejs-app
v1.0.0
Published
A CLI tool to scaffold production-ready Node.js applications with best practices
Maintainers
Readme
Create Production Node App
🚀 A powerful CLI tool to scaffold production-ready Node.js applications with modern best practices, complete with TypeScript support, database integration, authentication, testing, and more.
✨ Features
Unlike other scaffolding tools that give you a basic "Hello World" template, Create Production App generates applications that are ready for production deployment with:
- 🎯 Multiple Project Types: REST API, GraphQL API, Microservices, CLI Tools
- 📐 Architecture Patterns: MVC, Clean Architecture, Feature-based (Modular)
- 💎 TypeScript or JavaScript: Full TypeScript support with strict mode
- 🗄️ Database Integration: PostgreSQL, MongoDB, MySQL with connection pooling
- 🔐 Authentication: JWT-based auth with bcrypt password hashing
- ✅ Request Validation: Input validation with Zod
- 📝 Logging: Structured logging with Winston
- 📚 API Documentation: Auto-generated Swagger/OpenAPI docs
- 🛡️ Security: Rate limiting, CORS, helmet, input sanitization
- ⚡ Caching: Redis integration for performance
- 📧 Email Service: Nodemailer setup for transactional emails
- 📁 File Upload: Multer configuration for file handling
- 🔄 Background Jobs: Bull queue for async task processing
- 🧪 Testing: Jest, Vitest, or Mocha with example tests
- 🐳 Docker: Complete Docker and docker-compose setup
- 🔄 CI/CD: GitHub Actions workflow configured
- 📦 ESLint & Prettier: Code quality and formatting
🚀 Quick Start
Using npx (Recommended)
npx create-nodejs-app my-awesome-appUsing npm
npm install -g create-nodejs-app
create-nodejs-app my-awesome-appUsing yarn
yarn global add create-nodejs-app
create-nodejs-app my-awesome-app📖 Usage
Simply run the command and follow the interactive prompts:
npx create-nodejs-app my-appYou'll be asked to choose:
- Project Type: REST API, GraphQL API, Microservice, or CLI Tool
- Language: TypeScript (recommended) or JavaScript
- Architecture: MVC, Clean Architecture, or Feature-based
- Database: PostgreSQL, MongoDB, MySQL, or None
- Features:
- Authentication (JWT)
- API Documentation (Swagger)
- Request Validation
- Error Handling & Logging
- Rate Limiting
- CORS Configuration
- File Upload
- Email Service
- Caching (Redis)
- Background Jobs
- Testing Framework: Jest, Vitest, Mocha, or None
- Docker: Include Docker configuration
- CI/CD: Include GitHub Actions workflow
📦 What You Get
After running the CLI, you'll have a fully structured project:
my-app/
├── src/
│ ├── config/ # Configuration files
│ │ ├── database.ts # Database connection
│ │ ├── logger.ts # Winston logger setup
│ │ └── swagger.ts # Swagger configuration
│ ├── controllers/ # Request handlers
│ ├── models/ # Database models
│ ├── routes/ # API routes with Swagger docs
│ ├── middlewares/ # Custom middlewares (auth, validation, error handling)
│ ├── services/ # Business logic layer
│ ├── utils/ # Utility functions
│ └── index.ts # Application entry point
├── tests/ # Test files
├── .github/
│ └── workflows/ # CI/CD configuration
├── Dockerfile # Docker configuration
├── docker-compose.yml # Multi-container setup
├── .env.example # Environment variables template
├── .gitignore
├── .eslintrc.json # ESLint configuration
├── .prettierrc # Prettier configuration
├── tsconfig.json # TypeScript configuration (if TS)
├── package.json
└── README.md # Project-specific README🎯 Example Projects
REST API with PostgreSQL
npx create-nodejs-app my-api
# Select: REST API, TypeScript, MVC, PostgreSQL
# Select features: Auth, Validation, Logging, Swagger, Rate Limiting, CORS
# Select: Jest, Docker, CI/CDThis generates a production-ready REST API with:
- JWT authentication
- PostgreSQL database with connection pooling
- Request validation with Zod
- Comprehensive error handling
- Swagger API documentation
- Rate limiting and CORS
- Docker setup with PostgreSQL container
- CI/CD pipeline with GitHub Actions
Microservice with MongoDB
npx create-nodejs-app user-service
# Select: Microservice, TypeScript, Clean Architecture, MongoDB
# Select features: Auth, Validation, Logging, Caching, Background Jobs
# Select: Jest, Docker, CI/CD🔧 Development
After creating your project:
cd my-app
npm install
cp .env.example .env
# Edit .env with your configuration
npm run devYour app will be running at http://localhost:3000
If you included Swagger, visit: http://localhost:3000/api-docs
🐳 Using Docker
If you included Docker configuration:
docker-compose upThis will start your application along with the database and any other services (Redis, etc.)
🧪 Testing
npm test # Run tests
npm run test:watch # Watch mode
npm run test:coverage # Coverage report🏗️ Architecture Patterns
MVC (Model-View-Controller)
Traditional and straightforward. Great for most REST APIs and web applications.
Clean Architecture (Layered)
Domain-driven with clear separation of concerns. Ideal for complex business logic and enterprise applications.
Feature-based (Modular)
Organized by features rather than technical layers. Perfect for microservices and scalable applications.
🤔 Why Create Production App?
Most Node.js scaffolding tools give you a basic structure, but lack:
- ❌ Proper error handling patterns
- ❌ Logging configuration
- ❌ Security best practices
- ❌ Database setup with migrations
- ❌ Authentication implementation
- ❌ API documentation
- ❌ Testing examples
- ❌ Docker and CI/CD setup
Create Production App provides all of this out of the box, so you can focus on building features instead of boilerplate.
📚 Documentation
For more detailed information, check out:
🤝 Contributing
Contributions are welcome! Please read our Contributing Guide for details.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
📝 License
MIT License - see LICENSE file for details
🙏 Acknowledgments
Built with ❤️ to help developers ship production-ready applications faster.
🐛 Issues
Found a bug or have a feature request? Please open an issue on GitHub.
⭐ Star Us!
If you find this tool helpful, please consider giving it a star on GitHub!
Happy coding! 🚀
