@mena-emad/archinit
v1.0.0
Published
Scaffold a production-ready Node.js Express backend in seconds with a clean, modular architecture that keeps your project simple, readable, and easy to scale.
Readme
🚀 CleanInit CLI (archinit)
Scaffold a production-ready Node.js Express backend in seconds with a clean, modular architecture that keeps your project simple, readable, and easy to scale.
CleanInit is a lightweight CLI that generates a modern Express backend structure from a real template located in the repository. It asks for a project name and an auth preference, then creates a new project folder with a clean root-level layout and a ready-to-run baseline.
This README reflects the actual CLI implementation and generated scaffold in the current repository.
✨ What This CLI Actually Does
When you run the tool, it:
- prompts for a project name
- asks whether to include basic auth infrastructure
- copies the bundled template into a new folder
- renames the generated package name to your chosen project name
- creates .env and .env.example files
- removes auth-specific files when auth is disabled
🛠️ Installation
Install it globally from GitHub:
npm install -g mena-emad/archinitRun it from anywhere:
archinit🧪 Interactive Prompts
The CLI currently asks for two inputs:
- Project Name — the folder name for the new backend scaffold
- Auth Infrastructure — a yes/no prompt that controls whether auth middleware and token helpers are included
If you answer yes, the scaffold includes:
- middlewares/auth.js
- utils/generateTokens.js
- JWT-related environment variables
If you answer no, those files are removed to keep the generated project lean.
🧱 Generated Project Structure
The generated project uses a root-level architecture with no src folder.
With Auth Enabled
[project-name]/
├── config/
│ └── dbConnection.js
├── data/
│ └── models/
├── middlewares/
│ ├── auth.js
│ ├── gerror.js
│ └── validation.js
├── modules/
│ └── _sample/
│ ├── sample.controller.js
│ ├── sample.routes.js
│ ├── sample.service.js
│ └── sample.validation.js
├── utils/
│ ├── AppError.js
│ ├── catchAsync.js
│ └── generateTokens.js
├── .env
├── .env.example
├── app.js
└── index.jsWith Auth Disabled
[project-name]/
├── config/
│ └── dbConnection.js
├── data/
│ └── models/
├── middlewares/
│ ├── gerror.js
│ └── validation.js
├── modules/
│ └── _sample/
├── utils/
│ ├── AppError.js
│ └── catchAsync.js
├── .env
├── .env.example
├── app.js
└── index.js🔄 Request Flow
The scaffolded app follows a simple modular flow:
graph TD
A[index.js] --> B[app.js]
B --> C[modules/_sample/sample.routes.js]
C --> D[middlewares/auth.js]
D --> E[sample.controller.js]
E --> F[sample.service.js]
F --> G[data/models/]
E --> H[middlewares/gerror.js]This gives you a clear path for request handling, business logic, persistence, and error management.
✅ Included Features
The scaffolded template already includes:
- Express.js backend foundation
- Mongoose and MongoDB connection setup
- Joi for request validation
- Cookie parsing support
- CORS support
- JWT auth helpers when enabled
- Helmet, mongo-sanitize, and dotenv support
⚡ Quick Start
After the CLI generates your project:
cd [project-name]
npm install
npm run devThat path boots your project quickly and puts you into a production-ready development loop with minimal friction.
Pro tip: Enable auth when you want a faster route to secure, API-first applications with token-based protection.
📦 What You Get Out of the Box
Every generated project is designed to feel deliberate and scalable:
- Clean root-level organization
- Modular feature slices for long-term maintainability
- Ready-to-use API entry points
- Configured environment files
- Authentication-ready middleware layer when needed
- Database connection structure and error handling by default
📄 License
This project is licensed under the MIT License.
🤝 Contributing
Contributions are welcome. If you want to improve the CLI, expand the templates, or refine the scaffolding experience, open an issue or submit a pull request.
