UNPKG

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
# ๐ŸŒŸ 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