Template to build customizable, flexible and well documented APIs with Node.js and Express.
Diagrams of the project architecture and others.
More details here.
Example of the architecture that runs on AWS Cloud.
Example of the architecture that runs with docker.
Lista od routes:
GET / - Root
GET /docs - Swagger docs
GET /alive - Health Check
GET /v1/product - Product List
POST /v1/product - Product Create
DELETE /v1/product/<uuid> - Soft Product Delete
GET /v1/product/<uuid> - Product Get
PATCH /v1/product/<uuid> - Soft Product Update
PUT /v1/product/<uuid> - Complete Product Update
- docker
- docker-compose
- node
- express
- typescript
- jest
- mocks
- yarn
- Projects Guidelines (Best practices)
- Docker Management (Docker-Compose)
- Localstack
- MySQL
- Redis
- OpenApi (Swagger)
- GitHub Actions
- Tests (Unit, Component, and Integration)
- Coverage Reports
- Code formatter (Prettier)
- Lint (ESlint)
- Standard commits (Commitizen)
- Standard files setup (Editorconfig)
- REST (RESTful & HATEOS)
- CodeQuality (Sonar)
- Database Migrations (Sequelize)
Configure Kong API Gateway to work with API Gateway compatibility.
Docs: https://docs.aws.amazon.com/en/cli/latest/userguide/install-cliv2.html
Execute the follow command:
apt install awscli
Execute the follow command:
aws configure
Execute the follow command:
./scripts/docker/create-network.sh
To nd install the modules, execute the follow command:
yarn install
Execute the follow command:
yarn run start:dev
To build execute the follow command:
./scripts/runenv.sh --build
Execute the follow command:
./scripts/runenv.sh
Execute the follow command:
./scripts/fixenv.sh
The following describes the use of automation scripts. These kebab case scripts help the developer in general tasks.
Kebab case scripts to help the developer with general tasks.
Kebab case scripts to help the developer with general tasks.
Script | Description | Context |
---|---|---|
boot.sh | Starts the application while the container is running | Local boot |
boot-db.sh | Starts data to database | Local boot |
boot-queues.sh | Start application queues in localstack | Local boot |
boot-validate-connection.sh | Check if localstack is ready to connect | Local boot |
commit.sh | Run the communitarization tool to commit the message | Local development |
fixenv.sh | In some cases where the network is deleted, you can correct the container references | Local install |
pre-commit-config.sh | Script to prepare the local environment to run pre-commit tools | Local development |
preenv.sh | Script to run pre-build commands | Local boot |
runenv.sh | Script to start the project locally | Local development |
testenv.sh | Script to run the environment focusing on component tests | Local development |
Scripts that facilitate tasks for docker context;
Scripts that help execute commands on Localstack resources such as S3, SQS, Lambda, etc.
See the project samples in this folder here.
To run the unit tests for the project, you can run the following command:
Running the tests:
yarn run test
Start the docker containers:
./scripts/testenv.sh
Running the tests:
yarn run test:component
Copy the env/integration.env.example
file to
env/integration.env
and edit with the staging parameters.
Running the tests:
yarn run test:integration
Running the tests:
yarn run test:e2e
Running the tests:
yarn run test:all
To run the coverage tests, you can run the following commands:
Run the follow command:
yarn run test:cov
Start the docker containers:
./scripts/testenv.sh
Run the follow command:
yarn run test:component-cov
Copy the env/integration.env.example
file to
env/integration.env
and edit with the staging parameters.
Run the follow command:
yarn run test:integration-cov
Note: The result can be found in the
target/*
folder.
See the license: LICENSE.md.
- Anderson de Oliveira Contreira andersoncontreira
To run the lint in the project's source code, run the following command:
yarn run lint
To run the code formation on the project's source code, run the following command:
yarn run format
To install pre-commit execute the follow command:
./scripts/pre-commit-config.sh
To execute the build of the project execute the follow command:
yarn run build
To execute the guidelines validation of the project execute the follow command:
./scripts/guidelines-checker.py