A web application that aggregates fantasy baseball data from multiple sources, integrates with your ESPN league, and provides intelligent draft recommendations powered by risk analysis, position scarcity tracking, and Monte Carlo simulations.
- Multi-Source Data Aggregation: Rankings from FantasyPros, ESPN, FanGraphs with consensus metrics
- Smart Recommendations: Position-aware picks based on risk scores, category needs, and scarcity
- Live Draft Tracking: Real-time ESPN sync with full undo/redo history
- Prospect Evaluation: Scouting grades (20-80 scale), keeper values, and bust rate analysis
Before installing, make sure you have the following:
- Mac: Download from python.org/downloads or install via Homebrew:
brew install python - Linux: Most distros include Python. If not:
sudo apt install python3(Ubuntu/Debian) orsudo dnf install python3(Fedora) - Windows: Download the installer from python.org/downloads. During installation, check "Add Python to PATH".
To verify Python is installed, open a terminal and run:
python3 --version # Mac/Linux
py --version # Windows
Only needed if you want to clone the repository. Otherwise you can download a ZIP instead.
- Mac:
brew install gitor install Xcode Command Line Tools:xcode-select --install - Linux:
sudo apt install gitorsudo dnf install git - Windows: Download from git-scm.com
No other technical knowledge is required. The app runs entirely on your computer — no cloud account needed.
Option A — Git clone (recommended):
git clone https://github.com/drFrankWhite/FantasyBaseball.git
cd FBBOption B — Download ZIP:
- Click the green "Code" button on GitHub → "Download ZIP"
- Extract the ZIP file
- Open a terminal and navigate to the extracted folder
- Mac: Press
Cmd + Space, typeTerminal, press Enter - Linux: Right-click the desktop → "Open Terminal" (varies by distro)
- Windows: Press
Win + R, typepowershell, press Enter (or search "PowerShell" or "Command Prompt" in the Start menu)
# Mac / Linux
cd /path/to/FBB/backend
# Windows (PowerShell or Command Prompt)
cd C:\path\to\FBB\backendReplace /path/to/FBB with wherever you cloned or extracted the files.
# Mac / Linux
pip3 install -e .
# Windows
py -m pip install -e .Note: On some Macs,
pipandpythonrefer to Python 2. Always usepip3andpython3on Mac/Linux to ensure you're using Python 3.
# Mac / Linux
python3 run.py
# Windows
py run.pyYou should see output like:
INFO: Uvicorn running on http://0.0.0.0:8000
Leave this terminal window open while you use the app.
Navigate to http://localhost:8000
Click the "Refresh Data" button in the app. This fetches the latest rankings, projections, and player data from all sources. It may take 30–60 seconds on first run.
The app will automatically set up your league on first launch using the
DEFAULT_LEAGUE_IDfrom your.envfile.
To sync with your private ESPN league, the app needs two authentication cookies from your browser.
- Log in to ESPN Fantasy in your browser
- Open Developer Tools: press
F12(Windows/Linux) orCmd + Option + I(Mac) - Go to Application → Storage → Cookies →
https://www.espn.com - Copy the values for
espn_s2andSWID - Create a
.envfile inside thebackend/folder:
ESPN_S2=your_espn_s2_cookie_value
SWID=your_swid_cookie_valueIf you use Google Chrome, the app can import your ESPN credentials automatically — no Developer Tools required:
- Make sure you're logged in to ESPN Fantasy in Chrome
- In the app, click "Import from Chrome" in the League Settings panel
- The app uses rookiepy to read cookies directly from your Chrome profile
Note: rookiepy must be installed separately:
pip3 install rookiepy
Five recommendation types tailored to your draft situation:
| Type | Description |
|---|---|
| Safe Picks | High consensus, low injury risk, proven players (risk score < 30) |
| Risky Picks | High upside with concerns - injury history, ranking variance (risk score > 60) |
| Needs-Based | Players addressing your weak categories (R, HR, RBI, SB, AVG, etc.) |
| Prospect Picks | Top prospects with scouting grades, ETA, and keeper value |
| Position-Aware | Factoring in scarcity and your roster composition |
Full keeper-league workflow built in:
- Keeper Tracking: Store and manage keepers per league, with per-team assignment
- Keeper Value Recommendations: Each keeper candidate is graded using prospect scores, positional scarcity, and surplus value — so you know which players are worth keeping vs. releasing
- Auto-Load into Draft Sessions: When a draft session starts, all confirmed keepers are automatically marked as drafted, so recommendations reflect the real available pool from pick 1
- Add/Remove Keepers: Add or remove keepers from the UI; draft state syncs immediately to reflect the change
Value Over Replacement Player (VORP) calculation for every eligible player:
- Surplus Value: Positive means above replacement, negative means below — calculated per position, not against a global average
- Sortable Column: The player list includes a VORP/Surplus column that can be sorted to find the highest-value available player at any position
Side-by-side comparison of any two players:
- Full Stat Breakdown: Projections, risk scores, ADP, ECR, and positional scarcity side by side
- Risk Factor Comparison: Each of the six risk factors shown for both players so you can see exactly where the difference comes from
- Access Points: Open the comparison tool from any player's detail modal, or select two players from the main list
Save private scouting notes for any player:
- Per-Player Notes: Write and save notes (e.g., "targeting in round 5", "injury concern — monitor camp") that persist across sessions
- Export: Download all notes as JSON or CSV for offline use or sharing with leaguemates
- Import: Upload a notes file to restore notes from a backup or import from another device
- Persistent Storage: Notes are saved to the local SQLite database and survive app restarts
An achievement system to reward smart drafting decisions:
| Achievement | Trigger |
|---|---|
| First Pick | Complete your first draft pick |
| Ace Acquired | Draft a top-5 SP in rounds 1–4 |
| Hidden Gem | Draft a player ranked 30+ spots better than their ADP |
| Needs Met | Fill all category needs in a single draft |
| Safe Harbor | Draft 5+ consecutive safe picks (risk < 30) |
Achievements are displayed as pop-up toasts during the draft and logged in your session history.
Full-text player search with:
- Accent Folding: Search for "Jose" and find "José" — diacritics are normalized automatically
- Hyphen Normalization: "De La Cruz" and "DeLaCruz" both match "De La Cruz"
- Keyboard Shortcuts: Use keyboard shortcuts to jump to search, clear filters, and navigate results without touching the mouse
Full draft tracking with history:
- Session Control: Start/end sessions with draft type (snake/linear) configuration
- Undo/Redo: Full action history with reversible picks
- Pick History: Complete audit trail with timestamps
- Draft Board: Visual representation by round and team
- Auto-Sync: Continuous ESPN synchronization during live drafts
Players are scored across six factors — ranking variance, injury history, experience, projection variance, age risk, and ADP vs ECR — and classified as Safe (< 30), Moderate (30–60), or Risky (> 60).
Dynamic scarcity tracking that adjusts throughout the draft as positions are filled. Catcher and shortstop are weighted most heavily as the shallowest positions; relief pitching and first base the least. Roster need is factored in per position based on your unfilled slots.
Each player is assigned a tier badge based on their position rank:
| Tier | Description |
|---|---|
| Elite | Top-tier, first-round caliber |
| Great | Solid starter, typically rounds 2–4 |
| Good | Reliable contributor |
| Average | Depth piece or streamer |
| Below Average | Risky or positional filler |
| Leftover | End-of-bench or speculative |
Tier badges appear on player cards and are filterable in the player list.
Comprehensive prospect analysis with:
Scouting Grades (20-80 scale):
- Hit, Power, Speed, Arm, Field tools
- Future Value (overall ceiling)
Keeper Value Classification:
- Elite (≥ 85): Top-tier dynasty asset
- High (≥ 65): Strong keeper candidate
- Medium (≥ 45): Solid depth
- Low (< 45): Speculative
Predict player availability at your next pick using statistical simulation. Each player returns a probability and one of three verdicts: Likely Available, Risky, or Unlikely.
Identify sleepers and bust risks based on the gap between ADP and expert consensus rankings:
| Classification | Description |
|---|---|
| Sleeper | Being drafted later than experts suggest |
| Bust Risk | Being drafted earlier than warranted |
| Fair Value | ADP and ECR aligned |
H2H category tracking for 12 categories:
- Batting: R, HR, RBI, SB, AVG, OPS
- Pitching: K, QS, W, SV, ERA, WHIP
Features:
- Team strength calculation vs league targets
- Category need prioritization (high/medium/low)
- Pick impact simulation (before/after)
- Specialist identification (SB ≥ 15, HR ≥ 25, K ≥ 150)
| Endpoint | Method | Description |
|---|---|---|
/api/v1/recommendations/{league_id} |
GET | Full recommendations (safe, risky, needs, prospects) |
/api/v1/recommendations/{league_id}/safe |
GET | Safe picks only (optional position filter) |
/api/v1/recommendations/{league_id}/risky |
GET | Risky picks with upside descriptions |
/api/v1/recommendations/{league_id}/needs |
GET | Category needs analysis |
/api/v1/recommendations/{league_id}/simulate |
POST | Simulate pick impact on categories |
| Endpoint | Method | Description |
|---|---|---|
/api/v1/draft/session/start |
POST | Start new session (name, teams, position, type) |
/api/v1/draft/session/end |
POST | End active session |
/api/v1/draft/session/active |
GET | Get current active session |
/api/v1/draft/session/pick |
POST | Make a draft pick |
/api/v1/draft/session/undo |
POST | Undo last pick |
/api/v1/draft/session/redo |
POST | Redo undone pick |
/api/v1/draft/session/history |
GET | Get pick history |
/api/v1/draft/session/board |
GET | Get draft board by round/team |
| Endpoint | Method | Description |
|---|---|---|
/api/v1/draft/{league_id}/board |
GET | Current draft state |
/api/v1/draft/{league_id}/picks |
GET | All picks (optional round filter) |
/api/v1/draft/{league_id}/draft-status |
GET | Draft progress summary |
/api/v1/draft/{league_id}/manual-pick |
POST | Record manual pick |
/api/v1/draft/{league_id}/sync |
POST | Sync from ESPN |
/api/v1/draft/{league_id}/auto-sync |
POST | Continuous auto-sync |
| Endpoint | Method | Description |
|---|---|---|
/api/v1/players |
GET | List with filters (position, available, sort) |
/api/v1/players/search |
GET | Search by name |
/api/v1/players/{id} |
GET | Full player detail |
/api/v1/players/{id}/rankings |
GET | All rankings across sources |
/api/v1/players/{id}/news |
GET | Recent news |
/api/v1/players/{id}/pick-prediction |
GET | Monte Carlo availability |
/api/v1/players/{id}/risk-assessment |
GET | Detailed risk breakdown |
/api/v1/players/{id}/draft |
POST | Mark as drafted |
/api/v1/players/{id}/undraft |
POST | Undo draft |
/api/v1/players/value-classifications |
GET | Sleeper/bust classifications |
/api/v1/players/my-team/roster |
GET | User's drafted players |
/api/v1/players/reset-draft |
POST | Reset draft state (requires confirm=true) |
| Endpoint | Method | Description |
|---|---|---|
/api/v1/leagues |
GET | List connected leagues |
/api/v1/leagues |
POST | Add new league |
/api/v1/leagues/{id} |
GET | League details with teams |
/api/v1/leagues/{id} |
DELETE | Remove league |
/api/v1/leagues/{id}/credentials |
POST | Update ESPN credentials |
/api/v1/leagues/{id}/teams |
GET | All teams |
/api/v1/leagues/{id}/sync |
POST | Force ESPN sync |
/api/v1/leagues/{id}/set-user-team/{team_id} |
POST | Set user's team |
| Endpoint | Method | Description |
|---|---|---|
/api/v1/data/sources |
GET | List data sources and status |
/api/v1/data/last-updated |
GET | Last refresh timestamp |
/api/v1/data/refresh |
POST | Full data refresh |
/api/v1/data/refresh/rankings |
POST | Rankings only |
/api/v1/data/refresh/projections |
POST | Projections only |
/api/v1/data/refresh/news |
POST | News only |
/api/v1/data/refresh/prospects |
POST | Prospect data (FanGraphs, MLB Pipeline) |
/api/v1/data/calculate-risk-scores |
POST | Recalculate all risk scores |
/api/v1/players/sync-rankings |
POST | Sync external rankings |
/api/v1/players/sync-adp |
POST | Sync ADP/ECR data |
/api/v1/players/sync-injuries |
POST | Sync injuries from ESPN |
See http://localhost:8000/docs for full interactive API documentation.
backend/
├── app/
│ ├── main.py # FastAPI application
│ ├── config.py # All configurable settings
│ ├── database.py # SQLite setup
│ ├── models/ # Database models
│ │ ├── player.py # Player, rankings, projections
│ │ ├── draft.py # DraftSession, DraftPickHistory
│ │ └── prospect.py # ProspectProfile, ProspectRanking
│ ├── schemas/ # Pydantic schemas
│ ├── api/v1/ # API endpoints
│ │ ├── players.py # Player CRUD, search, sync
│ │ ├── draft.py # Draft management, undo/redo
│ │ ├── recommendations.py # Smart recommendations
│ │ ├── leagues.py # League management
│ │ └── data.py # Data refresh endpoints
│ ├── services/
│ │ ├── espn_service.py # ESPN API integration
│ │ ├── recommendation_engine.py # Core recommendation logic
│ │ ├── category_calculator.py # H2H category analysis
│ │ ├── pick_predictor.py # Monte Carlo simulations
│ │ └── data_sync_service.py # Multi-source data fetching
│ └── static/ # Frontend files
# Run with auto-reload
cd backend
python run.py
# Run tests
pytest
# Format code
ruff format .| Source | Data Type |
|---|---|
| ESPN Fantasy API | League data, rosters, injuries, projections |
| FantasyPros | Expert Consensus Rankings (ECR), ADP |
| FanGraphs | Projections (Steamer, ZiPS, Depth Charts), prospects |
| MLB Pipeline | Prospect rankings, scouting grades |
| RotoWire | News RSS feed |
| NFBC | ADP data |
Default league settings:
- Format: 12-team H2H Categories
- Scoring Categories:
- Batting: R, HR, RBI, SB, AVG, OPS
- Pitching: K, QS, W, SV, ERA, WHIP
- Roster: C, 1B, 2B, 3B, SS, 3 OF, UTIL, 5 SP, 2 RP, 4 BE, 1 IL
- Draft: Snake format