Loading repository data…
Loading repository data…
niqueborges / repository
Challenge | Bootcamp - AWS AI FDE BACK-END JOURNEY NODE.JS - AI/R BELONG_ABR26.This project is the final backend development challenge for Grid Motors, a dealership specializing in vehicle rentals. The goal is to develop a complete REST API to manage cars, reservations, users, and authentication.
A transparent discovery signal based on current public GitHub metadata.
This score does not audit code, security, maintainers, documentation quality, or suitability. Verify the repository and its current documentation before adoption.
Welcome to the Grid Motors API. This is the final project for the Challenge | Bootcamp - AWS AI FDE BACK-END JOURNEY NODE.JS - AI/R BELONG_ABR26.
The goal of this project is to provide a complete RESTful API for managing car rentals, including user authentication, vehicle inventory, accessories, and reservation management with business rules.
The project follows a modular architecture inspired by Clean Architecture principles, keeping responsibilities separated and the codebase scalable.
flowchart TD
Client([Client / Swagger UI]) -->|HTTP REST| API
subgraph "Docker Compose"
subgraph "NestJS Application"
API[API Controllers]
Auth[Auth & JWT Strategy]
Services[Business Services]
Repos[Prisma Repositories]
API --> Auth
API --> Services
Services --> Repos
end
Cache[(Redis Cache)]
DB[(PostgreSQL)]
Services -.->|Cache Data| Cache
Repos -->|Prisma ORM| DB
end
grid-motors/
├── prisma/
│ ├── migrations/ # Database migrations
│ └── schema.prisma # Database schema
├── prisma.config.ts # Prisma 7 configuration
├── src/
│ ├── auth/ # Authentication, JWT strategy and guards
│ ├── cars/ # Car and accessories management
│ ├── common/ # Global filters, validators and providers
│ ├── reservations/ # Rental business rules
│ ├── users/ # User management and integrations
│ ├── main.ts # Application entry point
│ └── app.module.ts
├── test/ # E2E tests
├── .env # Local environment (ignored by Git)
├── .env.example # Local environment template
├── .env.docker.example # Docker environment template
├── .gitignore
├── docker-compose.yml # API, PostgreSQL and Redis services
├── Dockerfile # Multi-stage production build
└── README.md
The .env file is intentionally ignored by Git.
Use one of the provided examples to create your local configuration:
.env.example → running the API locally.env.docker.example → running the complete environment with Docker ComposeThe API uses a relational database structure managed by Prisma ORM.
erDiagram
User {
String id PK
String name
String cpf UK
DateTime birth
String email UK
String password
String cep
String street
String neighborhood
String city
String state
String qualified
DateTime createdAt
DateTime updatedAt
}
Car {
String id PK
String model
String color
Int year
Float value_per_day
Int number_of_passengers
DateTime createdAt
DateTime updatedAt
}
Accessory {
String id PK
String description
String carId FK
DateTime createdAt
DateTime updatedAt
}
Reservation {
String id PK
DateTime start_date
DateTime end_date
Float final_value
String userId FK
String carId FK
DateTime createdAt
DateTime updatedAt
}
User ||--o{ Reservation : "makes"
Car ||--o{ Reservation : "has"
Car ||--o{ Accessory : "has"
Make sure you have installed:
Check your environment:
docker --version
docker compose version
node -v
npm -v
Docker Compose starts the complete application environment:
git clone https://github.com/niqueborges/grid-motors.git
cd grid-motors
Create your .env file:
cp .env.docker.example .env
Example:
PORT=3000
DATABASE_URL="postgresql://postgres:postgres@db:5432/grid_motors?schema=public"
JWT_SECRET="change-me"
REDIS_HOST=redis
REDIS_PORT=6379
Inside Docker, services communicate using container names:
PostgreSQL: db:5432
Redis: redis:6379
docker compose up --build -d
Check running containers:
docker ps
Expected containers:
grid-motors-api
grid-motors-db
grid-motors-redis
The API will be available at:
http://localhost:3000/api/v1
Swagger documentation:
http://localhost:3000/api/v1/api-docs
The API container automatically runs Prisma migrations:
npx prisma migrate deploy
This option runs PostgreSQL and Redis using Docker while running NestJS locally.
npm install
Create your local .env:
cp .env.example .env
Example:
PORT=3000
DATABASE_URL="postgresql://postgres:postgres@localhost:5433/grid_motors?schema=public"
JWT_SECRET="change-me"
REDIS_HOST=localhost
REDIS_PORT=6379
Start PostgreSQL and Redis containers:
docker compose up -d db redis
Local services:
PostgreSQL: localhost:5433
Redis: localhost:6379
npx prisma client and generatebase migrations
npx prisma generate
npx prisma migrate dev
Development mode:
npm run start:dev
Swagger documentation:
http://localhost:3000/api/v1/api-docs
Authentication flow:
POST /api/v1/auth/login
Key design decisions implemented in the API:
@nestjs/throttler to protect endpoints against excessive requests.Run unit tests:
npm run test
Run coverage:
npm run test:cov
Run E2E tests:
npm run test:e2e
Developed by Monique Borges.