Generated service includes the following features:
- Express.js
- MongoDB ODM using Mongoose
- PostgreSQL ORM using Sequelize, TypeORM or Prisma
- Code structure inspired by Node.js Best Practices & Uncle Bob Clean Architecture
Other features:
- Webpack with Typescript using @boringcodes/backpack
- Prettier using @boringcodes/prettier-config
- ESLint using @boringcodes/eslint-config-typescript
- Husky
- Lint Staged
- NVM
- Dockerfile
- Standard Version
Make sure yeoman
is installed
$ yarn global add yo
Then install the generator
$ yarn global add generator-create-service
Create a new directory
$ mkdir service-name
Then navigate to the created directory and run the following command to generate source
$ yo create-service
# or :with-mongo
$ yo create-service:with-mongo
# or :with-postgres-sequelize
$ yo create-service:with-postgres-sequelize
# or :with-postgres-typeorm
$ yo create-service:with-postgres-typeorm
# or :with-postgres-prisma
$ yo create-service:with-postgres-prisma
This scaffolds out:
├── .husky
├── src
│ ├── components
│ │ ├── index.ts
│ │ └── types.ts
│ ├── config
│ │ ├── index.ts
│ │ ├── mongo.ts (:with-mongo)
│ │ └── postgres.ts (:with-postgres-sequelize/:with-postgres-typeorm)
│ ├── db
│ │ ├── mongo.ts (:with-mongo)
│ │ ├── postgres.prisma (:with-postgres-prisma)
│ │ └── postgres.ts (:with-postgres-sequelize/:with-postgres-typeorm/:with-postgres-prisma)
│ ├── app.ts
│ └── index.ts
├── .dockerignore
├── .env.example
├── .gitignore
├── .nvmrc
├── Dockerfile
├── LICENSE
├── package.json
├── README.md
└── tsconfig.json
To generate service component with full CRUD
functions, please use @boringcodes/create-service-component
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.