Run this Command in your terminal
curl -s https://raw.githubusercontent.com/muktadirhossain/node-app-scaffold/main/setup.sh -o setup.sh && bash setup.sh
This repository contains a bash script that sets up a basic Node.js application scaffold using Express.js. The scaffold follows the MVC (Model-View-Controller) architecture, with support for JWT-based authentication, error handling, rate limiting, and MongoDB integration.
- Node.js & Express.js: A robust foundation for building web applications.
- MVC Architecture: Organizes your application for maintainability and scalability.
- JWT Authentication: Secure user authentication with session management.
- Environment Variable Management: Uses
dotenv
for configuration. - Security Middleware: Implemented using
helmet
,cors
, andexpress-rate-limit
. - MongoDB Connection: Integrated with Mongoose for database management.
- Logging: Error logging with customizable logging paths.
- Basic Project Structure: Automatically creates necessary directories and files.
To create a new Node.js application scaffold:
- Open your
terminal
. Run
the following command to download and execute the setup script:
curl -s https://raw.githubusercontent.com/muktadirhossain/node-app-scaffold/main/setup.sh -o setup.sh && bash setup.sh
- Follow the prompts to enter your
project name
.
Once the setup script completes, you will have a new directory with your project name containing:
- A configured
package.json
file. - Folders for MVC structure (
controllers
,models
,routes
, etc.). - Basic application files (
app.js
,server.js
). - A
.env
file for environment variables. - A README file with instructions.
To run your application:
-
Navigate into your project directory:
cd your-project-name
-
Install the necessary dependencies (if not done automatically):
npm install
-
Start the application:
npm start
Configure your application by editing the .env
file. You can set the following variables:
APP_URL=http://localhost:3000
PORT=3000
MONGO_URI=mongodb://127.0.0.1:27017/your_db_name
JWT_SECRET=your_jwt_secret_key
JWT_EXPIRES_IN=1h
Contributions are welcome! If you have suggestions for improvements or features, please feel free to create an issue or submit a pull request.
This project is licensed under the MIT License - see the LICENSE file for details.
- Express.js for its robust web framework.
- Mongoose for simplifying MongoDB interactions.
- JSON Web Tokens for secure user authentication.
### How to Customize
- Replace `yourusername` in the `curl` command with your actual GitHub username.
- Customize the MongoDB URI and JWT secret key in the example `.env` section.
- Modify the acknowledgments and any additional features as necessary.
This README provides a solid foundation for users to understand how to use your project. Let me know if you'd like to add or modify anything!