nim-nodex-init
Version:
nim-nodex-init is a powerful CLI tool that scaffolds a complete Node.js & Express.js app with your preferred database, ORM, authentication system, and organized folder structure โ all in seconds.
187 lines (130 loc) โข 3.98 kB
Markdown
# ๐ nim-nodex-init
**`nim-nodex-init`** is a powerful CLI tool that scaffolds a complete Node.js & Express.js app with your preferred database, ORM, authentication system, and organized folder structure โ all in seconds.
## ๐ฆ Install & Usage
You can use the CLI directly with `npx` (recommended):
```bash
npx nim-nodex-init
```
Or install it globally if you prefer:
```bash
npm install -g nim-nodex-init
```
Then run it from anywhere with:
```bash
nim-nodex-init
```
## โ๏ธ What It Does
When you run:
```bash
npx nim-nodex-init
```
It guides you through an interactive setup to:
- ๐ท๏ธ Set project name
- ๐ป Choose language: JavaScript or TypeScript
- ๐ข๏ธ Select a database: MongoDB, MySQL, PostgreSQL, or SQLite
- ๐ If SQL, choose ORM: Sequelize or Prisma
- โ๏ธ Automatically install dependencies
- ๐ Generate a fully structured Express project:
- DB configuration
- Environment setup
- Clean project architecture
## ๐ง Why Use nim-nodex-init?
- No need to manually configure Express, database, routes, controllers, or middleware.
- Great for quickly bootstrapping REST APIs.
- Flexible with JS or TS.
- Includes modern best practices: JWT, bcrypt, input validation.
## ๐ ๏ธ Tech Stack
- **Node.js**
- **Inquirer.js** โ CLI prompts
- **Chalk** โ Terminal output styling
- **Execa** โ Shell command execution
- **fs / path** โ File generation
- **dotenv** โ Environment management
## ๐ก How It Works
When you run the command, `nim-nodex-init` will:
1. Prompt for:
- Project name
- Language: JavaScript or TypeScript
- Database (MongoDB, MySQL, PostgreSQL, SQLite)
- ORM (Sequelize or Prisma)
2. Create a project folder with:
- Configured `server.js` or `server.ts`
- Connected `.env` file
- Installed dependencies
- JWT auth (register & login)
- Folder structure: routes, models, controllers, config
3. Add sample user model and controller
4. Set up static `public` directory
## โจ Example CLI Interaction
```bash
$ npx nim-nodex-init
๐ ๏ธ Welcome to nim-nodex-init!
โ Project name: my-api
โ Use JavaScript or TypeScript? โ JavaScript
โ Choose a database โ MySQL
โ Choose ORM โ Sequelize
โ Add register/login logic with real hashing? โ Yes
๐ฆ Installing packages...
๐ Creating folders and boilerplate...
โ
Setup complete!
๐ cd my-api
๐ npm run dev
```
## ๐ Generated Project Structure
```bash
your-project/
โโโ server.js # Entry point
โโโ .env # Environment variables (DB_URI, PORT, BASE_URL)
โโโ public/ # Static assets
โโโ config/
โ โโโ db.js # Database connection logic
โโโ routes/
โ โโโ AuthRoute.js # /auth routes
โโโ controllers/
โ โโโ AuthController.js # Register & Login logic
โโโ models/
โ โโโ User.js # User model based on DB/ORM
โโโ package.json # Scripts and metadata
```
## ๐ Auth Features
Includes:
- `/auth/register` โ Create new user with hashed password
- `/auth/login` โ Authenticate user and return JWT
## ๐งช Scripts
```bash
npm start # Run app with node
npm run dev # Run app with nodemon (auto-reloads)
```
## ๐ Environment File (.env)
```env
PORT=5000
BASE_URL=http://localhost:5000
DB_URI=mysql://username:password@localhost/dbname
JWT_SECRET=your_jwt_secret_here
```
## ๐ง Future Improvements
- Add CLI flags for non-interactive usage
- Optional frontend boilerplate integration
- Testing setup with Jest or Vitest
- Docker support
## ๐ฆ Contributing
Feel free to fork, improve, and make PRs โ your contributions are welcome!
## ๐ Credits
Built by **ZaYn Miraj**
CLI Creator: [@zaynmiraj](https://www.zaynmiraj.com)
## ๐ License
MIT ยฉ 2025 [Zayn Miraj](https://github.com/zaynmiraj)