Skip to content

A simple express generator cli tool supporting ESM, TypeScript, Jest, Dockerfile, ESLint & Prettier, Swagger and path alias.

License

Notifications You must be signed in to change notification settings

RulerChen/gen-express-cli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

71 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GEN-EXPRESS-CLI

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

✨ Features

  • 📦 Easy to use
  • 📦 TypeScript Support
  • 📦 ESM Support
  • 📦 Docker Support
  • 📦 Prettier & ESLint Support
  • 📦 Jest Support (Unit Test)
  • 📦 Swagger Support
  • 📦 Path Alias

📂 Quick Start

npx gen-express-cli@latest <project-name>

cd <project-name>

npm run dev # for development
npm run start # for production
npm run build # for typescript build
npm run lint # for eslint
npm run format # for prettier
npm run test # for unit test
npm run swagger # for build swagger

docker build -t <image-name> .

📖 Usage

npx gen-express-cli --help

Usage: gen-express-cli [project-name]

Options:
  -v, --version                     output the current version
  -t, --template <template-name>    choose express template (choices: "javascript", "typescript")
  -l, --linter                      choose linter (default: false)
  -u, --unit-test <unit-test-name>  choose unit test (choices: "jest", "none")
  -a, --api-doc                     use swagger for API documentation (default: false)
  -d, --docker                      use docker for containerization (default: false)
  -al, --alias                      use alias for import (default: false)
  -m  --manager <package-manager>   choose package manager (choices: "npm", "yarn")
  -h, --help                        display help for command

📂 Folder Structure

├─ src
│  ├─ index.ts
│  ├─ __tests__
│  │  └─ user.spec.ts
│  ├─ controllers
│  │  └─ user.ts
│  ├─ models
│  │  └─ user.ts
│  └─ routes
│     ├─ index.ts
│     └─ user.ts
├─ .dockerignore
├─ .env
├─ .env.development
├─ .eslintrc.json
├─ .gitignore
├─ .prettierrc.json
├─ apidoc.json
├─ Dockerfile
├─ jest.config.ts
├─ package-lock.json
├─ package.json
├─ process.env.d.ts
├─ README.md
├─ swagger.ts
└─ tsconfig.json

📦 Dependencies

[
  "dependencies": {
    "cors": "^2",
    "cross-env": "^7",
    "dotenv": "^16",
    "express": "^4",
    "swagger-ui-express": "^5"
  },
  "devDependencies": {
    "nodemon": "^3",
    "typescript": "~5.3",
    "ts-node": "^10",
    "@types/cors": "^2",
    "@types/express": "^4",
    "@types/node": "^20",
    "eslint": "^8",
    "@typescript-eslint/eslint-plugin": "^6",
    "eslint-config-prettier": "^9",
    "eslint-config-standard-with-typescript": "^43",
    "eslint-plugin-import": "^2",
    "eslint-plugin-n": "^16",
    "eslint-plugin-prettier": "^5",
    "eslint-plugin-promise": "^6",
    "prettier": "^3",
    "eslint-plugin-jest": "^27",
    "jest": "^29",
    "ts-jest": "^29",
    "@types/jest": "^29",
    "swagger-autogen": "^2",
    "@types/swagger-ui-express": "^4",
    "tsc-alias": "^1",
    "tsconfig-paths": "^4",
    "typescript-transform-paths": "^3"
  }
]

📚 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.