@bodhx/create-microservices-node-mongo
v1.0.0
Published
A CLI tool to scaffold a fully functional Node.js + MongoDB microservices architecture project
Maintainers
Readme
@bodhx/create-microservices-node-mongo
A CLI tool to scaffold a fully functional Node.js + MongoDB microservices architecture project in seconds – with optional integrations like JWT, Nodemailer, S3, Logger, and more!
✨ Features
- Interactive CLI prompts to customize your setup
- Scaffold multiple microservices with clean folder structures
- Optional integrations: JWT auth, email (Nodemailer), S3, logging, and more
- Auto-generate models, routes, controllers with full CRUD + pagination
- Auto-connect services with internal service-to-service communication
- Plug-and-play development setup with pre-configured scripts and dependencies
🚀 Getting Started
Run the CLI using:
npx @bodhx/create-microservices-node-mongo🧠 CLI Flow
The CLI guides you through an interactive setup:
1. Basic Project Info
- Project Name
- Author Name
- Project Description
2. Microservices Setup
- Number of Microservices
- Prompted:
- Microservice 1 name
- Microservice 2 name
- ...and so on (based on entered number)
3. Feature Integrations (Optional)
For each microservice, you'll be asked:
- Include JWT Authentication? (yes/no)
- Include Nodemailer Service? (yes/no)
- Include S3 Integration? (yes/no)
- Include Logger Utility? (yes/no)
- Include other common utilities? (yes/no)
- (CORS, Helmet, Swagger, Rate Limiting, dotenv)
4. Port Configuration
You'll enter the Port Number for each microservice, in order.
5. Project Structure Options
Option 1: Generate Microservice Structure Only
- Creates the full folder & file layout for each microservice
- Adds service registry/connection logic
- Generates package.json, scripts, Docker config (optional later), etc.
Option 2: Add Models, Routes, and Controllers Now
- CLI asks:
- How many models for service 1?
- Model names (one by one)
- Repeat for all services
- Auto-generates:
- Models (with default name field for now)
- RESTful routes (GET, POST, PUT, DELETE)
- Controllers with:
- CRUD logic
- Pagination support
- Validation (basic)
📁 Folder Structure
Example (for 2 services):
my-microservices-project/
│
├── service-auth/
│ ├── models/
│ ├── routes/
│ ├── controllers/
│ ├── utils/
│ └── app.js
│
├── service-user/
│ ├── models/
│ ├── routes/
│ ├── controllers/
│ ├── utils/
│ └── app.js
│
├── shared/
│ └── logger.js
│
├── package.json
└── README.md🧰 Tech Stack
- Node.js (Express.js)
- MongoDB (Mongoose)
- JWT Authentication (optional)
- Nodemailer (optional)
- AWS S3 SDK (optional)
- Winston or Morgan for logging (optional)
- dotenv, helmet, cors, etc. (common utilities)
🔧 Scripts in package.json
"scripts": {
"start": "node service-name/app.js",
"dev": "nodemon service-name/app.js",
"start:all": "concurrently \"nodemon service-1/app.js\" \"nodemon service-2/app.js\""
}Will be auto-configured based on user input.
🔮 Future Enhancements
- AI-powered field suggestion for models
- Docker + Kubernetes setup scaffolding
- Built-in Swagger docs per service
- Service Discovery via Consul or NATS
- Redis integration
- CLI config save/restore templates
