A blazingly fast Rust API server that acts as a proxy to the PokeAPI, built with Axum and Tokio. Perfect for developers who want to integrate Pokémon data into their applications without directly hitting the external API.
- 🚀 High-performance async Rust server
- 🛡️ Error handling with custom API errors
- 📊 Proxy endpoints for Pokémon, types, abilities, moves, and evolution chains
- 🔍 Query parameters for pagination (limit/offset)
- 🐛 Comprehensive logging with tracing
- 🧪 Unit tests included
- 📦 Easy to deploy and run
git clone https://github.com/Ranaco/pokeapi.git
cd pokeapicargo buildThis will download and compile all necessary dependencies.
cargo runThe server will start on http://127.0.0.1:3000 by default.
Set the SERVER_ADDR environment variable:
SERVER_ADDR=0.0.0.0:8080 cargo runThe app uses tracing for logging. Set RUST_LOG for custom log levels:
RUST_LOG=pokeapi=debug,tower_http=debug cargo runAll endpoints proxy to PokeAPI v2. Responses are JSON objects matching the original API.
GET /api/v2/pokemon- List Pokémon (with optional?limit=20&offset=0)GET /api/v2/pokemon/{identifier}- Get specific Pokémon by ID or name
GET /api/v2/type- List types (with optional?limit=20&offset=0)GET /api/v2/type/{identifier}- Get specific type by ID or name
GET /api/v2/ability- List abilities (with optional?limit=20&offset=0)GET /api/v2/ability/{identifier}- Get specific ability by ID or name
GET /api/v2/move- List moves (with optional?limit=20&offset=0)GET /api/v2/move/{identifier}- Get specific move by ID or name
GET /api/v2/evolution-chain- List evolution chains (with optional?limit=20&offset=0)GET /api/v2/evolution-chain/{id}- Get specific evolution chain by ID
GET /health- Simple health check endpoint returning "OK"
# Get Pikachu
curl http://127.0.0.1:3000/api/v2/pokemon/pikachu
# List first 10 Pokémon
curl "http://127.0.0.1:3000/api/v2/pokemon?limit=10"
# Health check
curl http://127.0.0.1:3000/healthRun the unit tests:
cargo testNote: Integration tests are currently in src/tests/ and compile but don't run via cargo test. They can be moved to a top-level tests/ directory for full integration testing.
pokeapi/
├── src/
│ ├── main.rs # Server entry point
│ ├── routes.rs # Route definitions
│ ├── handlers/ # Request handlers
│ ├── client/ # PokeAPI HTTP client
│ ├── models/ # Data models (if any)
│ ├── errors.rs # Error types
│ ├── utils.rs # Utilities (tracing setup)
│ └── tests/ # Unit tests
├── Cargo.toml # Dependencies and metadata
└── README.md # This file
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, open an issue first to discuss what you would like to change.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- PokeAPI for the amazing Pokémon data
- Axum for the excellent web framework
- The Rust community for making async programming fun and efficient
Made with ❤️ and lots of ☕ by the Rust community.