Skip to content

Open-Core-Lab/exp-gen

Repository files navigation

exp-gen πŸš€

NPM version

exp-gen a lightning-fast, interactive CLI tool designed to scaffold Express.js REST APIs in seconds.

Whether you're starting a project with TypeScript or JavaScript, exp-gen generates a clean layered architecture, configures your preferred database boilerplate so you can start coding immediately, and now includes a built-in web-based Regex Simulator to help you build and debug regular expressions visually.


✨ Features

  • πŸš€ Interactive CLI powered by @clack/prompts
  • ⚑ Scaffold Express.js APIs in seconds
  • 🟦 TypeScript support
  • 🟨 JavaScript support
  • πŸ—‚ Professional layered architecture
  • πŸƒ MongoDB (Mongoose)
  • 🐬 MySQL
  • πŸͺΆ SQLite
  • 🐘 PostgreSQL (JavaScript projects)
  • πŸ“¦ Optional automatic dependency installation
  • πŸ”¬ Built-in Regex Simulator
  • 🌐 Opens automatically in your browser
  • 🎨 Modern developer-friendly UI
  • πŸ“– Live regex explanation & validation

πŸš€ Installation

Install globally using npm:

npm install -g @madhusha_99/exp-gen

πŸš€ Usage

After installation you can launch the CLI using any of the following commands:

exp

or

gen

or

express-draft

When the CLI starts you'll be greeted with an interactive menu.

πŸš€ Scaffold a new Express API

πŸ”¬ Run Regex Simulator

πŸš€ Scaffold Express API

Choose Scaffold a new Express API and answer a few questions.

The CLI will ask for:

  • Project name
  • Language
  • Database
  • Install dependencies

Supported languages

  • TypeScript (Recommended for type safety) – Currently available with MongoDB (Mongoose) and No Database templates. More database integrations will be added in future releases.
  • JavaScript – Full template support for all currently available databases, including MongoDB (Mongoose), MySQL (mysql2), SQLite (sqlite3), PostgreSQL (pg), and No Database.

πŸ—„οΈ Supported Databases

Database JavaScript TypeScript Driver / ORM Status
MongoDB βœ… βœ… Mongoose Stable
MySQL βœ… ❌ mysql2 Stable
SQLite βœ… ❌ sqlite3 Stable
PostgreSQL βœ… ❌ pg Stable
None (No Database) βœ… βœ… β€” Stable
Prisma (MongoDB) 🚧 🚧 Prisma ORM Planned
Prisma (MySQL) 🚧 🚧 Prisma ORM Planned
Prisma (PostgreSQL) 🚧 🚧 Prisma ORM Planned
Prisma (SQLite) 🚧 🚧 Prisma ORM Planned

Preview

Scaffold Express API Demo


πŸ“ Project Structure

  • configs/: Environment variables and database connection logic.
  • controllers/: Bridges the routes and the business logic; handles requests/responses.
  • dtos/: Data Transfer Objects for validating and shaping incoming data.
  • interfaces/: TypeScript interfaces and types for strict type safety.
  • middlewares/: Custom Express middlewares (Auth, Error handling, Logging).
  • models/: Database schemas (e.g., Mongoose/MongoDB models).
  • repositories/: The data access layer; handles direct database operations.
  • routes/: API endpoint definitions and mapping to controllers.
  • services/: Core Business Logic layer; where the heavy lifting happens.
  • utils/: Shared helper functions and utility classes.
  • app.ts: The application entry point.

The generated architecture follows a clean layered design making projects easier to maintain and scale.


πŸ”¬ Regex Simulator

Starting from v1.4.0, exp-gen includes a fully interactive Regex Simulator.

Simply choose:

πŸ”¬ Run Regex Simulator

The CLI automatically starts a lightweight local server and opens the Regex Simulator in your default web browser.

βœ… No additional dependencies are required. The simulator is built into exp-gen and runs entirely on your local machine.

Preview

Regex Simulator Demo

Regex Simulator Web


Features in Regex Simulator

  • ⚑ Live regex matching
  • πŸ“– Regex rule explanations
  • 🎯 Capture group visualization
  • πŸ” Match position detection
  • 🚨 Friendly validation errors
  • 🧠 Beginner-friendly regex guidance
  • 🏷 Regex flag helper
  • πŸŒ™ Modern dark developer UI
  • 🌐 Runs completely locally

Example

(?<name>\w+)-(\d+)

Input:

hello-123
world-456
invalid-value

Output:

βœ“ Match 1
hello-123

Group 1:
hello

Group 2:
123

The simulator also explains regex tokens such as:

Token Description
\d Digit
\w Word character
. Any character
+ One or more
* Zero or more
? Optional
^ Start of input
$ End of input
() Capture group
(?<name>) Named capture group

πŸš€ Example Workflow

exp
βœ” What would you like to do?

❯ πŸš€ Scaffold a new Express API
  πŸ”¬ Run Regex Simulator

or

βœ” What would you like to do?

  πŸš€ Scaffold a new Express API
❯ πŸ”¬ Run Regex Simulator

πŸ“¦ After Scaffolding

Navigate into your project

cd my-project

If dependencies were installed

npm run dev

Otherwise

npm install
npm run dev

🀝 Contributing

We love open source! exp-gen is a community-driven project, and we welcome contributions to make it better.

You can help by:

  • Adding new database templates
  • Improving generated project templates
  • Improving the Regex Simulator
  • Reporting bugs
  • Suggesting new CLI features

Clone the project

git clone https://github.com/Open-Core-Lab/exp-gen.git

Install dependencies

npm install

Run locally

npm run dev

πŸ“‹ Roadmap

Upcoming features include:

  • Prisma support
  • Docker template generation
  • JWT Authentication template
  • Swagger/OpenAPI generation
  • Testing templates (Vitest/Jest)
  • Redis integration
  • Prisma PostgreSQL template
  • Environment profile generator
  • More Regex Simulator utilities

⭐ Support

If you enjoy using exp-gen, consider giving the repository a ⭐ on GitHub.

It helps the project grow and supports future development.

Repository: exp-gen


πŸ“„ License

This project is licensed under the MIT License.

Happy coding! πŸš€

Maintained with ❀️ by Madhusha Prasad

About

This is a very simple and small generator for creating Express.js projects with TypeScript or Javascript. You can use it to quickly start a new API project.

Topics

Resources

License

Stars

4 stars

Watchers

1 watching

Forks

Packages

 
 
 

Contributors