Skip to content

Xeron07/exgen-cli

Repository files navigation

🚀 EXGEN CLI

Next-Level Express Application Generator: Quickly create Express.js apps with useful tools, a clean project structure, and ready-to-use features.

Created by Xeron07


📦 Features

  • Interactive mode for guided project setup
  • View engine & CSS engine support (like express-generator)
  • TypeScript or JavaScript support
  • Presets for API, fullstack, microservices, startup apps
  • Production flags: Docker, Swagger, Redis, Auth, Testing
  • Minimal or full-featured project scaffolding
  • Built-in config and preset commands

🧰 Installation (for local development)

git clone <https://github.com/Xeron07/exgen-cli.git>
cd exgen-cli

# Install dependencies
npm install

# Run in development mode
npm run dev

# Build the project
npm run build

# Link globally to use `exgen` as a command
npm link

🔧 Usage

exgen [project-name] [options]

Example

exgen my-api --ts --mongo --swagger --docker --auth

or interactively:

exgen --init

💡 Options Overview

🛠 Initialization

Flag Description
--init Start in interactive prompt
-v, --version Show CLI version
-h, --help Show help message

🖼️ View & CSS (Express Generator Compatibility)

Flag Description
--view <engine> Add view engine (e.g. ejs, pug, hbs)
--css <style> Add CSS engine (e.g. sass, less)
--no-view Skip view engine
--git Include .gitignore

🧪 Language

Flag Description
--ts, --typescript Use TypeScript
--js, --javascript Use JavaScript (default)

⚙️ Feature Flags

Flag Adds...
--swagger Swagger/OpenAPI
--docker Docker + Compose
--mongo, --mongodb MongoDB + Mongoose
--pg, --postgres PostgreSQL + Sequelize
--redis Redis support
--test Jest + Supertest
--elk Logging with Winston + Elasticsearch
--auth JWT authentication
--cors CORS middleware
--helmet Helmet for security
--rate-limit Rate limiter
--validation Joi validation

🧩 Presets

Preset Includes
--api TypeScript, CORS, Helmet, Validation, Test
--fullstack View, CSS, Auth, MongoDB, Test
--microservice TypeScript, Docker, Redis, Test, ELK
--startup TypeScript, MongoDB, Auth, Swagger, Docker, Test

🛠 Project Modes

Flag Description
--light Essentials only (no DB/Docker/Swagger)
--all All core features except DB/Docker/Swagger
--prod Full production setup (Docker, Swagger, ELK, Tests)
--min Minimal production setup (no Docker/Swagger)

🧰 Dev/Build Flags

Flag Description
--skip-install Don’t run npm install
--skip-git Don’t initialize git
--verbose Verbose logs
--dry-run Show what would be generated

📂 Folder Structure

The project structure generated by exgen is modular, clean, and suited for real-world applications:

(root)/
├── src/
│   ├── api/
│   │   ├── routes/          # Route definitions (modular per resource)
│   │   └── middleware/      # Express middleware (auth, validation, logging)
│   ├── config/              # Environment and app configuration
│   ├── models/              # Mongoose/Sequelize schemas/models
│   ├── services/            # Business logic, service layers
│   └── utils/               # Reusable helpers and utilities
├── views/                   # View templates (e.g. EJS, Pug) if `--view` used
├── public/                  # Static assets served directly
│   ├── stylesheets/         # CSS or preprocessor files
│   ├── javascripts/         # Static frontend scripts
│   └── images/              # Public images
├── bin/
│   └── www                  # App entrypoint (like express-generator)
├── Dockerfile               # If `--docker` is used
├── docker-compose.yml       # For dockerized multi-service setups
├── swagger.yaml             # Swagger/OpenAPI docs (if `--swagger`)
├── .env                     # Environment variables (auto created)
├── .gitignore               # If `--git` or defaulted
├── package.json             # Project metadata and scripts
└── README.md


🔧 Commands

exgen config

Manage CLI-wide settings.

exgen config

exgen presets

List or manage available presets.

exgen presets

exgen info

Show debugging information about your environment.

exgen info

🧪 Testing

npm run test
npm run test:watch

🔗 Related Links


📄 License

MIT

© Xeron07


📬 Feedback & Contributions


About

EXGEN CLI - Express API Structure Generator

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors