khushikumarigupta14-express-generator-cli
v1.0.5
Published
A powerful CLI tool to scaffold production-ready Express.js applications with a clean Repository Pattern architecture.
Readme
Express Generator CLI to Scafold boilerplate-api
A powerful CLI tool to scaffold production-ready Express.js applications with a clean Repository Pattern architecture.
Based on the Repo Pattern Boilerplate.
Quick Start
You can use the CLI directly without installing it via npx:
# Initialize a new project
npx khushikumarigupta14-express-generator-cli init my-appOr install it globally:
npm install -g khushikumarigupta14-express-generator-cli
# Then use the shorter command
my-express-gen init my-app✨ Features
- Repository Pattern: Clean separation of concerns (Controller → Service → Repository → Model).
- TypeScript: Fully typed codebase.
- Swagger Docs: Auto-generated API documentation.
- Zod Validation: Runtime request validation.
- Module Generator: Quickly scaffold new feature modules.
🛠 Commands
1. Initialize a New Project
Scaffolds a fresh project by cloning the boilerplate and setting up a clean Git environment.
npx khushikumarigupta14-express-generator-cli init <project-name>Example:
npx khushikumarigupta14-express-generator-cli init ecommerce-api
cd ecommerce-api
npm install
npm run dev2. Generate a New Module
Generates a complete module structure in src/modules/<module-name> including:
- Controller
- Service
- Repository
- Model (Mongoose)
- Routes
- Interfaces
- Validation (Zod)
- Swagger Documentation
Usage: Navigate to your project root and run:
npx khushikumarigupta14-express-generator-cli generate module <module-name>
# OR alias
npx khushikumarigupta14-express-generator-cli g module <module-name>Example:
npx khushikumarigupta14-express-generator-cli g module productsThis will create a products module and output instructions on how to register the route in app.ts.
📦 Project Structure Scaffolding
When you generate a module (e.g., orders), it creates:
src/modules/orders/
├── orders.controller.ts # Handles HTTP requests
├── orders.service.ts # Business logic
├── orders.repository.ts # Database access
├── orders.model.ts # Mongoose Schema
├── orders.interface.ts # TypeScript Interfaces
├── orders.validation.ts # Zod Schemas
├── orders.routes.ts # Express Router
├── orders.docs.ts # Swagger/OpenAPI Defs
└── index.ts # Module exports📝 License
ISC
