Currency exchange rate API built in Rust.
Lines of Code: ~15,000 | Binary Size: ~8MB
- Multi-Source Data: Aggregates rates from Frankfurter, fawazahmed0, CoinGecko, and CoinCap
- Cryptocurrency Support: BTC, ETH, and 15 other cryptocurrencies
- Precious Metals: XAU (gold), XAG (silver), XPT (platinum), XPD (palladium)
- Caching: Tiered cache (in-memory + SQLite) with configurable TTL
- Observability: Prometheus metrics, health checks, distributed tracing
- Rate Limiting: Token bucket rate limiting per client
- Authentication: Optional API key authentication
docker run -p 8080:8080 ghcr.io/e6qu/slowpokeapi:latestdocker-compose up -dgit clone https://github.com/e6qu/slowpokeapi.git
cd slowpokeapi
cargo build --release
./target/release/slowpokeapi| Endpoint | Description |
|---|---|
GET /v1/currencies |
List all supported currencies |
GET /v1/latest/{base_code} |
Latest rates for base currency |
GET /v1/pair/{base}/{target} |
Convert between two currencies |
GET /v1/history/{base}/{y}/{m}/{d} |
Historical rates for date |
GET /v1/enriched/{base}/{target} |
Rate with target metadata |
GET /health |
Health check |
GET /metrics |
Prometheus metrics |
curl http://localhost:8080/v1/latest/USD{
"base_code": "USD",
"conversion_rates": {
"EUR": 0.85,
"GBP": 0.73,
"JPY": 110.0
},
"documentation": "https://github.com/e6qu/slowpokeapi",
"result": "success",
"time_last_update_unix": 1640995200,
"time_next_update_unix": 1641081600,
"data_source": {
"source": "frankfurter",
"last_retrieved": "2024-01-01T00:00:00Z",
"last_cached": null,
"upstream_request": {
"endpoint": "https://api.frankfurter.app/latest?from=USD"
}
}
}Configuration is via environment variables with the prefix SLOWPOKEAPI__:
| Variable | Default | Description |
|---|---|---|
SLOWPOKEAPI__SERVER__PORT |
8080 | HTTP port |
SLOWPOKEAPI__DATABASE__URL |
sqlite::memory: | SQLite database path |
SLOWPOKEAPI__CACHE__TTL_SECONDS |
3600 | Cache TTL in seconds |
SLOWPOKEAPI__RATE_LIMIT__ENABLED |
true | Enable rate limiting |
SLOWPOKEAPI__AUTH__ENABLED |
false | Enable API key authentication |
See docs/DEPLOYMENT.md for complete configuration reference.
- Binary: Single static binary
- Docker: Multi-platform images
- Docker Compose: Stack with Prometheus and Grafana
- Kubernetes: Helm chart
- AWS ECS: Terraform modules
See docs/DEPLOYMENT.md for detailed deployment guides.
- Rust 1.75+
- SQLite 3
- Docker (optional)
cargo test --all-featurescargo fmt --check
cargo clippy --all-targets --all-features -- -D warnings ┌─────────────┐
│ Client │
└──────┬──────┘
│
▼
┌─────────────┐
│ Axum HTTP │
└──────┬──────┘
│
▼
┌─────────────┐
│ Handler │
└──────┬──────┘
│
┌──────────────────┼──────────────────┐
│ │ │
▼ ▼ ▼
┌─────────────┐ ┌─────────────┐ ┌─────────────┐
│ Tiered │ │ Rate Limiter│ │ Auth/Key │
│ Cache │ │ │ │ Storage │
│(Mem+SQLite) │ │ │ │ │
└──────┬──────┘ └─────────────┘ └─────────────┘
│
▼
┌─────────────┐
│ Upstream │
│ Manager │
└──────┬──────┘
│
┌────┴────┬────────┐
│ │ │
▼ ▼ ▼
┌──────┐ ┌──────┐ ┌──────┐
│Frank-│ │Coin- │ │Coin- │
│furter│ │Gecko │ │Cap │
└──────┘ └──────┘ └──────┘
- Deployment Guide - Installation and deployment options
- API Reference - Complete API documentation
- CHANGELOG.md - Version history
- Metrics: Prometheus metrics at
/metrics - Health: Health check at
/health - Grafana: Dashboard template in
deploy/grafana/ - Alerts: Prometheus alert rules in
deploy/prometheus/
Dual-licensed under AGPL-3.0 or MIT at your option. See LICENSE for details.
This project is a reimplementation developed independently based on publicly available information. It is not affiliated with or endorsed by RapidAPI.