-
First, clone the repo and install the dependencies,
npm install
Keep in mind that we use
npm
for managing Node packages. If you try installing the dependencies withyarn
, it will generate ayarn-lock
file that will likely cause problems with the existingpackage-lock.json
. -
Create a .env file in the root directory and add the following environment variables:
JWT_SECRET=your-secret-key POSTGRES_PASSWORD=your_postgres_password DATABASE_PASSWORD=your_postgres_password
-
Start the application with Docker.
docker-compose up --build
-
You do not have to worry about the database configuration because I have added the synchronize parameter as true and that means that once you start Docker, the DB will be ready to receive requests.
-
The API will be available at
http://localhost:3000
.
When you launch your Docker container, the project will be launched in watch mode, so any change you make in the code will be reflected in your instance.
To create the documentation for a new endpoint, you need to add the ApiTags with the desired tag name to the controller, and then add the ApiOperation to the method of the request.
@ApiTags('welcome')
@ApiOperation({ summary: 'Welcome message!' })
The DOCS will be available at http://localhost:3000/api/v1/docs
To create a new endpoint, you need to run the following commands to generate the module, controller, and service:
nest g module users
nest g controller users
nest g service users
Before submitting a patch, please make sure that the code is formatted executing this command:
npm run format
Testing is crucial for us and we strive for high coverage of our code.
We encourage you to write tests for every functionality you build and also update the existing ones if they need to.
Before running the test, install the needed dependencies:
npm install
Execute all tests with:
To run the tests we need to run this script
npm run test
Before pushing your changes, make sure you run the linter and prettier to ensure the code follows the rules, or the CI pipeline will throw an error and fail:
npm run lint
npm run format