1.0.3 β’ Published 12 months ago
express-starter-script v1.0.3
π EXPRESS STARTER SCRIPT
This script is used to quickly set up a Node.js project with Express and MongoDB. It will create a new project directory, initialize the project with npm, install necessary dependencies, and set up basic files and structure for an Express app that connects to MongoDB.
π Table of Contents
β How to Use:
Run the script using the following command:
npx express-starter-script [Project name]or
npx git@github.com:omraannn/Express-starter-script.git [Project name]or
npx https://www.npmjs.com/package/express-starter-script [Project name]π Note: (If no project name is provided, it will default to
my-express-project.)
π‘ What This Script Does:
- Creates a new project directory with the specified name.
 - Initializes a new Node.js project using 
npm init. - Installs required dependencies:
- Express, MongoDB, dotenv, CORS, body-parser, mongoose.
 
 - Adds 
nodemonas a development dependency for hot-reloading. - Sets up folders for core components:
config/- Configuration filescontrollers/- Controllers for request handlingmodels/- Mongoose modelsroutes/- Route definitions
 - Generates configuration files:
.envfor environment variablesdb.js- MongoDB connection configurationUserModel.js- Mongoose model for UseruserController.js- Basic user controlleruserRoute.js- Routes for the userserver.js- Main entry point for the app
 - Adds start and dev scripts to 
package.jsonfor running with nodemon. 
π§ Requirements:
- Make sure you have Node.js and npm installed on your system.
 - MongoDB should be set up and running, or you can use a cloud service like MongoDB Atlas.
 - You need to create your database first (the script will connect using the project name as the database name, but you can change this later).
 
π Folder Structure:
The script will generate the following structure:
my-express-project/
βββ config/
β   βββ db.js
βββ controllers/
β   βββ userController.js
βββ models/
β   βββ UserModel.js
βββ routes/
β   βββ userRoute.js
βββ .env
βββ server.js
βββ package.json
βββ node_modules/π οΈ Customization:
- You can modify the generated files (such as 
UserModel.js,userController.js, anduserRoute.js) to fit your applicationβs needs. - Update the 
.envfile with your MongoDB connection string (MONGODB_URI). - You can add additional routes, controllers, and models as required.
 
π€ Contribute:
If youβd like to contribute to this project, please fork the repository and submit a pull request. Your contributions, whether bug fixes, enhancements, or documentation updates, are always welcome!
- Fork the Project.
 - Create your Feature Branch: 
git checkout -b feature/YourFeature. - Commit your Changes: 
git commit -m 'Add some feature'. - Push to the Branch: 
git push origin feature/YourFeature. - Open a Pull Request.
 
π§βπ» Author:
This script was created with β€ by DEKHIL_Omran.
π License:
This project is available under the MIT License.