A RESTful API built with NestJS to manage Trainers, Teams, and Pokémon, integrating with the public PokéAPI.
- NestJS – Main framework
- TypeORM – ORM for relational database
- PostgreSQL – Database
- Docker – Containerized environment
- Swagger – Interactive API documentation
- Axios – HTTP client to consume the PokéAPI
src/
├─ trainers/ # Trainer CRUD
├─ teams/ # Team CRUD
├─ team-pokemon/ # Pokémon per Team
└─ pokeapi/ # Service for PokéAPI requests
- Node.js 18+ and npm
- Docker and docker-compose (recommended)
- Clone the repository
git clone https://github.com/<your-username>/pokemon-teams-api.git
cd pokemon-teams-api- Start the database container
docker-compose up -d- Install dependencies and start the API
npm install
npm run start:devThe API will be running at http://localhost:3000.
| Method | Endpoint | Description |
|---|---|---|
| POST | /trainers |
Create a trainer |
| GET | /trainers |
List all trainers |
| GET | /trainers/:id |
Get a trainer by ID |
| PATCH | /trainers/:id |
Update a trainer |
| DELETE | /trainers/:id |
Delete a trainer |
| Method | Endpoint | Description |
|---|---|---|
| POST | /teams |
Create a team for a trainer |
| GET | /teams?trainerId={id} |
List teams of a trainer |
| PATCH | /teams/:id |
Update a team |
| DELETE | /teams/:id |
Delete a team |
| Method | Endpoint | Description |
|---|---|---|
| POST | /teams/:teamId/pokemons |
Add a Pokémon (validated against the PokéAPI) |
| GET | /teams/:teamId/pokemons |
List Pokémon of a team with enriched PokéAPI details |
| DELETE | /teams/:teamId/pokemons/:id |
Remove a Pokémon from a team |
After starting the application, visit:
http://localhost:3000/api
for interactive API documentation.
Use curl, HTTPie, or Postman.
Example:
curl -X POST http://localhost:3000/trainers \
-H "Content-Type: application/json" \
-d '{"name":"Ash","cidadeOrigem":"Pallet"}'| Command | Description |
|---|---|
npm run start |
Start the app in production mode |
npm run start:dev |
Start the app in watch/development |
npm run build |
Compile TypeScript into dist/ |
npm run test |
Run automated tests (if implemented) |
MIT – free to use, modify and distribute.
- Pokémon details (types, stats, sprites) are fetched live from the PokéAPI.
- Teams are limited to 6 Pokémon each (configurable in the service layer).