DEV Community

Madhusha Prasad
Madhusha Prasad

Posted on

An Interactive Express.js API Generator

πŸš€ I Built exp-gen β€” An Interactive Express.js API Generator

After spending a lot of time creating the same Express.js project structure over and over again, I decided to automate the entire process.

Introducing exp-gen πŸŽ‰

A fast, interactive CLI that scaffolds production-ready Express.js APIs in seconds.

πŸŽ₯ Demo

Demo


✨ Features

βœ… Interactive CLI powered by @clack/prompts

βœ… Supports both TypeScript and JavaScript

βœ… Database selection during project creation

  • MongoDB (Mongoose)
  • MySQL
  • SQLite
  • PostgreSQL (JavaScript)
  • Prisma support coming soon

βœ… Generates a clean Layered Architecture

configs/
controllers/
dtos/
interfaces/
middlewares/
models/
repositories/
routes/
services/
utils/
Enter fullscreen mode Exit fullscreen mode

βœ… Optional automatic dependency installation

No more manually creating folders or copying boilerplate.


πŸ“¦ Installation

npm install -g @madhusha_99/exp-gen
Enter fullscreen mode Exit fullscreen mode

Run it anywhere:

exp

# or

gen

# or

express-draft
Enter fullscreen mode Exit fullscreen mode

πŸ–₯ Example

The CLI will ask you:

βœ” Project Name
βœ” TypeScript or JavaScript?
βœ” Select Database
βœ” Install dependencies?
Enter fullscreen mode Exit fullscreen mode

…and generates everything for you.

After that:

cd my-api
npm run dev
Enter fullscreen mode Exit fullscreen mode

You're ready to start building.


πŸ— Generated Architecture

Instead of a flat Express project, exp-gen creates a scalable layered architecture.

  • Configurations
  • Controllers
  • DTOs
  • Interfaces
  • Models
  • Repositories
  • Services
  • Routes
  • Middlewares
  • Utilities

Perfect for medium and large backend projects.


🀝 Open Source Contributions Welcome

I'd love to grow this into a community project.

Contributions are welcome for:

  • Prisma template
  • PostgreSQL improvements
  • Better authentication templates
  • Docker support
  • Testing templates (Jest/Vitest)
  • CI/CD templates
  • New project templates

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

NPM:
https://www.npmjs.com/package/@madhusha_99/exp-gen


I'd really appreciate any feedback from the community.

  • What features would you like to see?
  • What templates should be added next?
  • Any suggestions to improve the developer experience?

If you find it useful, consider giving the repository a ⭐.

Happy coding! πŸš€

nodejs #expressjs #typescript #javascript #opensource #cli #npm #backend #webdev #developers #devcommunity

Top comments (0)