This is a REST API template made with NestJs, Prisma and PostgreSQL. This project is configured to be used with docker compose. Documentation of the endpoints was made with Swagger. For unit and e2e tests, Vitest was used.
-
Clone the repository (You can also just fork the repository and use it as a template):
git clone https://github.com/SamuelB7/nestjs-prisma-jwt-api-template.git cd nestjs-prisma-jwt-api-template
-
Copy the
.env.example
to.env
and configure your environment variables:cp .env.example .env
-
Install dependencies:
npm install
-
Make sure to have Docker Compose installed on your machine. The dockerfile.yml in this project will work fine, but I recommend that you change the name of the services and the name of the containers before using it. Also make sure that the environment variables in your .env are correct.
-
Start the Docker containers:
sudo docker compose up
-
Run database migrations:
npm run prisma:migrate:deploy
-
If you want to change the structure of the users table you can change the schema and then run:
npm run prisma:migrate <name-of-your-migration>
- By default this project is configured to use PostgreSQL, if you want to use any other database, make sure to change the dockerfile.yml to use the correct image.
To start the server in development mode, without docker run:
npm run start:dev
The server will be running at http://localhost:3333
To run the unit tests of the api, use the command:
npm run test
To run the e2e tests, use:
npm run test:e2e
After starting the application, go to http://localhost:3333/documentation to check the documentation of the api endpoints
This project is licensed under the MIT License
For any inquiries, please contact belo.samuel@gmail.com