Analyze NFL game momentum through play-by-play data visualization.
cd backend
# Create virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install dependencies
pip install -r requirements.txt
# Copy environment file and configure
cp .env.example .env
# Edit .env with your database credentials
# Run the server
uvicorn app.main:app --reload
cd frontend
# Install dependencies
npm install
# Run dev server
npm run dev
cd backend
# Load a specific season
python -m app.scripts.backfill --seasons 2024
# Or load last 5 years
python -m app.scripts.backfill --all-recent
GET /api/games/seasons - Get available seasons and weeksGET /api/games/{season}/{week} - Get games for a weekGET /api/games/game/{game_id} - Get game detailsGET /api/momentum/{game_id} - Get momentum dataGET /api/momentum/{game_id}/export/png - Download PNGGET /api/momentum/{game_id}/export/svg - Download SVGPOST /api/share/{game_id} - Create share linkGET /api/share/{share_code} - Get shared graphThe momentum score is calculated based on play-by-play events:
| Event | Points |
|---|---|
| Passing/Rushing TD | +15 |
| Defensive/Return TD | +25 |
| Interception | +12 |
| Fumble Lost | +10 |
| Sack | +5 |
| 4th Down Conversion | +5 |
| 4th Down Stop | +6 |
| Explosive Play (20+ yds) | +6 |
| Safety | +15 |
Decay: Momentum loses ~8% per play to reflect recency Streak Bonus: Consecutive positive events multiply momentum (up to 1.5x)
DATABASE_URL from Railway's PostgreSQLfrontendVITE_API_URL pointing to Railway backendMIT