README file under construction
An open-source API for managing gyms and users. Project developed inside the Rocketseat Ignite program.
Gabriel Rozzetti
- Node.js
- Fastify
- Fastify adapters:
- JWT integration (@fastify/jwt)
- Cookies (@fastify/cookies)
- Zod (schema validation)
- Prisma (ORM)
- Postgres
- Docker and Docker Compose
- Bcrypt (for password hashing)
- DayJS (for date manipulation)
- Vitest (for unit tests and e2e tests)
- Supertest (for e2e tests - mock requests)
- Node.js version: 18.16.0
cd gym-pass
npm i
docker compose up --build -d
Create a .env
file in the root folder and copy the variables from the .env.example
file.
Complete the DATABASE_URL
with username, password, Postgres PORT (default: 5432) and database name.
NODE_ENV
accepted options: dev
| test
| production
Fill the other variables also.
# run migrations first
npx prisma migrate dev
# check if DB is ok
npx prisma studio
# development mode
npm run start:dev
# build and run
npm run build
npm start
npm run test
# watch mode
npm run test:watch
# coverage
npm run test:coverage
# run first to create the prisma test environment
npm run test:e2e
# watch mode
npm run test:e2e:watch
POST /api/users
POST /api/sessions
PATCH /api/token/refresh
GET /api/me
POST /api/gyms
GET /api/gyms/search
GET /api/gyms/nearby
GET /api/items
Parâmetro | Tipo | Descrição |
---|---|---|
api_key |
string |
Obrigatório. A chave da sua API |
GET /api/items/${id}
Parâmetro | Tipo | Descrição |
---|---|---|
id |
string |
Obrigatório. O ID do item que você quer |
With this project, I was able to dive deep into TDD methodology, applying unit tests to use-cases and e2e tests to all app routes. I also learned about implementing a more clean and usable code with SOLID principles, Repository pattern and best practices.
This project implements the RBCA for the users, granting or denying certain actions based on their roles.