Skip to content

MateusPersonalProjects/pokeChallenge

Repository files navigation

pokeChallenge 🕹️

A RESTful API built with NestJS to manage Trainers, Teams, and Pokémon, integrating with the public PokéAPI.


🚀 Tech Stack

  • 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

📂 Project Structure


src/
├─ trainers/       # Trainer CRUD
├─ teams/          # Team CRUD
├─ team-pokemon/   # Pokémon per Team
└─ pokeapi/        # Service for PokéAPI requests


⚙️ Requirements

  • Node.js 18+ and npm
  • Docker and docker-compose (recommended)

🐳 Quick Setup with Docker (Recommended)

  1. Clone the repository
git clone https://github.com/<your-username>/pokemon-teams-api.git
cd pokemon-teams-api
  1. Start the database container
docker-compose up -d
  1. Install dependencies and start the API
npm install
npm run start:dev

The API will be running at http://localhost:3000.


🛠️ Main Endpoints

Trainers

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

Teams

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

Team Pokémon

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

📖 Swagger Documentation

After starting the application, visit:

http://localhost:3000/api

for interactive API documentation.


🧪 Manual Testing

Use curl, HTTPie, or Postman. Example:

curl -X POST http://localhost:3000/trainers \
  -H "Content-Type: application/json" \
  -d '{"name":"Ash","cidadeOrigem":"Pallet"}'

⚡ Development Commands

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)

📜 License

MIT – free to use, modify and distribute.


📝 Notes

  • 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).

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published