JSPM

  • Created
  • Published
  • Downloads 7
  • Score
    100M100P100Q45698F
  • License MIT

A simple express cli to generate express app simply by running a command, similar to express-generator

Package Exports

    This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (gen-express-cli) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

    Readme

    GEN-EXPRESS-CLI

    logo
    GitHub License NPM Version node-current GitHub last commit NPM Downloads GitHub Repo stars

    πŸ“˜ Introduction

    gen-express-cli is a powerful and modern alternative to the default express-generator, designed to help you build structured, scalable, and production-ready Express applicationsβ€”fast.

    With just a single command, it scaffolds a clean, opinionated project layout powered by TypeScript, ESM, testing, validation, environment configs, and more. Whether you're building a quick prototype or a maintainable backend for a real-world product, gen-express-cli provides everything you need to get startedβ€”without the boilerplate.

    Forget the chaos of manually setting up tools and project structure. This CLI gives you best practices out of the box, while keeping the flexibility and simplicity of Express.

    ✨ Features

    • πŸ“¦ Full ESM Support (TypeScript module: NodeNext)
    • πŸ“‚ Organized Folder Structure (controllers, services, routes, middlewares, etc.)
    • 🧠 TypeScript with ready‑to‑use build scripts
    • 🧰 ESLint v9 (Flat Config) & Prettier preconfigured
    • πŸ§ͺ Unit Testing with Jest (ESM‑ready setup)
    • πŸ›£οΈ Path Aliases (#src/) with runtime resolution
    • 🐳 Dockerfile for production builds
    • βš™οΈ Environment Config Setup
    • βœ… Request Validation (with zod)
    • 🧾 Logger (with winston) & Error Handling
    • βš™οΈ CI Templates (with GitHub Actions format/lint/test)

    πŸ“‚ Quick Start

    # Default (TypeScript)
    npx gen-express-cli@latest <project-name>
    
    # For JavaScript
    npx gen-express-cli@latest <project-name> -t javascript
    npm run dev           # for development
    npm run start         # for production
    npm run build         # for typescript build
    npm run lint          # for eslint
    npm run lint:fix      # for eslint fix
    npm run format        # for prettier
    npm run format:check  # for prettier check
    npm run typecheck     # for typescript type check
    npm run test          # for unit test
    npm run test:watch    # for unit test in watch mode
    npm run test:cov      # for test coverage
    docker build -t my-express-app:1.0 .
    docker run -p 8000:8000 --env-file ./.env my-express-app:1.0 

    πŸ“‚ Folder Structure

    ts
    β”œβ”€ .dockerignore
    β”œβ”€ .nvmrc
    β”œβ”€ .prettierignore
    β”œβ”€ .prettierrc.json
    β”œβ”€ Dockerfile
    β”œβ”€ eslint.config.js
    β”œβ”€ jest.config.ts
    β”œβ”€ package-lock.json
    β”œβ”€ package.json
    β”œβ”€ README.md
    β”œβ”€ src
    β”‚  β”œβ”€ app.ts
    β”‚  β”œβ”€ config
    β”‚  β”‚  └─ env.ts
    β”‚  β”œβ”€ middlewares
    β”‚  β”‚  β”œβ”€ error-handler.ts
    β”‚  β”‚  β”œβ”€ index.ts
    β”‚  β”‚  β”œβ”€ logger.ts
    β”‚  β”‚  └─ validate.ts
    β”‚  β”œβ”€ modules
    β”‚  β”‚  β”œβ”€ healthcheck
    β”‚  β”‚  β”‚  β”œβ”€ healthcheck.controller.ts
    β”‚  β”‚  β”‚  └─ healthcheck.route.ts
    β”‚  β”‚  └─ user
    β”‚  β”‚     β”œβ”€ user.controller.ts
    β”‚  β”‚     β”œβ”€ user.route.ts
    β”‚  β”‚     β”œβ”€ user.schema.ts
    β”‚  β”‚     β”œβ”€ user.service.test.ts
    β”‚  β”‚     β”œβ”€ user.service.ts
    β”‚  β”‚     └─ user.types.ts
    β”‚  └─ server.ts
    β”œβ”€ tsconfig.build.json
    └─ tsconfig.json

    πŸ“š License

    This project is licensed under the terms of the MIT license.

    🀝 Contributing

    Contributions, issues and feature requests are welcome! Feel free to give your feedback and give me a star if you like this project.