An opinionated template for building highly maintainable and modular APIs using TypeScript, Node.js, and Clean Architecture.
- Node: ^16.14.2
- NPM: ^8.5.0
- Docker: ^20.10.14
- docker-compose: ^1.27.4
- Duplicate the
.env.example
file in the project root and rename it to.env
. - Start the docker-compose ->
docker-compose up
. - Access http://localhost:3000/health and verify if it's functioning.
- To debug with VSCode, open the project root and press
F5
. - If you're using MongoDB, access the panel: http://localhost:9000.
- Username: docker
- Password: docker
- If you're using PostgreSQL, access the panel: http://localhost:8000.
- Username: admin@docker.com
- Password: docker
- To run unit tests ->
npm run test:unit
. - To run integration tests ->
npm run test:integration
. - To run all tests with coverage ->
npm run test:ci
. - To run all tests ->
npm run test
.
# Build the project for production
$ npm run build
# Run the application in production
$ npm run start
# Run the application in debug mode
$ npm run debug
# Run the lint
$ npm run lint
- Configure the TypeORM environment variables to point to the 'dist' folder:
TYPEORM_ENTITIES=dist/infra/databases/typeorm/entities/**/* TYPEORM_ENTITIES_DIR=dist/infra/databases/typeorm/entities TYPEORM_MIGRATIONS=dist/infra/databases/typeorm/migrations/**/* TYPEORM_MIGRATIONS_DIR=dist/infra/databases/typeorm/migrations
- Update the project version:
npm version [VERSION] -m '[MESSAGE]'
- Choose the version according to Semver
- Add a [MESSAGE] to identify the change, e.g., 'feat: add some feature'
- Push the tag:
git push origin [BRANCH] --follow-tags
- Start the Docker Compose:
docker-compose up sonar
- Install
sonar-scanner
(Refer to the Tutorial) - Execute
sonar-scanner
with the command:
sonar-scanner \
-Dsonar.projectKey=boilerplate-api \
-Dsonar.projectName=boilerplate-api \
-Dsonar.login=74368321996ef230fee92ae2821c599156285831
- Access the SonarQube page: http://localhost:9000/
- Login: admin
- Password: 123456
We welcome contributions to enhance the project and make it better. To contribute, please follow these guidelines:
- Fork the repository and create a new branch for your feature or bug fix.
- Make your changes and ensure they are well-tested.
- Commit your changes using a descriptive commit message adhering to the Conventional Commits format.
- Push your changes to your forked repository.
- Submit a pull request to the main repository, explaining the changes you have made.
Please ensure that your code follows our coding standards and conventions. Also, include appropriate tests with your changes.
Thank you for your interest in contributing!
This project is licensed under the MIT License.