This repo contains my code from following the Udemy course Advanced NodeJS: Level up your NodeJS skill In 2025.
It is based on Section 5: Building a rapid code generator/assistance CLI tool.
The tool can can clone a boilerplate project from GitHub and quickly scaffold controllers, routers, services, and models from templates.
Note
For the complete course source code, see the instructor's repo: Leveling-Up-NodeJS.
node index.js generate-mvc
This command:
- Prompts for a project name (used as the directory name).
- Clones the repository from
repoUrlinconfig/config.js. - Installs the project's dependencies.
- Creates an
.envfile with the values fromprojectConfiginconfig/config.js.
node index.js generate <schematic - controller/router/service>
This command:
- Prompts for the project's directory. (e.g.
project1) - Loads the schematic's template from
utils/content.js. - Creates the file in the appropriate folder.
node index.js create <schematic - module/model/validator>
This command:
- Prompts for the schematic's name. (e.g.
user) - Prompts for the project's directory. (e.g.
project1) - Prompts for the schematic's fields. (e.g.
id,name,age,role) - Prompts for the fields' types. (example
objectid,string,number,string) - Loads the schematics templates from
utils/content.js. - Creates the model, validation, controller, route and service files in the appropriate folders.
Other examples shown in this section are kept in examples.js.