A comprehensive RESTful API built with Spring Boot and Gradle that provides detailed information about the first 151 Pokémon from Generation I (Kanto region), including type effectiveness calculations.
- REST API endpoints for Pokémon data
- Complete first generation Pokédex (151 Pokémon)
- Detailed Pokémon descriptions in Portuguese
- Type effectiveness system with weaknesses and resistances
- Support for 1-2 types per Pokémon
- Search by type functionality
- Regional Pokédex support (Kanto and Johto)
- Clean service layer architecture with separated data initialization
- UUID-based identification system
src/
├── main/
│ ├── java/com/pokedex/
│ │ ├── PokedexApplication.java # Main Spring Boot application
│ │ ├── controller/
│ │ │ └── PokemonController.java # REST controller
│ │ ├── data/
│ │ │ └── PokemonDataInitializer.java # Pokemon data initialization
│ │ ├── model/
│ │ │ ├── Pokemon.java # Pokemon entity with descriptions and effectiveness
│ │ │ ├── PokemonType.java # Pokemon type enum (18 types)
│ │ │ ├── TypeEffectiveness.java # Type effectiveness enum with multipliers
│ │ │ ├── Region.java # Pokemon regions enum
│ │ │ └── RegionalEntry.java # Regional Pokedex entries
│ │ ├── service/
│ │ │ ├── PokemonService.java # Service interface
│ │ │ └── impl/
│ │ │ └── PokemonServiceImpl.java # Service implementation
│ │ └── util/
│ │ └── TypeEffectivenessCalculator.java # Type effectiveness calculations
│ └── resources/
│ └── application.properties # Application configuration
GET /api/pokemon
Returns all Pokémon in the database.
GET /api/pokemon/national/{nationalNumber}
GET /api/pokemon/{nationalNumber} (backward compatibility)
Returns a specific Pokémon by its National Pokédex number.
GET /api/pokemon/type/{type}
Returns all Pokémon that have the specified type. Available types: NORMAL, FIRE, WATER, ELECTRIC, GRASS, ICE, FIGHTING, POISON, GROUND, FLYING, PSYCHIC, BUG, ROCK, GHOST, DRAGON, DARK, STEEL, FAIRY.
GET /api/pokemon/origin-region/{region}
Returns all Pokémon that originated from the specified region. Available regions: KANTO, JOHTO, HOENN, SINNOH, UNOVA, KALOS, ALOLA, GALAR, PALDEA.
GET /api/pokemon/region/{region}
Returns all Pokémon that appear in the specified region's Pokédex.
GET /api/pokemon/region/{region}/{regionalNumber}
Returns a specific Pokémon by its regional Pokédex number. For example, Pikachu is #25 in Kanto but #22 in Johto.
The API supports all 18 Pokémon types with a complete type effectiveness system:
- NORMAL, FIGHTING, ROCK, GROUND, FLYING, BUG, GHOST, STEEL
- FIRE, WATER, ELECTRIC, GRASS, ICE, PSYCHIC, POISON, DRAGON, DARK, FAIRY
Each Pokémon automatically has calculated weaknesses and resistances based on their type(s):
- Super Efetivo (2x): Double damage
- Efetivo (1x): Normal damage
- Pouco Efetivo (1/2x): Half damage
- Sem Efeito (0x): No damage
For Pokémon with two types, effectiveness is calculated by multiplying the individual type effectiveness values:
- 2x × 2x = 4x (quadruple damage)
- 2x × 0.5x = 1x (normal damage)
- 0.5x × 0.5x = 0.25x (quarter damage)
- Java 17 or higher
- Gradle (or use the included wrapper)
# On Windows
.\gradlew.bat bootRun
# On Unix/Linux/Mac
./gradlew bootRungradle clean build
gradle bootRunThe application will start on http://localhost:8080
{
"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"nationalNumber": 1,
"name": "Bulbasaur",
"description": "Um Pokémon do tipo Grama/Veneno. Há uma semente nas costas desde o nascimento.",
"types": ["GRASS", "POISON"],
"originRegion": "KANTO",
"regionalEntries": [
{
"region": "KANTO",
"regionalNumber": 1
},
{
"region": "JOHTO",
"regionalNumber": 226
}
],
"weaknesses": {
"PSYCHIC": "Super Efetivo (2x)",
"FIRE": "Super Efetivo (2x)",
"ICE": "Super Efetivo (2x)",
"FLYING": "Super Efetivo (2x)"
},
"resistances": {
"FAIRY": "Pouco Efetivo (1/2x)",
"FIGHTING": "Pouco Efetivo (1/2x)",
"ELECTRIC": "Pouco Efetivo (1/2x)",
"GRASS": "Pouco Efetivo (1/2x)",
"WATER": "Pouco Efetivo (1/2x)"
}
}You can test the API using curl or any HTTP client:
# Get all Pokémon
curl http://localhost:8080/api/pokemon
# Get specific Pokémon by national number (Bulbasaur with type effectiveness)
curl http://localhost:8080/api/pokemon/national/1
# Get Pikachu with weaknesses and resistances
curl http://localhost:8080/api/pokemon/national/25
# Get all Fire-type Pokémon
curl http://localhost:8080/api/pokemon/type/FIRE
# Get all Pokémon from Kanto region
curl http://localhost:8080/api/pokemon/origin-region/KANTO
# Get all Pokémon that appear in Johto Pokédex
curl http://localhost:8080/api/pokemon/region/JOHTO
# Get Pokémon #22 in Johto Pokédex (which is Pikachu)
curl http://localhost:8080/api/pokemon/region/JOHTO/22- All Pokémon descriptions are in Portuguese
- Type effectiveness follows official Pokémon battle mechanics
- The type effectiveness calculator supports complex dual-type interactions
- Data initialization is separated from service logic for better maintainability
- Future updates can easily replace the hardcoded data with database or external API calls