# seismicsystems/march-madness architecture

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

- Interactive diagram: https://gitdiagram.com/seismicsystems/march-madness
- Repository: https://github.com/seismicsystems/march-madness

## Overview

March Madness on Seismic is a private on-chain bracket contest with a web app, companion group and mirror pools, live tournament data, rankings, and forecasts. The principal workflow is sign-in and bracket selection in the web app, contract submission through the client, then post-deadline reveal and scoring for contest results. Supporting services index contract events, serve indexed and forecast data, and ingest tournament results. The README documents major capabilities; several implementation links below are therefore based on documentation rather than sampled calls.

Main entry points: [`packages/web/src/App.tsx`](https://github.com/seismicsystems/march-madness/blob/main/packages/web/src/App.tsx) (Web app), [`crates/server/src/main.rs`](https://github.com/seismicsystems/march-madness/blob/main/crates/server/src/main.rs) (HTTP API), [`packages/client/src/client.ts`](https://github.com/seismicsystems/march-madness/blob/main/packages/client/src/client.ts) (TypeScript client), [`crates/indexer/src/redis_store.rs`](https://github.com/seismicsystems/march-madness/blob/main/crates/indexer/src/redis_store.rs) (Redis index)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web experience"]
  node_webapp["Web app<br/>[App.tsx]"]
  node_contest_ui["Bracket and leaderboard<br/>[HomePage.tsx]"]
  node_groups_ui["Groups interface<br/>[GroupsPage.tsx]"]
  node_mirror_ui["Mirror views"]
  node_contract_hooks["Wallet hooks<br/>[useContract.ts]"]
  node_group_hooks["Group hooks<br/>[useGroups.ts]"]
end

subgraph group_chain["Contest services"]
  node_client["TypeScript client<br/>[client.ts]"]
  node_contracts["Contest contracts"]
  node_indexer["Event indexer<br/>[main.rs]"]
  node_redis[("Redis index<br/>[redis_store.rs]")]
  node_server["HTTP API<br/>[main.rs]"]
  node_server_routes["API routes<br/>[routes.rs]"]
end

subgraph group_tournament["Tournament intelligence"]
  node_simulator["Tournament simulator<br/>[tournament.rs]"]
  node_forecaster["Pool forecaster<br/>[main.rs]"]
  node_scoring["Scoring and simulation<br/>[scoring.rs]"]
  node_feed["Live score feed<br/>[main.rs]"]
  node_ncaa_api["NCAA data client<br/>[client.rs]"]
  node_kalshi["Market odds<br/>[orderbook.rs]"]
end

subgraph group_pools["Pools and imports"]
  node_groups_contract["Groups pool"]
  node_mirror_contract["Mirror pool"]
  node_mirror_importer["Yahoo importer<br/>[main.rs]"]
end

subgraph group_operations["Contract operations"]
  node_migration["Contract migration<br/>[main.rs]"]
end

node_participant(("Participant"))

node_participant -->|"uses"| node_webapp
node_webapp -->|"routes to"| node_contest_ui
node_webapp -->|"routes to"| node_groups_ui
node_webapp -->|"routes to"| node_mirror_ui
node_contest_ui -.->|"uses"| node_contract_hooks
node_contract_hooks -->|"calls"| node_client
node_client -->|"reads and submits"| node_contracts
node_groups_ui -.->|"uses"| node_group_hooks
node_group_hooks -->|"calls"| node_client
node_client -->|"manages groups"| node_groups_contract
node_mirror_importer -->|"imports brackets"| node_mirror_contract
node_contracts -->|"emits events"| node_indexer
node_indexer -->|"writes index"| node_redis
node_server -->|"routes requests"| node_server_routes
node_server_routes -->|"reads state"| node_server
node_server -->|"serves indexed data"| node_redis
node_feed -->|"fetches scores"| node_ncaa_api
node_feed -->|"writes status"| node_redis
node_forecaster -->|"uses forecasts data"| node_redis
node_server -->|"serves forecasts"| node_forecaster
node_kalshi -->|"calibrates odds"| node_simulator
node_simulator -.->|"supports scoring"| node_scoring
node_migration -->|"migrates data"| node_contracts
node_groups_contract -->|"uses main scoring"| node_contracts

click node_webapp "https://github.com/seismicsystems/march-madness/blob/main/packages/web/src/App.tsx"
click node_contest_ui "https://github.com/seismicsystems/march-madness/blob/main/packages/web/src/pages/HomePage.tsx"
click node_groups_ui "https://github.com/seismicsystems/march-madness/blob/main/packages/web/src/pages/GroupsPage.tsx"
click node_mirror_ui "https://github.com/seismicsystems/march-madness/blob/main/packages/web/src/pages/MirrorBracketPage.tsx"
click node_contract_hooks "https://github.com/seismicsystems/march-madness/blob/main/packages/web/src/hooks/useContract.ts"
click node_group_hooks "https://github.com/seismicsystems/march-madness/blob/main/packages/web/src/hooks/useGroups.ts"
click node_client "https://github.com/seismicsystems/march-madness/blob/main/packages/client/src/client.ts"
click node_indexer "https://github.com/seismicsystems/march-madness/blob/main/crates/indexer/src/main.rs"
click node_redis "https://github.com/seismicsystems/march-madness/blob/main/crates/indexer/src/redis_store.rs"
click node_server "https://github.com/seismicsystems/march-madness/blob/main/crates/server/src/main.rs"
click node_server_routes "https://github.com/seismicsystems/march-madness/blob/main/crates/server/src/routes.rs"
click node_simulator "https://github.com/seismicsystems/march-madness/blob/main/crates/bracket-sim/src/tournament.rs"
click node_forecaster "https://github.com/seismicsystems/march-madness/blob/main/crates/forecaster/src/main.rs"
click node_scoring "https://github.com/seismicsystems/march-madness/blob/main/crates/seismic-march-madness/src/scoring.rs"
click node_feed "https://github.com/seismicsystems/march-madness/blob/main/crates/ncaa-feed/src/main.rs"
click node_ncaa_api "https://github.com/seismicsystems/march-madness/blob/main/crates/ncaa-api/src/client.rs"
click node_kalshi "https://github.com/seismicsystems/march-madness/blob/main/crates/kalshi/src/orderbook.rs"
click node_mirror_importer "https://github.com/seismicsystems/march-madness/blob/main/crates/mirror-importer/src/main.rs"
click node_migration "https://github.com/seismicsystems/march-madness/blob/main/crates/populate/src/main.rs"

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_webapp,node_contest_ui,node_groups_ui,node_mirror_ui,node_contract_hooks,node_group_hooks toneBlue
class node_client,node_contracts,node_indexer,node_redis,node_server,node_server_routes toneAmber
class node_simulator,node_forecaster,node_scoring,node_feed,node_ncaa_api,node_kalshi toneMint
class node_groups_contract,node_mirror_contract,node_mirror_importer toneRose
class node_migration,node_participant toneIndigo
```

## Components

### Web experience

- [Web app](https://github.com/seismicsystems/march-madness/blob/main/packages/web/src/App.tsx): `packages/web/src/App.tsx`
- [Bracket and leaderboard](https://github.com/seismicsystems/march-madness/blob/main/packages/web/src/pages/HomePage.tsx): `packages/web/src/pages/HomePage.tsx`
- [Groups interface](https://github.com/seismicsystems/march-madness/blob/main/packages/web/src/pages/GroupsPage.tsx): `packages/web/src/pages/GroupsPage.tsx`
- [Mirror views](https://github.com/seismicsystems/march-madness/blob/main/packages/web/src/pages/MirrorBracketPage.tsx): `packages/web/src/pages/MirrorBracketPage.tsx`
- [Wallet hooks](https://github.com/seismicsystems/march-madness/blob/main/packages/web/src/hooks/useContract.ts): `packages/web/src/hooks/useContract.ts`
- [Group hooks](https://github.com/seismicsystems/march-madness/blob/main/packages/web/src/hooks/useGroups.ts): `packages/web/src/hooks/useGroups.ts`

### Contest services

- [TypeScript client](https://github.com/seismicsystems/march-madness/blob/main/packages/client/src/client.ts): `packages/client/src/client.ts`
- **Contest contracts**
- [Event indexer](https://github.com/seismicsystems/march-madness/blob/main/crates/indexer/src/main.rs): `crates/indexer/src/main.rs`
- [Redis index](https://github.com/seismicsystems/march-madness/blob/main/crates/indexer/src/redis_store.rs): `crates/indexer/src/redis_store.rs`
- [HTTP API](https://github.com/seismicsystems/march-madness/blob/main/crates/server/src/main.rs): `crates/server/src/main.rs`
- [API routes](https://github.com/seismicsystems/march-madness/blob/main/crates/server/src/routes.rs): `crates/server/src/routes.rs`

### Tournament intelligence

- [Tournament simulator](https://github.com/seismicsystems/march-madness/blob/main/crates/bracket-sim/src/tournament.rs): `crates/bracket-sim/src/tournament.rs`
- [Pool forecaster](https://github.com/seismicsystems/march-madness/blob/main/crates/forecaster/src/main.rs): `crates/forecaster/src/main.rs`
- [Scoring and simulation](https://github.com/seismicsystems/march-madness/blob/main/crates/seismic-march-madness/src/scoring.rs): `crates/seismic-march-madness/src/scoring.rs`
- [Live score feed](https://github.com/seismicsystems/march-madness/blob/main/crates/ncaa-feed/src/main.rs): `crates/ncaa-feed/src/main.rs`
- [NCAA data client](https://github.com/seismicsystems/march-madness/blob/main/crates/ncaa-api/src/client.rs): `crates/ncaa-api/src/client.rs`
- [Market odds](https://github.com/seismicsystems/march-madness/blob/main/crates/kalshi/src/orderbook.rs): `crates/kalshi/src/orderbook.rs`

### Pools and imports

- **Groups pool**
- **Mirror pool**
- [Yahoo importer](https://github.com/seismicsystems/march-madness/blob/main/crates/mirror-importer/src/main.rs): `crates/mirror-importer/src/main.rs`

### Contract operations

- [Contract migration](https://github.com/seismicsystems/march-madness/blob/main/crates/populate/src/main.rs): `crates/populate/src/main.rs`

### Other components

- **Participant**

## Connections

- Participant → Web app: uses (evidence: `README.md`)
- Web app → Bracket and leaderboard: routes to (evidence: `packages/web/src/App.tsx`)
- Web app → Groups interface: routes to (evidence: `packages/web/src/App.tsx`)
- Web app → Mirror views: routes to (evidence: `packages/web/src/App.tsx`)
- Bracket and leaderboard → Wallet hooks: uses
- Wallet hooks → TypeScript client: calls (evidence: `packages/web/src/hooks/useContract.ts`)
- TypeScript client → Contest contracts: reads and submits (evidence: `README.md`)
- Groups interface → Group hooks: uses
- Group hooks → TypeScript client: calls (evidence: `packages/web/src/hooks/useGroups.ts`)
- TypeScript client → Groups pool: manages groups (evidence: `README.md`)
- Yahoo importer → Mirror pool: imports brackets (evidence: `README.md`)
- Contest contracts → Event indexer: emits events (evidence: `README.md`)
- Event indexer → Redis index: writes index (evidence: `crates/indexer/src/main.rs`)
- HTTP API → API routes: routes requests (evidence: `crates/server/src/main.rs`)
- API routes → HTTP API: reads state (evidence: `crates/server/src/routes.rs`)
- HTTP API → Redis index: serves indexed data (evidence: `README.md`)
- Live score feed → NCAA data client: fetches scores (evidence: `crates/ncaa-feed/src/main.rs`)
- Live score feed → Redis index: writes status (evidence: `crates/ncaa-feed/src/main.rs`)
- Pool forecaster → Redis index: uses forecasts data (evidence: `README.md`)
- HTTP API → Pool forecaster: serves forecasts (evidence: `README.md`)
- Market odds → Tournament simulator: calibrates odds (evidence: `README.md`)
- Tournament simulator → Scoring and simulation: supports scoring
- Contract migration → Contest contracts: migrates data (evidence: `crates/populate/src/main.rs`)
- Groups pool → Contest contracts: uses main scoring (evidence: `README.md`)
