create-express-str
Version:
A CLI tool to scaffold a modern Express.js REST API structure with best practices
146 lines (95 loc) โข 3.08 kB
Markdown
# ๐ create-express-str
โจ A CLI tool to instantly scaffold a modern, clean, and scalable Express.js project structure.
## ๐ Why use `create-express-str`?
- ๐ Kickstart Express.js apps in **seconds**
- ๐ Pre-built clean **project architecture**
- ๐ง Pre-configured for `.env`, `nodemon`, and modular routes
- ๐จโ๐ป Perfect for **backend developers**, students, and professionals
## ๐ Installation & Usage
### โถ๏ธ Run directly with `npx` (no need to install globally):
npx create-express-str my-app
#### ๐ Want to generate in the current folder?
npx create-express-str .
#### ๐ Or install it globally:
npm install -g create-express-str
create-express-str my-app
## ๐งฑ Project Structure
```bash
my-app/
โโโ config/
โ โโโ db.connection.js
โ โโโ models/
โ โโโ test.model.js
โ
โโโ src/
โ โโโ initApp.js
โ โโโ index.routes.js
โ โโโ middlewares/
โ โ โโโ auth.middleware.js
โ โโโ modules/
โ โ โโโ test/
โ โ โโโ test.controller.js
โ โ โโโ test.routes.js
โ โ โโโ test.validation.js
โ โโโ services/
โ โ โโโ test.service.js
โ โโโ utils/
โ โโโ test.js
โ
โโโ .env
โโโ .gitignore
โโโ index.js
โโโ package.json
```
### ๐ฆ Usage Example
Once scaffolded, navigate to your new project:
cd my-app
npm start
You should see:
Server running on port 3000 ๐!...
Try accessing the default test route:
## http://localhost:4000/api/v1/test
### ๐ก Tips & Recommendations
โ
Use .env for environment variables <br>
โ
Write all logic in modules, separating controllers, routes, and validation<br>
โ
Add custom logic in services/ for reusable business functions<br>
โ
Global error handling is already pre-configured<br>
โ
Supports Express Middleware (middlewares/ folder)<br>
โ
Use utils/ for helper functions<br>
### ๐ Scripts
"scripts": {<br>
"start": "nodemon index.js"<br>
}<br><br>
Starts the server using nodemon for hot reload
### ๐ฆ Dependencies (pre-installed)
express - minimal and flexible Node.js web application framework
dotenv - loads environment variables from .env
## nodemon - auto-restarts the server on file changes
### ๐ Requirements
Node.js v14+
## npm v6+
### ๐งช Built With
Node.js
Express
## JavaScript (ES Modules)
## ๐ Contributing
Contributions are welcome!
1. Fork the repo
2. Make your changes
3. Submit a Pull Request
## ๐ License
MIT ยฉ 2025 โ Ahmed Alshayeb
## ๐ Connect with Me <br>
GitHub: <a href="https://github.com/Ahmed-Alshayeb">@Ahmed-Alshayeb</a>
LinkedIn: <a href="www.linkedin.com/in/ahmed-alshayeb-5843322a2">Ahmed Alshayeb</a>
### โ
You can copy this `README.md` and paste it directly into your project folder.
Let me know if you want:
- A **dark mode-friendly markdown version**
- Translation into **Arabic**
- **GitHub Actions** workflow to automate testing or publishing