A backend microservice to make easily the development
What is needed to set up the dev environment. For instance, global dependencies or any other tools. include download links.
📦
├─ .czrc
├─ .env.example
├─ .env.test
├─ .eslintrc.js
├─ .github
│ └─ workflows
│ ├─ cd.yml
│ ├─ ci.yml
│ └─ greetings.yml
├─ .gitignore
├─ .nvmrc
├─ .prettierrc
├─ .vscode
│ ├─ launch.json
│ └─ tasks.json
├─ CHANGELOG.md
├─ LICENSE
├─ README.md
├─ commitlint.config.js
├─ docker-compose.yaml
├─ docker
│ ├─ Dockerfile
│ ├─ docker.env
│ ├─ postgres
│ │ └─ create-multiple-postgresql-databases.sh
│ └─ rabbitmq
│ ├─ definitions.json
│ └─ rabbitmq.conf
├─ heroku.yml
├─ nest-cli.json
├─ package.json
├─ scripts
│ └─ bump-release.js
├─ src
│ ├─ app.module.ts
│ ├─ config
│ │ ├─ index.ts
│ │ ├─ typeorm
│ │ │ └─ index.ts
│ │ └─ winston
│ │ └─ index.ts
│ ├─ core
│ │ ├─ core.module.ts
│ │ └─ filters
│ │ └─ http-exception-filter.ts
│ ├─ environments
│ │ ├─ index.ts
│ │ └─ typeorm.ts
│ ├─ health
│ │ ├─ health.controller.ts
│ │ └─ health.module.ts
│ ├─ main.ts
│ ├─ modules
│ │ └─ tasks
│ │ ├─ controllers
│ │ │ └─ tasks.controller.ts
│ │ ├─ dto
│ │ │ └─ task.dto.ts
│ │ ├─ entities
│ │ │ └─ task.entity.ts
│ │ ├─ services
│ │ │ └─ tasks.service.ts
│ │ └─ tasks.module.ts
│ └─ swagger
│ ├─ index.ts
│ ├─ swagger.config.ts
│ ├─ swagger.interface.ts
│ └─ swagger.ts
├─ test
│ ├─ app.e2e.spec.ts
│ ├─ core.e2e.spec.ts
│ ├─ health.controller.e2e.spec.ts
│ ├─ jest-e2e.json
│ ├─ swagger.e2e.spec.ts
│ ├─ tasks.service.e2e.spec.ts
│ └─ typeorm.e2e.spec.ts
├─ tsconfig.build.json
└─ tsconfig.json
To get the project ready to develop or simple execute to see sample running, follow the below instructions:
git clone https://github.com/LucasMonteiroi/nestjs-backend-microservice.git
cd nestjs-backend-microservice/
# Yarn install packages and husky install
yarn && yarn prepare
# Get sample env to execute microservice
cp .env.example .env
# Change env vars if necessary
yarn start
If you want execute on docker just execute these commands too
# Copy env file to docker folder
cp .env ./docker/docker.env
# Run docker compose to run containers and dependencies
docker-compose up -d
# To stop containers run this code
docker-compose down
Here we using a git flow strategy to develop see here more about it
The main libraries used in this project are:
To build docker image after changes, just run this:
docker-compose build backend-microservice
# After build, just run compose again
docker-compose up -d
After make changes, to deploy, just make a pull request to branch develop
and the github actions will deploy automatically, it's recommended, generate a new version before deploy
To generate a new version, just run this command passing the type of version patch, minor or major
yarn release patch # minor or major
This command will update version on package.json
, generate the CHANGELOG.md
based on CZ Emoji Commits and push to branch
Here is the default configurations based on docker.
PORT=3000
DATABASE_URL=
DATABASE_HOST=192.168.0.3
DATABASE_PORT=5432
POSTGRES_USER=root
POSTGRES_PASSWORD=root
POSTGRES_MULTIPLE_DATABASES=backend_microservice, backend_microservice_testing
Nest Js Backend Microservice is MIT licensed