node-initdb is a CLI tool for initializing database configurations and structures in Node.js projects.
You can install node-initdb globally using npm:
npm install -g node-initdb
To use node-initdb, navigate to your project directory and run one of the following commands based on your database choice:
-m
/--mongo
: Add MongoDB configuration and files for the module.-s
/--seque
: Add Sequelize configuration and files for the module.-y
/--yes
: Skip interactive prompts and use default values for module creation.
To set up Sequelize with default folders, files, and install necessary packages:
node-initdb --seque
node-initdb -s
To set up MongoDB with default folders, files, and install necessary packages:
node-initdb --mongo
node-initdb -m
To add a new module using node-add
, run the following command:
node-add <moduleName> [-m / --mongo] [-s / --seque]
Replace <moduleName>
with the name of your module. Use the following optional flags:
node-add "user" -m
After running the command, node-initdb will create the following folder structure:
- config/
- Controllers/
- Routes/
- Models/
- uploads/
- Utils/
node-initdb creates essential files such as controller, route, model files, and configuration files necessary for setting up your chosen database.
node-initdb installs the following dependencies based on your database setup:
- For Sequelize:
sequelize
,mysql2
- For MongoDB:
mongoose
- Middleware and Utilities:
express
,body-parser
,cors
,dotenv
,fs
,http-errors
,https
,jsonwebtoken
,multer
Contributions are welcome! Fork the repository, make your changes, and submit a pull request. Please follow the existing coding style and guidelines.
This project is licensed under the MIT License - see the LICENSE file for details.
If you have any questions, feel free to reach out:
- Email: ashrafchauhan567@gmail.com
- GitHub: @MohamedAshraf701