# withqwerty/reep architecture

> Architecture diagram of the GitHub repository withqwerty/reep, 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/withqwerty/reep
- Repository: https://github.com/withqwerty/reep
- Video tour (about a minute): https://gitdiagram.com/withqwerty/reep/video

## Overview

Reep v0 is a frozen football-identity register with a legacy API for looking up entities and mapping provider IDs. Callers send requests to the Cloudflare Worker, which serves lookup, search, resolution, and batch operations against D1; contribution uploads are an additional path to R2. The repository also contains frozen CSV snapshots. The sampled Worker excerpts are partial, so the graph omits uncertain route wiring and any connection between those files and the runtime database.

Main entry points: [`src/worker.ts`](https://github.com/withqwerty/reep/blob/main/src/worker.ts) (API Worker)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API runtime"]
  node_worker["API Worker<br/>[worker.ts]"]
  node_auth["Request authentication<br/>[worker.ts]"]
  node_entity_lookup["Entity lookup<br/>[worker.ts]"]
  node_name_search["Name search<br/>[worker.ts]"]
  node_provider_lookup["Provider lookup<br/>[worker.ts]"]
  node_resolution["ID resolution<br/>[worker.ts]"]
  node_batch["Batch operations<br/>[worker.ts]"]
  node_freshness["Freeze metadata<br/>[worker.ts]"]
  node_contributions["Contribution upload<br/>[worker.ts]"]
end

subgraph group_register["Identity register"]
  node_people["People snapshot<br/>[people.csv]"]
  node_teams["Teams snapshot<br/>[teams.csv]"]
  node_competitions["Competitions snapshot<br/>[competitions.csv]"]
  node_seasons["Seasons snapshot<br/>[seasons.csv]"]
  node_names["Names snapshot<br/>[names.csv]"]
end

subgraph group_integrations["External services"]
  node_d1[("D1 register")]
  node_r2[("R2 contributions")]
  node_unkey["Unkey"]
  node_rapidapi["RapidAPI proxy"]
end

node_caller(("API caller"))

node_caller -->|"requests"| node_worker
node_worker -->|"checks auth"| node_auth
node_worker -->|"dispatches"| node_entity_lookup
node_worker -->|"dispatches"| node_name_search
node_worker -->|"dispatches"| node_provider_lookup
node_worker -->|"dispatches"| node_resolution
node_worker -->|"dispatches"| node_batch
node_worker -->|"adds metadata"| node_freshness
node_worker -->|"dispatches"| node_contributions
node_entity_lookup -->|"queries"| node_d1
node_name_search -->|"queries"| node_d1
node_provider_lookup -->|"queries"| node_d1
node_resolution -->|"queries"| node_d1
node_batch -->|"queries"| node_d1
node_auth -.->|"verifies keys"| node_unkey
node_auth -.->|"checks proxy secret"| node_rapidapi
node_contributions -->|"stores uploads"| node_r2

click node_worker "https://github.com/withqwerty/reep/blob/main/src/worker.ts"
click node_auth "https://github.com/withqwerty/reep/blob/main/src/worker.ts"
click node_entity_lookup "https://github.com/withqwerty/reep/blob/main/src/worker.ts"
click node_name_search "https://github.com/withqwerty/reep/blob/main/src/worker.ts"
click node_provider_lookup "https://github.com/withqwerty/reep/blob/main/src/worker.ts"
click node_resolution "https://github.com/withqwerty/reep/blob/main/src/worker.ts"
click node_batch "https://github.com/withqwerty/reep/blob/main/src/worker.ts"
click node_freshness "https://github.com/withqwerty/reep/blob/main/src/worker.ts"
click node_contributions "https://github.com/withqwerty/reep/blob/main/src/worker.ts"
click node_people "https://github.com/withqwerty/reep/blob/main/data/people.csv"
click node_teams "https://github.com/withqwerty/reep/blob/main/data/teams.csv"
click node_competitions "https://github.com/withqwerty/reep/blob/main/data/competitions.csv"
click node_seasons "https://github.com/withqwerty/reep/blob/main/data/seasons.csv"
click node_names "https://github.com/withqwerty/reep/blob/main/data/names.csv"

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_worker,node_auth,node_entity_lookup,node_name_search,node_provider_lookup,node_resolution,node_batch,node_freshness,node_contributions toneBlue
class node_people,node_teams,node_competitions,node_seasons,node_names toneAmber
class node_d1,node_r2,node_unkey,node_rapidapi,node_caller toneMint
```

## Components

### API runtime

- [API Worker](https://github.com/withqwerty/reep/blob/main/src/worker.ts): `src/worker.ts`
- [Request authentication](https://github.com/withqwerty/reep/blob/main/src/worker.ts): `src/worker.ts`
- [Entity lookup](https://github.com/withqwerty/reep/blob/main/src/worker.ts): `src/worker.ts`
- [Name search](https://github.com/withqwerty/reep/blob/main/src/worker.ts): `src/worker.ts`
- [Provider lookup](https://github.com/withqwerty/reep/blob/main/src/worker.ts): `src/worker.ts`
- [ID resolution](https://github.com/withqwerty/reep/blob/main/src/worker.ts): `src/worker.ts`
- [Batch operations](https://github.com/withqwerty/reep/blob/main/src/worker.ts): `src/worker.ts`
- [Freeze metadata](https://github.com/withqwerty/reep/blob/main/src/worker.ts): `src/worker.ts`
- [Contribution upload](https://github.com/withqwerty/reep/blob/main/src/worker.ts): `src/worker.ts`

### Identity register

- [People snapshot](https://github.com/withqwerty/reep/blob/main/data/people.csv): `data/people.csv`
- [Teams snapshot](https://github.com/withqwerty/reep/blob/main/data/teams.csv): `data/teams.csv`
- [Competitions snapshot](https://github.com/withqwerty/reep/blob/main/data/competitions.csv): `data/competitions.csv`
- [Seasons snapshot](https://github.com/withqwerty/reep/blob/main/data/seasons.csv): `data/seasons.csv`
- [Names snapshot](https://github.com/withqwerty/reep/blob/main/data/names.csv): `data/names.csv`

### External services

- **D1 register**
- **R2 contributions**
- **Unkey**
- **RapidAPI proxy**

### Other components

- **API caller**

## Connections

- API caller → API Worker: requests
- API Worker → Request authentication: checks auth
- API Worker → Entity lookup: dispatches
- API Worker → Name search: dispatches
- API Worker → Provider lookup: dispatches
- API Worker → ID resolution: dispatches
- API Worker → Batch operations: dispatches
- API Worker → Freeze metadata: adds metadata
- API Worker → Contribution upload: dispatches
- Entity lookup → D1 register: queries
- Name search → D1 register: queries
- Provider lookup → D1 register: queries
- ID resolution → D1 register: queries
- Batch operations → D1 register: queries
- Request authentication → Unkey: verifies keys
- Request authentication → RapidAPI proxy: checks proxy secret
- Contribution upload → R2 contributions: stores uploads
