Node.js API starter using typescript implementing SOLID principles + Clean Architecture
- express for web framework
- body-parser for body parsing middleware
- Helmet for help on express security
- http-status-codes for HTTP status codes
- routing-controllers for controller classes
- class-transformer for transform plain object to some instance of class and versa
- class-validator for use of decorator and non-decorator based validation
- inversify for inversion of control (IoC)
- axios for http client
- uuid for the creation of RFC4122 UUIDs
- winston for logging
- cls-hooked for local storage based on chains of Node-style callbacks instead of threads
- reflect-metadata for decorators, custom metadata to classes, class fields, etc
- module-alias for create aliases of directories and register custom module paths
- Mocha, chai and Sinon for tests
- Nock for mock HTTP server on tests
- SuperTest for integration tests
- C8 for code coverage
- Github Actions CI configured for running lint and tests
To run this project you need to have installed:
Create a copy .env
file from .env.example
and populate the variables.
Install dependencies:
make install
Start application:
make up
View logs:
make logs
This command will boot:
- Node API on http://localhost:3000 if
PORT
variable has not been set on .env file. - If variable has been set, will boot API on
http://localhost:${PORT}
make install - install dependencies
make add lib=PACKAGE_NAME - add dependency
make add-dev lib=PACKAGE_NAME - add dev dependency
make up - start app
make logs - view logs
make down - kill app
make lint - run lint
make test - run tests
make test-watch - run tests on watch mode
make test-coverage - run tests with coverage report on /coverage folder
make build - build app on /dist folder
make up-build - start built app
make shell - run app shell