Deployment Quick Reference Card
π― 2-Step Deployment Summary
Step 1: Backend (HF Spaces)
git remote add hf https://huggingface.co/spaces/YOUR_USERNAME/rescored
git lfs pull
git push hf main
Step 2: Frontend (Vercel)
π Connection Flow
User Browser
β
[Vercel Frontend] β--HTTP REST-β [HF Spaces Backend]
β
React App β--WebSocket-β FastAPI + Python ML
https://your-project.vercel.app
https://YOUR_USERNAME-rescored.hf.space
βοΈ Key Configuration
| Component |
Default |
Example |
| Frontend URL |
Vercel auto |
https://rescored.vercel.app |
| Backend URL |
HF Spaces auto |
https://user-rescored.hf.space |
| API Port |
7860 |
Set by HF Spaces |
| Device |
CPU |
Auto-detected |
| Redis |
In-memory |
memory:// |
π Required Files
| File |
Purpose |
Status |
vercel.json |
Vercel config |
β
Created |
backend/Dockerfile.hf |
HF Spaces image |
β
Created |
.env.hf.example |
Backend env template |
β
Created |
frontend/.env.example |
Frontend env template |
β
Exists |
.github/workflows/deploy-hf.yml |
Auto-deploy (optional) |
β
Created |
β±οΈ Timeline
| Step |
Time |
Action |
| 1 |
5 min |
Create HF Spaces, push code |
| 2 |
10 min |
Docker builds on HF |
| 3 |
2 min |
Create Vercel, connect GitHub |
| 4 |
2 min |
Add env var, deploy |
| 5 |
3 min |
Test endpoint |
| Total |
~22 min |
Full deployment |
π¨ Critical Steps (Don't Skip!)
- β
git lfs pull before pushing to HF
- β
Port 7860 for HF Spaces (don't change)
- β
CORS origins include
*.vercel.app
- β
VITE_API_URL env var on Vercel
- β
Test
/health endpoint after deploy
π§ͺ Test Checklist
β‘ Backend health: curl https://YOUR_USERNAME-rescored.hf.space/health
β‘ Frontend loads: Visit https://your-project.vercel.app
β‘ API works: Submit a job from frontend
β‘ WebSocket: Check browser console for "Connected"
β‘ Job completes: Wait ~15-20 min for result
β‘ Download works: Verify MIDI/score download
π If Something Goes Wrong
| Error |
Fix |
CORS error |
Restart HF Space, check CORS_ORIGINS env var |
Git LFS failed |
Run git lfs pull again before push |
Vercel build failed |
Check build logs, ensure npm install --legacy-peer-deps |
WebSocket timeout |
Space is hibernating (wait 30 sec for first request) |
Port issues |
HF Spaces requires port 7860 (hardcoded in Dockerfile.hf) |
π° Cost Breakdown
Vercel Frontend: $0/month
HF Spaces Backend: $0/month
---
Total: $0/month π
Scaling later?
- HF Spaces Pro: ~$7/mo (no hibernation)
- Vercel Pro: ~$20/mo (custom domain)
π Documentation Map
START HERE βββ DEPLOYMENT_README.md
βββ QUICKSTART_DEPLOY.md (5 min)
βββ DEPLOYMENT_CHECKLIST.md (10 min)
βββ DEPLOYMENT.md (20+ min, detailed)
βββ This file (quick reference)
π΅ You're Ready!
Pick your guide:
- 5 min? β QUICKSTART_DEPLOY.md
- 10 min? β DEPLOYMENT_CHECKLIST.md
- Full details? β DEPLOYMENT.md
All paths lead to the same working deployment! π