backend-project-setup

1.0.3 • Public • Published

🚀 Backend Project Setup

A powerful CLI tool to instantly set up a Node.js + Express + MongoDB backend boilerplate with a clean folder structure and essential starter files.


✨ Features

  • 📦 Initializes a fully structured backend project in seconds
  • ⚡ Uses Express and Mongoose (MongoDB)
  • 🗂️ Generates a standard folder structure (controllers, routes, models, utils, etc.)
  • ⚙️ Creates starter configuration files (.env, .gitignore, Prettier config)
  • ✅ Adds a built-in health check endpoint
  • 💻 Includes nodemon and prettier as dev tools
  • 🛠️ Configures scripts and ES module support automatically

🛠️ Installation

Using npx (recommended)

npx backend-project-setup

⚡ Usage

After running the CLI command:

1️⃣ A new src/ folder and its subfolders will be created.
2️⃣ Essential starter files (index.js, app.js, conf.js, connect.js, etc.) are auto-generated.
3️⃣ Dependencies (express, mongoose, dotenv, cors) and dev tools (nodemon, prettier) are installed automatically.
4️⃣ Your package.json will be updated with scripts and "type": "module".


🏗️ Folder Structure

src/
├── app.js
├── index.js
├── conf/
│   └── conf.js
├── controllers/
│   └── healthCheck.controller.js
├── db/
│   └── connect.js
├── middlewares/
├── models/
├── routes/
│   └── healthCheck.route.js
├── utils/
│   ├── ApiError.js
│   ├── ApiResponse.js
│   └── asyncHandler.js
.gitignore
.env
.prettierrc
.prettierignore

🌱 Environment Variables

A .env file is generated automatically:

MONGO_URI=mongodb://localhost:27017/mydatabase
PORT=4444

Update these as needed.


🚀 Running the Server

npm run dev

Server will start on the port specified in .env (default: 4444).

Package Sidebar

Install

npm i backend-project-setup

Weekly Downloads

75

Version

1.0.3

License

MIT

Unpacked Size

12.2 kB

Total Files

3

Last publish

Collaborators

  • aryan-561