An Interactive Express.js API Generator
DEV Community

An Interactive Express.js API Generator

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/
  • Optional automatic dependency installation

No more manually creating folders or copying boilerplate.

Installation

npm install -g @madhusha_99/exp-gen

Run it anywhere:

exp
# or
gen
# or
express-draft

Example

The CLI will ask you:

  • Project Name
  • TypeScript or JavaScript?
  • Select Database
  • Install dependencies?

…and generates everything for you. After that:

cd my-api
npm run dev

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! πŸš€

Comments

No comments yet. Start the discussion.