node-genie
Version:
Interactive CLI tool to quickly scaffold Node.js projects with TypeScript/JavaScript support and multiple architecture options
285 lines (203 loc) โข 7.87 kB
Markdown
# ๐งโโ๏ธ Node Genie
Interactive CLI tool to quickly scaffold Node.js projects with TypeScript/JavaScript support and multiple architecture options.
[](https://badge.fury.io/js/node-genie)
[](https://opensource.org/licenses/MIT)
[](https://nodejs.org/)
## โจ Features
- ๐จ **Colored Interactive CLI** - Beautiful interface with cursor navigation
- ๐ป **Language Support** - Choose between TypeScript (recommended) or JavaScript
- ๐๏ธ **Multiple Architectures** - Choose between MVC structure or Simple structure
- ๐ **MVC Architecture** - Full structured project with controllers, models, routes, and more
- ๐ **Simple Structure** - Single server file with basic route (no src folder)
- ๐ง **Code Quality** - Optional ESLint + Prettier setup
- ๐ **Essential Files** - Always includes .gitignore, .env template, and configuration files
- ๐ **Ready to Run** - Complete project setup with package.json and scripts
- ๐ฆ **Package Manager Support** - Choose between npm, yarn, or pnpm
## ๐ Quick Start
### Installation
```bash
# Install globally via npm
npm install -g node-genie
# Or using yarn
yarn global add node-genie
# Or using pnpm
pnpm add -g node-genie
```
### Usage
```bash
# Run the interactive CLI
node-genie
```
### Development Installation
If you want to contribute or run from source:
```bash
# Clone the repository
git clone https://github.com/ayushrajput8021/node-genie.git
cd node-genie
# Install dependencies
npm install
# Link the CLI globally (for development)
npm link
```
The CLI will guide you through:
1. **Project Name** - Enter your project name
2. **Language Choice** - TypeScript (recommended) or JavaScript
3. **Architecture** - MVC structure or Simple structure
4. **Package Manager** - npm, yarn, or pnpm
5. **Code Quality** - Set up ESLint + Prettier
### Architecture Options
#### ๐๏ธ MVC Architecture
Full structured project with organized folders:
- `src/server.ts/js` - Main server file
- `src/app.ts/js` - Express app setup
- `src/routes/index.ts/js` - Basic routing
- `src/middlewares/auth.ts/js` - Authentication middleware
- `src/database/connection.ts/js` - Database setup
- Plus controllers, models, services, utils folders
#### ๐ Simple Structure
Minimal setup with just a server file in the root:
- `server.ts/js` - Single server file with basic route and middleware
- No src folder, perfect for quick prototypes or learning
**Always included:** `.gitignore`, `.env` template, and appropriate configuration files
## ๐ Generated Project Structure
### MVC Architecture
```bash
my-project/
โโโ src/
โ โโโ configs/
โ โ โโโ index.ts/js # Configuration management
โ โโโ controllers/ # Request handlers
โ โโโ database/
โ โ โโโ connection.ts/js # Database connection setup
โ โโโ middlewares/
โ โ โโโ auth.ts/js # Authentication middleware
โ โโโ models/ # Data models
โ โโโ routes/
โ โ โโโ index.ts/js # API routes
โ โโโ services/ # Business logic
โ โโโ types/ # TypeScript types (TS projects only)
โ โโโ utils/
โ โ โโโ index.ts/js # Utility functions
โ โโโ app.ts/js # Express app setup
โ โโโ server.ts/js # Main server file
โโโ .env # Environment variables
โโโ .gitignore # Git ignore rules
โโโ .eslintrc.json # ESLint configuration (optional)
โโโ .prettierrc.json # Prettier configuration (optional)
โโโ tsconfig.json # TypeScript configuration (if TS)
โโโ package.json # Project dependencies and scripts
```
### Simple Structure
```bash
my-project/
โโโ server.ts/js # Single server file with route
โโโ .env # Environment variables
โโโ .gitignore # Git ignore rules
โโโ .eslintrc.json # ESLint configuration (optional)
โโโ .prettierrc.json # Prettier configuration (optional)
โโโ tsconfig.json # TypeScript configuration (if TS)
โโโ package.json # Project dependencies and scripts
```
## ๐ฆ Generated Dependencies
### For TypeScript Projects
- **Runtime**: `express`, `dotenv`, `cors`
- **Development**: `typescript`, `@types/*`, `tsx`, `rimraf`
- **Code Quality**: `eslint`, `prettier`, `@typescript-eslint/*`
### For JavaScript Projects
- **Runtime**: `express`, `dotenv`, `cors`
- **Development**: `nodemon`
- **Code Quality**: `eslint`, `prettier`
## ๐ฏ Available Scripts
After project generation, you can use these scripts:
```bash
# Install dependencies (using your chosen package manager)
npm install # or yarn install / pnpm install
# Start the server (production)
npm start
# Start development server with auto-reload
npm run dev
# Build TypeScript to JavaScript (TS projects only)
npm run build
# Clean build directory (TS projects only)
npm run clean
# Run ESLint (if enabled)
npm run lint
# Fix ESLint issues automatically (if enabled)
npm run lint:fix
# Format code with Prettier (if enabled)
npm run format
```
### Example Usage
```bash
# Create a new project
node-genie
# Navigate to your project
cd my-awesome-project
# Install dependencies
pnpm install
# Start development server
pnpm run dev
# Your server will be running at http://localhost:3000
```
## ๐ง Development
To contribute to node-genie:
```bash
# Clone and setup
git clone https://github.com/ayushrajput8021/node-genie.git
cd node-genie
npm install
# Link for local development
npm link
# Test the CLI
node-genie
# Unlink when done
npm unlink node-genie
```
### Publishing
```bash
# Update version
npm version patch # or minor/major
# Publish to npm
npm publish
```
## ๐ Roadmap
### Phase 1 (Current) โ
- Interactive CLI with colors
- TypeScript/JavaScript support
- MVC structure generation
- Simple structure option
- Package manager selection
- ESLint, Prettier, configs
### Phase 2 (Coming Soon)
- ๐๏ธ Database integration options (MongoDB, PostgreSQL, MySQL)
- ๐งช Testing framework selection (Jest, Vitest)
- ๐ Authentication templates (JWT, Passport)
- ๐พ User preference memory
- ๐ API documentation setup (Swagger)
### Phase 3 (Future)
- ๐ Plugin system
- ๐ฅ Team templates
- โ๏ธ CI/CD configurations
- ๐ณ Docker support
- โ๏ธ Cloud deployment templates
## ๐ค Contributing
1. Fork the repository
2. Create your feature branch (`git checkout -b feature/amazing-feature`)
3. Commit your changes (`git commit -m 'Add amazing feature'`)
4. Push to the branch (`git push origin feature/amazing-feature`)
5. Open a Pull Request
## ๐จโ๐ป Author
**Ayush Rajput**
- GitHub: [@ayushrajput8021](https://github.com/ayushrajput8021)
- Email: <ayushrajput8021@gmail.com>
## ๐ Show your support
Give a โญ๏ธ if this project helped you!
## ๐ Stats



## ๐ License
MIT License - see the [LICENSE](LICENSE) file for details.
## ๐ Acknowledgments
- Built with [Commander.js](https://github.com/tj/commander.js/), [Inquirer.js](https://github.com/SBoudrias/Inquirer.js/), and [Chalk](https://github.com/chalk/chalk)
- Inspired by create-react-app and other scaffolding tools