Tech Stack: Node.js, Typescript, Nest.js, PostgreSQL
- Node v16.13.2 or higher
- Docker and docker compose
$ git clone
$ npm install
$ docker compose up
this will start postgres and adminer on local containers
adminer is lighwheight DBMS that runs on browser
-> access adminer on your localhost:8080
* server: db
* username: pgsql
* password: pgsql
* leave the database field empty
(you may change these values on docker-compose.yml following your preferences)
-> create a database with the name of your preference and leave it empty
-> create a .env file on project root following .env.example model and fill
the placeholders with the same values above
$ npm run start:dev
[Swagger] http://localhost:300/api-docs
# unit tests
$ npm run test
# test coverage
$ npm run test:cov
# find problems
$ npm run lint
# find and fix problems automatically
$ npm run lint:fix
# format code
$ npm run format
> src
> core (files that are used all over the API)
> error (files to do the error handling and format API errors)
> request-interceptor (Nest.js interceptor to catch errors and do API logging)
> api-validation.pipe.ts (Nest.js pipe to validate DTOs)
> swagger-response.ts (abstraction to add and reuse swagger responses)
> modules
> typings (contains all the API typings)
> test
> integration (integration tests mocking the database)
> mocks (mocks used all over the tests using builder pattern)
> unit (unit tests)