How hermesfu/cpbl-fantasy works
CPBL Fantasy is a web fantasy-baseball application for managing leagues, teams, rosters, player data, and matchups. Users enter through the React app, navigate to player, team, and matchup views, and those views call Flask endpoints that read or update MongoDB-backed records. Matchup totals are calculated by the matchup endpoint using player search results. The excerpts establish several UI-to-API and backend relationships; scraper behavior and some route wiring are not shown, so those links are omitted.
Main entry points: __init__.py Blueprint registration · App.jsx Page routing · player.py Player search and data · Players.jsx Player search
Components 21
Web application
- React app
frontend/src/main.jsx - Page routing
frontend/src/App.jsx - Login view
frontend/src/pages/Login.jsx - Registration view
frontend/src/pages/Register.jsx - Success view
frontend/src/pages/Success.jsx - Player search
frontend/src/pages/Players.jsx - Team roster view
frontend/src/pages/Team.jsx - Matchup view
frontend/src/pages/Matchup.jsx
League and teams
- Flask server
backend/server.py - Blueprint registration
backend/routes/__init__.py - User endpoints
backend/routes/user.py - League settings
backend/routes/league.py - Team operations
backend/routes/team.py - Roster requirements
backend/routes/requirement.py
Players and rosters
- Roster operations
backend/routes/roster.py - Player search and data
backend/routes/player.py - Matchup totals
backend/routes/matchup.py
Player data ingestion
- Batter scraper
backend/webscraping/scrape_batter.py - Pitcher scraper
backend/webscraping/scrape_pitcher.py
Other components
- Fantasy user
- MongoDB
Connections 35
- Fantasy user → React app: uses
frontend/src/main.jsx - React app → Page routing: renders
frontend/src/main.jsx - Page routing → Login view: routes to
frontend/src/App.jsx - Page routing → Registration view: routes to
frontend/src/App.jsx - Page routing → Success view: routes to
frontend/src/App.jsx - Page routing → Player search: routes to
frontend/src/App.jsx - Page routing → Team roster view: routes to
frontend/src/App.jsx - Page routing → Matchup view: routes to
frontend/src/App.jsx - Flask server → Blueprint registration: registers
backend/server.py - Blueprint registration → User endpoints: registers
backend/routes/__init__.py - Blueprint registration → Player search and data: registers
backend/routes/__init__.py - Blueprint registration → League settings: registers
backend/routes/__init__.py - Blueprint registration → Team operations: registers
backend/routes/__init__.py - Blueprint registration → Roster requirements: registers
backend/routes/__init__.py - Blueprint registration → Roster operations: registers
backend/routes/__init__.py - Blueprint registration → Matchup totals: registers
backend/routes/__init__.py - Player search → Player search and data: requests data
frontend/src/pages/Players.jsx - Player search → League settings: requests settings
frontend/src/pages/Players.jsx - Player search → Team operations: requests team
frontend/src/pages/Players.jsx - Player search → Roster operations: adds players
frontend/src/pages/Players.jsx - Team roster view → Team operations: requests team
frontend/src/pages/Team.jsx - Team roster view → League settings: requests categories
frontend/src/pages/Team.jsx - Team roster view → Player search and data: requests players
frontend/src/pages/Team.jsx - Team roster view → Roster operations: changes roster
frontend/src/pages/Team.jsx - Matchup view → Matchup totals: requests matchup
frontend/src/pages/Matchup.jsx - Matchup view → Team operations: requests team
frontend/src/pages/Matchup.jsx - Matchup view → Roster operations: requests roster
frontend/src/pages/Matchup.jsx - Matchup view → Player search and data: requests players
frontend/src/pages/Matchup.jsx - Matchup totals → Player search and data: fetches player data
backend/routes/matchup.py - League settings → MongoDB: reads and writes
backend/routes/league.py - Team operations → MongoDB: reads and writes
backend/routes/team.py - Roster requirements → MongoDB: reads and writes
backend/routes/requirement.py - Roster operations → MongoDB: reads and writes
backend/routes/roster.py - Player search and data → MongoDB: reads
backend/routes/player.py - Matchup totals → MongoDB: reads and writes
backend/routes/matchup.py