# afieldi/risenstats architecture

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

- Interactive diagram: https://gitdiagram.com/afieldi/risenstats
- Repository: https://github.com/afieldi/risenstats
- Video tour (about a minute): https://gitdiagram.com/afieldi/risenstats/video

## Overview

Risen Stats is a League of Legends statistics and league-management application. A player searches in the web app, which requests data from the API; backend business logic obtains and aggregates game/player data from persistence, and the frontend presents profiles, game summaries, and statistics. Other documented-by-module capabilities include league/team views, leaderboards, drafting, stock timelines, authentication, and stat exports. The tree and sampled files establish the application entry points and some feature behavior; detailed wiring for unsampled modules is not asserted.

Main entry points: [`BackEnd/src/business`](https://github.com/afieldi/risenstats/tree/master/BackEnd/src/business) (Business services), [`front-end/src/api`](https://github.com/afieldi/risenstats/tree/master/front-end/src/api) (Frontend API clients), [`BackEnd/index.ts`](https://github.com/afieldi/risenstats/blob/master/BackEnd/index.ts) (HTTP and socket server), [`front-end/src/App.tsx`](https://github.com/afieldi/risenstats/blob/master/front-end/src/App.tsx) (React application)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web application"]
  node_frontend["React application<br/>[App.tsx]"]
  node_search["Player search<br/>[search.tsx]"]
  node_webapi["Frontend API clients"]
  node_profile["Player and game views"]
  node_leagueviews["League and team views"]
  node_draftui["Drafting interface"]
  node_exportui["Stat export pages"]
end

subgraph group_api["Backend API"]
  node_server["HTTP and socket server<br/>[index.ts]"]
  node_routes["Feature API routes"]
end

subgraph group_domain["Statistics and league domain"]
  node_business["Business services"]
  node_sheets["Sheet parsers"]
  node_statcalc["Stat generators"]
end

subgraph group_data["Persistence and contracts"]
  node_dbaccess["Database access"]
  node_models["Shared domain models"]
  node_database[("Application database")]
end

subgraph group_integrations["External integrations"]
  node_riot{{"Riot game services"}}
  node_discord{{"Discord OAuth and guild"}}
  node_sheetsvc{{"Google Sheets"}}
end

node_visitor(("Site user"))

node_visitor -->|"uses"| node_frontend
node_frontend -->|"renders"| node_search
node_search -->|"requests players"| node_webapi
node_webapi -->|"calls API"| node_server
node_server -->|"dispatches requests"| node_routes
node_routes -->|"invokes services"| node_business
node_business -->|"reads and writes"| node_dbaccess
node_dbaccess -->|"queries"| node_database
node_business -->|"uses contracts"| node_models
node_webapi -->|"supplies profile data"| node_profile
node_webapi -->|"supplies league data"| node_leagueviews
node_webapi -->|"supplies draft data"| node_draftui
node_webapi -->|"requests export data"| node_exportui
node_profile -->|"calculates displayed stats"| node_statcalc
node_server -->|"dispatches draft events"| node_business
node_business -->|"uses parsers"| node_sheets
node_business -.->|"requests game data"| node_riot
node_business -.->|"checks identity and roles"| node_discord
node_sheets -.->|"reads sheets"| node_sheetsvc

click node_frontend "https://github.com/afieldi/risenstats/blob/master/front-end/src/App.tsx"
click node_search "https://github.com/afieldi/risenstats/blob/master/front-end/src/pages/search/search.tsx"
click node_webapi "https://github.com/afieldi/risenstats/tree/master/front-end/src/api"
click node_profile "https://github.com/afieldi/risenstats/tree/master/front-end/src/components/player-page"
click node_leagueviews "https://github.com/afieldi/risenstats/tree/master/front-end/src/components/league-page"
click node_draftui "https://github.com/afieldi/risenstats/tree/master/front-end/src/components/drafting"
click node_exportui "https://github.com/afieldi/risenstats/tree/master/front-end/src/pages/statExport"
click node_server "https://github.com/afieldi/risenstats/blob/master/BackEnd/index.ts"
click node_routes "https://github.com/afieldi/risenstats/tree/master/BackEnd/src/api"
click node_business "https://github.com/afieldi/risenstats/tree/master/BackEnd/src/business"
click node_sheets "https://github.com/afieldi/risenstats/tree/master/BackEnd/src/business/sheets"
click node_statcalc "https://github.com/afieldi/risenstats/tree/master/front-end/src/common/stats-generators"
click node_dbaccess "https://github.com/afieldi/risenstats/tree/master/BackEnd/src/db"
click node_models "https://github.com/afieldi/risenstats/tree/master/Common/models"

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_frontend,node_search,node_webapi,node_profile,node_leagueviews,node_draftui,node_exportui,node_visitor toneBlue
class node_server,node_routes toneAmber
class node_business,node_sheets,node_statcalc toneMint
class node_dbaccess,node_models,node_database toneRose
class node_riot,node_discord,node_sheetsvc toneIndigo
```

## Components

### Web application

- [React application](https://github.com/afieldi/risenstats/blob/master/front-end/src/App.tsx): `front-end/src/App.tsx`
- [Player search](https://github.com/afieldi/risenstats/blob/master/front-end/src/pages/search/search.tsx): `front-end/src/pages/search/search.tsx`
- [Frontend API clients](https://github.com/afieldi/risenstats/tree/master/front-end/src/api): `front-end/src/api`
- [Player and game views](https://github.com/afieldi/risenstats/tree/master/front-end/src/components/player-page): `front-end/src/components/player-page`
- [League and team views](https://github.com/afieldi/risenstats/tree/master/front-end/src/components/league-page): `front-end/src/components/league-page`
- [Drafting interface](https://github.com/afieldi/risenstats/tree/master/front-end/src/components/drafting): `front-end/src/components/drafting`
- [Stat export pages](https://github.com/afieldi/risenstats/tree/master/front-end/src/pages/statExport): `front-end/src/pages/statExport`

### Backend API

- [HTTP and socket server](https://github.com/afieldi/risenstats/blob/master/BackEnd/index.ts): `BackEnd/index.ts`
- [Feature API routes](https://github.com/afieldi/risenstats/tree/master/BackEnd/src/api): `BackEnd/src/api`

### Statistics and league domain

- [Business services](https://github.com/afieldi/risenstats/tree/master/BackEnd/src/business): `BackEnd/src/business`
- [Sheet parsers](https://github.com/afieldi/risenstats/tree/master/BackEnd/src/business/sheets): `BackEnd/src/business/sheets`
- [Stat generators](https://github.com/afieldi/risenstats/tree/master/front-end/src/common/stats-generators): `front-end/src/common/stats-generators`

### Persistence and contracts

- [Database access](https://github.com/afieldi/risenstats/tree/master/BackEnd/src/db): `BackEnd/src/db`
- [Shared domain models](https://github.com/afieldi/risenstats/tree/master/Common/models): `Common/models`
- **Application database**

### External integrations

- **Riot game services**
- **Discord OAuth and guild**
- **Google Sheets**

### Other components

- **Site user**

## Connections

- Site user → React application: uses
- React application → Player search: renders
- Player search → Frontend API clients: requests players
- Frontend API clients → HTTP and socket server: calls API
- HTTP and socket server → Feature API routes: dispatches requests
- Feature API routes → Business services: invokes services
- Business services → Database access: reads and writes
- Database access → Application database: queries
- Business services → Shared domain models: uses contracts
- Frontend API clients → Player and game views: supplies profile data
- Frontend API clients → League and team views: supplies league data
- Frontend API clients → Drafting interface: supplies draft data
- Frontend API clients → Stat export pages: requests export data
- Player and game views → Stat generators: calculates displayed stats
- HTTP and socket server → Business services: dispatches draft events
- Business services → Sheet parsers: uses parsers
- Business services → Riot game services: requests game data
- Business services → Discord OAuth and guild: checks identity and roles
- Sheet parsers → Google Sheets: reads sheets
