# dpwrz/powers-newlon architecture

> Architecture diagram of the GitHub repository dpwrz/powers-newlon, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/dpwrz/powers-newlon
- Repository: https://github.com/dpwrz/powers-newlon

## Overview

Fantasy Model is an NFL fantasy projection and dynasty decision product, with a browser-based league and decision interface. The user workflow is to load a Sleeper league, combine league context with model projections, and use weekly or dynasty tools to make decisions. Its model side includes position-specific projections and forward-only live updates; the web side presents these alongside scoring, Start/Sit, and league tools. Source inspection was limited to the README and web excerpts, so relationships among unsampled model engines are shown only as unverified where useful.

Main entry points: [`web/src/main.js`](https://github.com/dpwrz/powers-newlon/blob/main/web/src/main.js) (Web application), [`R/weekly_engine.R`](https://github.com/dpwrz/powers-newlon/blob/main/R/weekly_engine.R) (Weekly projections), [`R/live_refresh_engine_31.R`](https://github.com/dpwrz/powers-newlon/blob/main/R/live_refresh_engine_31.R) (Forward-only refresh), [`web/src/boot.js`](https://github.com/dpwrz/powers-newlon/blob/main/web/src/boot.js) (Snapshot bootstrap)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web experience"]
  node_browser["Web application<br/>[main.js]"]
  node_bootstrap["Snapshot bootstrap<br/>[boot.js]"]
end

subgraph group_league["League context"]
  node_sleeper["Sleeper service"]
  node_espn["NFL scoreboard"]
  node_identity["Player identity<br/>[player_identity.R]"]
  node_league_engine["League engine<br/>[league_engine.R]"]
  node_scoring["League scoring"]
end

subgraph group_model["Projection system"]
  node_snapshot["Model snapshot"]
  node_weekly["Weekly projections<br/>[weekly_engine.R]"]
  node_weekly_feedback["Forecast error feedback"]
  node_live_state["Live game state"]
  node_live_refresh["Forward-only refresh"]
  node_quality["Data quality"]
  node_opportunity["Opportunity modeling"]
end

subgraph group_decisions["Decision tools"]
  node_dynasty["Dynasty values"]
  node_trade["Trade analysis<br/>[trade_engine.R]"]
  node_draft["Draft tools<br/>[draft_engine.R]"]
  node_strategy["Team strategy"]
  node_gm["AI general manager<br/>[ai_gm.R]"]
  node_tracking["Weekly performance"]
end

node_user(("Fantasy manager"))

node_user -->|"uses"| node_browser
node_bootstrap -->|"loads"| node_browser
node_browser -->|"fetches league data"| node_sleeper
node_browser -.->|"fetches game data"| node_espn
node_browser -.->|"loads projections"| node_snapshot
node_browser -.->|"matches players"| node_identity
node_browser -.->|"uses league context"| node_league_engine
node_browser -.->|"applies league scoring"| node_scoring
node_weekly -.->|"uses bounded feedback"| node_weekly_feedback
node_live_refresh -.->|"refreshes unplayed weeks"| node_live_state
node_live_refresh -.->|"refreshes projections"| node_weekly
node_quality -.->|"supports forecasts"| node_weekly
node_opportunity -.->|"supports projections"| node_weekly
node_browser -.->|"presents weekly projections"| node_weekly
node_browser -.->|"presents dynasty tools"| node_dynasty
node_browser -.->|"supports trade decisions"| node_trade
node_browser -.->|"supports draft decisions"| node_draft
node_browser -.->|"supports team decisions"| node_strategy
node_browser -.->|"offers GM tools"| node_gm
node_browser -.->|"shows performance"| node_tracking

click node_browser "https://github.com/dpwrz/powers-newlon/blob/main/web/src/main.js"
click node_bootstrap "https://github.com/dpwrz/powers-newlon/blob/main/web/src/boot.js"
click node_identity "https://github.com/dpwrz/powers-newlon/blob/main/R/player_identity.R"
click node_league_engine "https://github.com/dpwrz/powers-newlon/blob/main/R/league_engine.R"
click node_scoring "https://github.com/dpwrz/powers-newlon/blob/main/R/league_scoring_engine_25.R"
click node_snapshot "https://github.com/dpwrz/powers-newlon/blob/main/output/model_snapshot.json"
click node_weekly "https://github.com/dpwrz/powers-newlon/blob/main/R/weekly_engine.R"
click node_weekly_feedback "https://github.com/dpwrz/powers-newlon/blob/main/R/live_error_feedback_engine_25.R"
click node_live_state "https://github.com/dpwrz/powers-newlon/blob/main/R/live_game_state_engine_25.R"
click node_live_refresh "https://github.com/dpwrz/powers-newlon/blob/main/R/live_refresh_engine_31.R"
click node_quality "https://github.com/dpwrz/powers-newlon/blob/main/R/data_quality_engine.R"
click node_opportunity "https://github.com/dpwrz/powers-newlon/blob/main/R/opportunity_engine.R"
click node_dynasty "https://github.com/dpwrz/powers-newlon/blob/main/R/dynasty_value_engine.R"
click node_trade "https://github.com/dpwrz/powers-newlon/blob/main/R/trade_engine.R"
click node_draft "https://github.com/dpwrz/powers-newlon/blob/main/R/draft_engine.R"
click node_strategy "https://github.com/dpwrz/powers-newlon/blob/main/R/team_strategy_engine.R"
click node_gm "https://github.com/dpwrz/powers-newlon/blob/main/R/ai_gm.R"
click node_tracking "https://github.com/dpwrz/powers-newlon/blob/main/R/benchmark_archive_31.R"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_browser,node_bootstrap toneBlue
class node_sleeper,node_espn,node_identity,node_league_engine,node_scoring toneAmber
class node_snapshot,node_weekly,node_weekly_feedback,node_live_state,node_live_refresh,node_quality,node_opportunity toneMint
class node_dynasty,node_trade,node_draft,node_strategy,node_gm,node_tracking toneRose
class node_user toneIndigo
```

## Components

### Web experience

- [Web application](https://github.com/dpwrz/powers-newlon/blob/main/web/src/main.js): `web/src/main.js`
- [Snapshot bootstrap](https://github.com/dpwrz/powers-newlon/blob/main/web/src/boot.js): `web/src/boot.js`

### League context

- **Sleeper service**
- **NFL scoreboard**
- [Player identity](https://github.com/dpwrz/powers-newlon/blob/main/R/player_identity.R): `R/player_identity.R`
- [League engine](https://github.com/dpwrz/powers-newlon/blob/main/R/league_engine.R): `R/league_engine.R`
- [League scoring](https://github.com/dpwrz/powers-newlon/blob/main/R/league_scoring_engine_25.R): `R/league_scoring_engine_25.R`

### Projection system

- [Model snapshot](https://github.com/dpwrz/powers-newlon/blob/main/output/model_snapshot.json): `output/model_snapshot.json`
- [Weekly projections](https://github.com/dpwrz/powers-newlon/blob/main/R/weekly_engine.R): `R/weekly_engine.R`
- [Forecast error feedback](https://github.com/dpwrz/powers-newlon/blob/main/R/live_error_feedback_engine_25.R): `R/live_error_feedback_engine_25.R`
- [Live game state](https://github.com/dpwrz/powers-newlon/blob/main/R/live_game_state_engine_25.R): `R/live_game_state_engine_25.R`
- [Forward-only refresh](https://github.com/dpwrz/powers-newlon/blob/main/R/live_refresh_engine_31.R): `R/live_refresh_engine_31.R`
- [Data quality](https://github.com/dpwrz/powers-newlon/blob/main/R/data_quality_engine.R): `R/data_quality_engine.R`
- [Opportunity modeling](https://github.com/dpwrz/powers-newlon/blob/main/R/opportunity_engine.R): `R/opportunity_engine.R`

### Decision tools

- [Dynasty values](https://github.com/dpwrz/powers-newlon/blob/main/R/dynasty_value_engine.R): `R/dynasty_value_engine.R`
- [Trade analysis](https://github.com/dpwrz/powers-newlon/blob/main/R/trade_engine.R): `R/trade_engine.R`
- [Draft tools](https://github.com/dpwrz/powers-newlon/blob/main/R/draft_engine.R): `R/draft_engine.R`
- [Team strategy](https://github.com/dpwrz/powers-newlon/blob/main/R/team_strategy_engine.R): `R/team_strategy_engine.R`
- [AI general manager](https://github.com/dpwrz/powers-newlon/blob/main/R/ai_gm.R): `R/ai_gm.R`
- [Weekly performance](https://github.com/dpwrz/powers-newlon/blob/main/R/benchmark_archive_31.R): `R/benchmark_archive_31.R`

### Other components

- **Fantasy manager**

## Connections

- Fantasy manager → Web application: uses (evidence: `README.md`)
- Snapshot bootstrap → Web application: loads (evidence: `web/src/boot.js`)
- Web application → Sleeper service: fetches league data (evidence: `web/src/main.js`)
- Web application → NFL scoreboard: fetches game data (evidence: `web/src/main.js`)
- Web application → Model snapshot: loads projections
- Web application → Player identity: matches players
- Web application → League engine: uses league context
- Web application → League scoring: applies league scoring (evidence: `README.md`)
- Weekly projections → Forecast error feedback: uses bounded feedback (evidence: `README.md`)
- Forward-only refresh → Live game state: refreshes unplayed weeks (evidence: `README.md`)
- Forward-only refresh → Weekly projections: refreshes projections (evidence: `README.md`)
- Data quality → Weekly projections: supports forecasts
- Opportunity modeling → Weekly projections: supports projections
- Web application → Weekly projections: presents weekly projections (evidence: `README.md`)
- Web application → Dynasty values: presents dynasty tools (evidence: `README.md`)
- Web application → Trade analysis: supports trade decisions (evidence: `README.md`)
- Web application → Draft tools: supports draft decisions
- Web application → Team strategy: supports team decisions
- Web application → AI general manager: offers GM tools (evidence: `README.md`)
- Web application → Weekly performance: shows performance (evidence: `README.md`)
