A simple CLI tool to generate Express.js modules with object-style services and controllers. Interactive, fast, and perfect for structuring your backend projects.
npm install -g codewithsaidul-cli
cws create <feature_name>
Replace <feature_name> with the name of your feature/module (e.g., appointment). You will be prompted to choose the database system using arrow keys:
prisma
mongoose
raw-mongodb
You will also be asked whether to generate inside src/app/modules or just src/modules.
cws create appointment
Depending on your choices, the following files will be created:
service.ts → Object-style service
controller.ts → Object-style controller
route.ts → Express router
model.ts → Only if Mongoose is selected
src/app/modules/appointment/
├─ appointment.service.ts
├─ appointment.controller.ts
├─ appointment.route.ts
└─ appointment.model.ts (if Mongoose)
-
Interactive arrow key DB selection (like Vite/React CLI)
-
Object-style service and controller
-
Optional Mongoose model
-
Choice of generating in src/app/modules or src/modules
npm i -g codewithsaidul-cli
cws create appointment
> prisma
mongoose
raw-mongodb
-
Confirm folder location (src/app/modules or src/modules)
-
Files are generated automatically with a Successfull message:
---------------------------------------------
👏 Hey there! Your "appointment" module is ready.
---------------------------------------------
Generated files in: src/app/modules/appointment
• Service : appointment.service.ts
• Controller : appointment.controller.ts
• Route : appointment.route.ts
• Model : appointment.model.ts
Database system: Mongoose
You can now start implementing your business logic! 🚀
Happy coding! ✨
---------------------------------------------
-
Node.js >= 18
-
npm >= 9
Works on Linux, macOS, and Windows terminals
MIT
GitHub: @codewithsaidul