2.5 KiB
2.5 KiB
MTG Online Backend - Handoff Prompt
Context
You are taking over the MTG Online Backend project. The project is a Python FastAPI application that integrates with MTGJSON API to provide Magic: The Gathering card data. The system downloads, processes, and stores MTGJSON datasets in PostgreSQL with a weekly refresh cycle.
Current Status
- ✅ All containers destroyed and Docker pruned
- ✅ Code is working - last tested successfully with 5.4M+ cards loaded
- ⏸️ Project paused - ready for handoff
Quick Start for New Thread
# 1. Read the handoff documentation
cat /home/wall-o/projects/mtgonline/HANDOFF.md
# 2. Check current state
cat /home/wall-o/projects/mtgonline/state.json
# 3. Rebuild and deploy
cd /home/wall-o/projects/mtgonline
docker build -t mtgonline_backend backend/
docker compose -p mtgonline up -d
# 4. Monitor startup
docker logs -f mtgonline_backend
Key Information
Location: /home/wall-o/projects/mtgonline
Last Commit: ad2742c - "Fix MTGJSON download: use .gz URLs and handle pre-uncompressed files"
Core Service: backend/app/services/mtgjson_manager.py
- Downloads MTGJSON data from
https://mtgjson.com/api/v5 - Handles both gzip-compressed and pre-uncompressed JSON files
- Upserts to PostgreSQL with
ON CONFLICT DO UPDATE - Weekly refresh cycle (7 days)
- Container marked unhealthy if data corrupted
Known Issues Fixed:
- MTGJSON URL scheme changed from
.jsonto.json.gz - Some files are pre-uncompressed (not actually gzipped)
- Large files need 60-minute download timeout
What to Do Next
- Rebuild and test the deployment
- Verify MTGJSON data loads correctly
- Review the codebase and make any needed improvements
- Consider:
- Incremental updates (vs full refresh)
- Better error handling
- Database optimization
- Monitoring and alerting
Important Files
HANOFOFF.md- Complete documentationstate.json- Project statebackend/app/services/mtgjson_manager.py- Core MTGJSON integrationdocker-compose.yml- Container orchestration.env- Configuration
State Tracking
Update state.json after each significant change:
{
"task_description": "...",
"current_step": "...",
"files_created": [...],
"files_modified": [...],
"decisions": [...],
"next_steps": [...],
"blockers": [...],
"commit_hash": "...",
"timestamp": ...
}
Git
- Credentials:
/home/wall-o/projects/gitea_credentials.txt - Commit after each milestone
- Push changes regularly