How cbrennan18/fpl-pulse works
Purpose and Entry Points
FPL Pulse is a client-side React application that turns Fantasy Premier League data into league dashboards, awards, and a season “Wrapped” recap. Vite boots the app from index.html through src/main.jsx; src/App.jsx selects the top-level experience. Shared shell/navigation is centered on src/components/BaseLayout.jsx and src/components/TopBar.jsx.
Application Surfaces
The product has three principal UI flows:
• Landing/onboarding: src/features/landing/Landing.jsx.
• Home and league browsing: src/features/home/HomepageContainer.jsx, src/features/league/LeagueListContainer.jsx, and src/features/league/LeagueViewContainer.jsx.
• Pulse Wrapped season recap: src/features/pulse/wrapped/WrappedContainer.jsx and src/features/pulse/wrapped/WrappedScreen.jsx.
Container components are likely the boundary between data acquisition/state assembly and presentational views; corresponding Homepage.jsx, LeagueList.jsx, and LeagueView.jsx render the assembled models.
Data Access and Domain Transformation
The frontend’s API boundary is src/utils/api.js, with shared domain constants in src/utils/constants.js. League data is normalized for UI and calculations in src/features/league/transformBlobData.js; league behavior/configuration is centralized in src/features/league/leagueConfig.js.
This establishes a flow of external FPL-oriented source data → API utility → feature-level transformation/configuration → containers → visual components. No backend service or server runtime is present in the repository.
League Analytics and Awards
League views combine standings, stat summaries, medals, rankings, and award outputs through src/features/league/LeagueView.jsx, src/features/league/MedalTable.jsx, and src/features/league/FullRankingSheet.jsx. Award rules are discrete calculation modules coordinated by src/features/league/awards/index.js, including scoring, transfer, chip, and bi-monthly categories.
Awards can be rendered as exportable graphics using the isolated sharing pipeline in src/features/league/awards-share/GwAwardsPreview.jsx, src/features/league/awards-share/HiddenStage.jsx, and src/features/league/awards-share/exportImage.js. This separates on-screen award presentation from offscreen image capture/export.
Wrapped Recap Pipeline
Wrapped has an explicit front door, loading state, recap, and share path: src/features/pulse/wrapped/frontdoor/Cover.jsx, src/features/pulse/wrapped/loading/BuildingSeason.jsx, src/features/pulse/wrapped/recap/RecapCarousel.jsx, and src/features/pulse/wrapped/share/WrappedHiddenStage.jsx.
src/features/pulse/wrapped/PackContext.js and src/features/pulse/wrapped/usePack.js provide the shared season/league data pack to the experience. User flow is selection of league/roster, pack construction, sequential beat navigation, then optional card generation and sharing.
Recap Computation and Story Rendering
Pure analytics are organized by recap topic under src/features/pulse/wrapped/calc/, such as captain.js, luckVsSkill.js, and leagueLegacy.js. Their outputs drive corresponding visual “beats” in src/features/pulse/wrapped/beat/, including CaptainBeat.jsx, LuckSkillBeat.jsx, and LegacyPositionChart.jsx.
src/features/pulse/wrapped/beat/useBeatNavigation.js controls progression between beats. The architecture separates deterministic metric computation from animated narrative presentation, making calculations independently testable and reusable by recap and share cards.
Share Cards and Runtime Infrastructure
Wrapped sharing maps beats to purpose-built card renderers through src/features/pulse/wrapped/share/beatCardRegistry.js; representative cards live in src/features/pulse/wrapped/share/cards/B2CaptainCard.jsx and src/features/pulse/wrapped/share/cards/B10RaceCard.jsx. useShareCard.js coordinates card selection/export behavior.
The app runs as a static Vite build using React 19, Tailwind CSS, Chart.js/react-chartjs-2, and Framer Motion. Deployment is GitHub Pages-oriented, with the static fallback at public/404.html. A generated rating lookup artifact, src/features/pulse/utils/ae64-field-v1.json, is built by scripts/build-ae64-field.mjs.
Main entry points: App.jsx App router · LeagueViewContainer.jsx League view container · LeagueView.jsx League dashboard · api.js FPL API boundary
Components 24
App shell
- Vite entry · Bootstraps the static React application.
index.html - React mount
src/main.jsx - App router · Selects the active product experience.
src/App.jsx - Shared layout
src/components/BaseLayout.jsx - FPL API boundary · Fetches external FPL-oriented source data.
src/utils/api.js - Landing
src/features/landing/Landing.jsx
League dashboards
- Home container
src/features/home/HomepageContainer.jsx - League list container
src/features/league/LeagueListContainer.jsx - League view container · Assembles league data and view models.
src/features/league/LeagueViewContainer.jsx - League normalization
src/features/league/transformBlobData.js - League configuration
src/features/league/leagueConfig.js - League dashboard · Combines standings, statistics, medals, and rankings.
src/features/league/LeagueView.jsx - Award calculations · Coordinates scoring, transfer, chip, and bi-monthly awards.
src/features/league/awards/index.js - Rankings and medals
src/features/league/FullRankingSheet.jsx - Award image export · Captures offscreen award graphics for export.
src/features/league/awards-share/exportImage.js
Pulse Wrapped
- Wrapped front door · Starts league or roster selection and recap loading.
src/features/pulse/wrapped/WrappedContainer.jsx - Season data pack · Provides constructed season and league data to Wrapped.
src/features/pulse/wrapped/PackContext.js - Wrapped screen · Hosts loading, recap, and sharing states.
src/features/pulse/wrapped/WrappedScreen.jsx - Recap carousel · Presents sequential seasonal story beats.
src/features/pulse/wrapped/recap/RecapCarousel.jsx - Beat navigation
src/features/pulse/wrapped/beat/useBeatNavigation.js - Recap calculations · Topic-based deterministic metrics drive recap and cards.
src/features/pulse/wrapped/calc/captain.js - Share card registry · Maps recap beats to specialized share cards.
src/features/pulse/wrapped/share/beatCardRegistry.js - Wrapped share stage · Renders cards offscreen for generation and sharing.
src/features/pulse/wrapped/share/WrappedHiddenStage.jsx - Rating lookup · Generated by the AE64 field build script.
src/features/pulse/utils/ae64-field-v1.json
Connections 28
- Vite entry → React mount: loads
- React mount → App router: mounts
- App router → Shared layout: uses
- App router → Landing: routes to
- App router → Home container: routes to
- App router → League list container: routes to
- App router → League view container: routes to
- App router → Wrapped front door: routes to
- FPL API boundary → Home container: supplies data
- FPL API boundary → League list container: supplies data
- FPL API boundary → League view container: supplies data
- League view container → League normalization: normalizes with
- League configuration → League view container: configures
- League normalization → League dashboard: builds model for
- League view container → League dashboard: renders
- Award calculations → League dashboard: provides awards
- Rankings and medals → League dashboard: provides rankings
- League dashboard → Award image export: exports awards
- FPL API boundary → Wrapped front door: supplies source data
- Wrapped front door → Season data pack: constructs
- Season data pack → Wrapped screen: provides
- Wrapped screen → Recap carousel: shows
- Recap calculations → Recap carousel: drives beats
- Rating lookup → Recap calculations: enriches metrics
- Beat navigation → Recap carousel: advances
- Recap carousel → Share card registry: selects beat card
- Recap calculations → Share card registry: reuses metrics
- Share card registry → Wrapped share stage: renders selected card