Crypto Monitor Extended API - Hugging Face Spaces Deployment
This repository is configured to run as a Docker Space on Hugging Face.
π Quick Deploy to Hugging Face Spaces
- Create a new Space on Hugging Face
- Select Docker as the SDK
- Clone this repository or push it to your Space
- The Space will automatically build and deploy
π Configuration
Space Settings
- SDK: Docker
- Hardware: CPU Basic (or higher for better performance)
- Visibility: Public or Private (your choice)
Environment Variables (Optional)
You can set these in your Space settings under "Repository secrets":
PORT- Port number (default: 7860 for HF Spaces)ENABLE_AUTO_DISCOVERY- Enable auto-discovery service (default: false)
π§ Technical Details
Main Application
The FastAPI application is defined in api_server_extended.py and exposes:
- Main API:
http://your-space.hf.space/ - API Docs:
http://your-space.hf.space/docs - Health Check:
http://your-space.hf.space/health - WebSocket:
ws://your-space.hf.space/ws
Features
β Provider Management - Manage 200+ crypto data providers β Pool Management - Create and manage provider pools with rotation strategies β Real-time WebSocket - Live updates and monitoring β Health Monitoring - Automatic health checks for all providers β Auto-Discovery - Discover new crypto data sources automatically β Diagnostics - Built-in diagnostics and auto-repair β Logging - Comprehensive logging system β Resource Management - Import/export provider configurations
API Endpoints
Core Endpoints
GET /- Main dashboardGET /health- Health checkGET /api/status- System statusGET /api/stats- Statistics
Provider Management
GET /api/providers- List all providersGET /api/providers/{id}- Get provider detailsPOST /api/providers/{id}/health-check- Check provider healthGET /api/providers/category/{category}- Get providers by category
Pool Management
GET /api/pools- List all poolsPOST /api/pools- Create new poolPOST /api/pools/{id}/members- Add member to poolPOST /api/pools/{id}/rotate- Rotate pool
WebSocket
WS /ws- WebSocket connection for real-time updates
See /docs for complete API documentation.
ποΈ Local Development
Using Docker
# Build the image
docker build -t crypto-monitor .
# Run the container
docker run -p 8000:8000 crypto-monitor
Using Python directly
# Install dependencies
pip install -r requirements.txt
# Run the server
python main.py
Or with uvicorn directly:
uvicorn api_server_extended:app --host 0.0.0.0 --port 8000 --reload
π Monitoring
Once deployed, you can monitor your Space:
- Check the Logs tab in your Space
- Visit
/healthendpoint for health status - Visit
/api/statusfor detailed system status - Use
/docsfor interactive API documentation
π Troubleshooting
Space not starting?
- Check the Logs tab for error messages
- Verify all required files are present
- Ensure
api_server_extended.pydefinesapp = FastAPI(...) - Check that all dependencies in
requirements.txtare valid
Health check failing?
The health check runs after 40 seconds of startup. If it fails:
- Increase
start-periodin Dockerfile HEALTHCHECK - Check if the app is listening on the correct PORT
- Verify
/healthendpoint returns 200 OK
Performance issues?
- Upgrade to better hardware (CPU or GPU)
- Disable auto-discovery: Set
ENABLE_AUTO_DISCOVERY=false - Reduce the number of providers being monitored
π Notes
- The application uses no API keys by default - all data sources are free
- SQLite database is used for persistence (stored in
/app/data/) - Logs are stored in
/app/logs/ - The app runs in degraded mode if some providers are unavailable
- WebSocket connections are supported for real-time updates
π€ Support
For issues or questions:
- Check the
/api/diagnostics/runendpoint for automatic diagnostics - Review logs in the Hugging Face Space logs tab
- Check the
/healthendpoint for system status
π License
See LICENSE file for details.