Backend service for the CryptoTracker app — a cryptocurrency tracker with up-to-date prices, changes, and charts.
- FastAPI: Modern, fast web framework for building APIs with automatic docs generation
- Python 3.10+: Primary programming language
- CoinGecko API: Source for cryptocurrency data
- Docker: Containerization of the application
- Python 3.10+
- pip
# Clone the repository
git clone https://github.com/yourusername/cryptotracker.git
cd cryptotracker/backend
# Create virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install dependencies
pip install -r requirements.txtCreate a .env file in the backend root directory:
COINGECKO_API_KEY=your_api_key# Create virtual environment
python -m venv .venv
# Activate virtual environment (if not activated yet)
source .venv/bin/activate # On Windows: venv\Scripts\activate
# Run dev server
uvicorn main:app --reload --port 5174# Build Docker image
docker build -t cryptotracker-backend .
# Run Docker container
docker run -p 5174:5174 -d cryptotracker-backendGET /bitcoin
Returns current Bitcoin price.
Example response:
{
"price": "48000.25"
}GET /bitcoin/change
Returns 24h percentage price change for Bitcoin.
Example response:
{
"change": 2.45
}GET /bitcoin/chart
Returns data for Bitcoin price chart.
Example response:
{
"chart": {
"data": [40000, 41200, 40800, 42100, 41900, 43000, 42600, 43240]
}
}GET /monero
Returns current Monero price.
GET /monero/change
Returns 24h percentage price change for Monero.
GET /monero/chart
Returns data for Monero price chart.
GET /toncoin
Returns current Toncoin price.
GET /toncoin/change
Returns 24h percentage price change for Toncoin.
GET /toncoin/chart
Returns data for Toncoin price chart.
GET /docs
FastAPI automatically generates interactive Swagger UI documentation.