Backend service for the Crypto Observability project, built with FastAPI. This API aggregates and exposes cryptocurrency market data (via CoinGecko) and is designed with clean architecture, strong typing, and production-ready practices.
- Python 3.11+
- FastAPI
- Uvicorn
- Pydantic
- HTTPX (external API client)
- JWT Authentication
- Redis (cache)
- PostgreSQL (optional, persistence)
- Pytest
- Ruff (linter)
- Black (formatter)
- direnv (optional, local environment automation)
- Fetch and normalize crypto market data
- Measure external API performance (latency, errors, availability)
- Expose secure endpoints for a frontend dashboard
- Handle authentication and authorization via JWT
- Provide a clean, production-ready backend architecture
- Python 3.11+
pip- direnv (optional but recommended for local development)
⚠️ This repository includes a versioned.envrcfile. If you havedirenvinstalled, you only need to rundirenv allowonce.
This project uses direnv with layout python3 to automatically create,
activate, and deactivate a Python virtual environment.
The virtual environment lifecycle is handled by direnv when entering or leaving the project directory.
The .envrc file is already versioned in this repository.
Install direnv (Ubuntu):
sudo apt install direnvEnsure the direnv hook is enabled in your shell (.bashrc).
After cloning the repository, run:
direnv allowFrom this point on:
- Entering the project directory automatically creates and activates a virtual environment
- Leaving the directory automatically deactivates it
- No manual virtual environment creation is required
If you prefer not to use direnv, you can manage the virtual environment manually:
python3.11 -m venv .venv
source .venv/bin/activateIn this case, you can safely ignore the
.envrcfile.
pip install -e ".[dev]"To reduce 429 Too Many Requests responses, configure one of the following:
COINGECKO_PRO_API_KEY(preferred when available)COINGECKO_DEMO_API_KEY
Example:
export COINGECKO_DEMO_API_KEY="your-demo-key"If both are set, the API uses COINGECKO_PRO_API_KEY.
uvicorn app.main:app --reloadAPI will be available at:
http://127.0.0.1:8000
Interactive docs:
- Swagger UI:
/docs - ReDoc:
/redoc
ruff check .
black .pytestThis project follows Conventional Commits:
feat:new featuresfix:bug fixeschore:tooling / maintenancerefactor:code refactorstest:tests only
MIT