# shaiinarab/pabetoop-league architecture

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

- Interactive diagram: https://gitdiagram.com/shaiinarab/pabetoop-league
- Repository: https://github.com/shaiinarab/pabetoop-league

## Overview

Pabetoop League is a server-rendered competition platform for youth leagues. Visitors browse age-group and competition pages; administrators manage seasons, clubs, teams, competitions, fixtures, results, imports, backups, and audit history. The main workflow runs from browser requests through the Go web server and feature handlers to the SQLite-backed store, with standings and import validation handled by domain packages. The README documents these major capabilities; some handler-to-handler details are not shown in the sampled excerpts, so uncertain links are omitted.

Main entry points: [`internal/web/server.go`](https://github.com/shaiinarab/pabetoop-league/blob/main/internal/web/server.go) (HTTP application), [`internal/store/store.go`](https://github.com/shaiinarab/pabetoop-league/blob/main/internal/store/store.go) (Data store), [`internal/web/import_handlers.go`](https://github.com/shaiinarab/pabetoop-league/blob/main/internal/web/import_handlers.go) (Fixture import workflow), [`internal/jalali/jalali.go`](https://github.com/shaiinarab/pabetoop-league/blob/main/internal/jalali/jalali.go) (Jalali calendar)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Server runtime"]
  node_server_entry["Server entrypoint<br/>[main.go]"]
  node_http_app["HTTP application<br/>[server.go]"]
  node_security["Sessions and security<br/>[security.go]"]
end

subgraph group_competition["Competition operations"]
  node_public_pages["Public pages<br/>[public_handlers.go]"]
  node_admin_management["Admin management<br/>[admin_handlers.go]"]
  node_season_admin["Season management<br/>[season_handlers.go]"]
  node_competition_admin["Competition registration"]
  node_fixture_admin["Fixture management"]
  node_import_admin["Fixture import workflow<br/>[import_handlers.go]"]
  node_result_admin["Result entry<br/>[result_handlers.go]"]
  node_audit_admin["Audit history<br/>[audit_handlers.go]"]
  node_backup_admin["Backup and status<br/>[backup_handlers.go]"]
end

subgraph group_domain["Domain logic"]
  node_csv_parser["CSV parsing<br/>[parser.go]"]
  node_import_validation["Import validation<br/>[validate.go]"]
  node_standings["Standings engine<br/>[standing.go]"]
  node_jalali["Jalali calendar<br/>[jalali.go]"]
end

subgraph group_presentation["Presentation and identity"]
  node_branding["White-label identity<br/>[site.go]"]
  node_rendering["HTML rendering<br/>[render.go]"]
  node_browser_enhancement["HTMX enhancement<br/>[app.ts]"]
end

subgraph group_persistence["Persistence"]
  node_store["Data store<br/>[store.go]"]
  node_sqlite[("SQLite database")]
end

node_visitor(("Public visitor"))
node_administrator(("Administrator"))

node_visitor -->|"browses"| node_http_app
node_administrator -->|"administers"| node_http_app
node_server_entry -->|"opens and migrates"| node_store
node_server_entry -->|"starts"| node_http_app
node_http_app -->|"configures identity"| node_branding
node_http_app -->|"uses"| node_store
node_http_app -.->|"applies protections"| node_security
node_http_app -->|"routes public requests"| node_public_pages
node_http_app -->|"routes admin requests"| node_admin_management
node_http_app -.->|"routes admin requests"| node_season_admin
node_http_app -.->|"routes admin requests"| node_competition_admin
node_http_app -.->|"routes admin requests"| node_fixture_admin
node_http_app -.->|"routes admin requests"| node_import_admin
node_http_app -.->|"routes admin requests"| node_result_admin
node_http_app -.->|"routes admin requests"| node_audit_admin
node_http_app -.->|"routes admin requests"| node_backup_admin
node_public_pages -->|"reads league data"| node_store
node_public_pages -->|"computes tables"| node_standings
node_admin_management -->|"manages clubs and teams"| node_store
node_season_admin -->|"manages seasons"| node_store
node_season_admin -->|"formats dates"| node_jalali
node_competition_admin -->|"manages competitions"| node_store
node_fixture_admin -->|"manages fixtures"| node_store
node_fixture_admin -->|"formats dates"| node_jalali
node_import_admin -->|"parses uploads"| node_csv_parser
node_import_admin -->|"validates rows"| node_import_validation
node_import_admin -->|"imports confirmed fixtures"| node_store
node_csv_parser -->|"parses dates"| node_jalali
node_import_validation -->|"formats digits"| node_jalali
node_result_admin -->|"reads and saves results"| node_store
node_result_admin -->|"computes tables"| node_standings
node_audit_admin -->|"reads audit records"| node_store
node_backup_admin -.->|"backs up data"| node_store
node_store -->|"reads and writes"| node_sqlite
node_http_app -->|"renders HTML"| node_rendering
node_http_app -->|"resolves interface identity"| node_branding
node_browser_enhancement -->|"enhances interactions"| node_http_app

click node_server_entry "https://github.com/shaiinarab/pabetoop-league/blob/main/cmd/server/main.go"
click node_http_app "https://github.com/shaiinarab/pabetoop-league/blob/main/internal/web/server.go"
click node_security "https://github.com/shaiinarab/pabetoop-league/blob/main/internal/web/security.go"
click node_public_pages "https://github.com/shaiinarab/pabetoop-league/blob/main/internal/web/public_handlers.go"
click node_admin_management "https://github.com/shaiinarab/pabetoop-league/blob/main/internal/web/admin_handlers.go"
click node_season_admin "https://github.com/shaiinarab/pabetoop-league/blob/main/internal/web/season_handlers.go"
click node_competition_admin "https://github.com/shaiinarab/pabetoop-league/blob/main/internal/web/competition_handlers.go"
click node_fixture_admin "https://github.com/shaiinarab/pabetoop-league/blob/main/internal/web/fixture_handlers.go"
click node_import_admin "https://github.com/shaiinarab/pabetoop-league/blob/main/internal/web/import_handlers.go"
click node_csv_parser "https://github.com/shaiinarab/pabetoop-league/blob/main/internal/import/parser.go"
click node_import_validation "https://github.com/shaiinarab/pabetoop-league/blob/main/internal/import/validate.go"
click node_result_admin "https://github.com/shaiinarab/pabetoop-league/blob/main/internal/web/result_handlers.go"
click node_standings "https://github.com/shaiinarab/pabetoop-league/blob/main/internal/standing/standing.go"
click node_audit_admin "https://github.com/shaiinarab/pabetoop-league/blob/main/internal/web/audit_handlers.go"
click node_backup_admin "https://github.com/shaiinarab/pabetoop-league/blob/main/internal/web/backup_handlers.go"
click node_jalali "https://github.com/shaiinarab/pabetoop-league/blob/main/internal/jalali/jalali.go"
click node_branding "https://github.com/shaiinarab/pabetoop-league/blob/main/internal/site/site.go"
click node_rendering "https://github.com/shaiinarab/pabetoop-league/blob/main/internal/web/render.go"
click node_browser_enhancement "https://github.com/shaiinarab/pabetoop-league/blob/main/web/static/js/app.ts"
click node_store "https://github.com/shaiinarab/pabetoop-league/blob/main/internal/store/store.go"

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_server_entry,node_http_app,node_security toneBlue
class node_public_pages,node_admin_management,node_season_admin,node_competition_admin,node_fixture_admin,node_import_admin,node_result_admin,node_audit_admin,node_backup_admin toneAmber
class node_csv_parser,node_import_validation,node_standings,node_jalali toneMint
class node_branding,node_rendering,node_browser_enhancement toneRose
class node_store,node_sqlite,node_visitor,node_administrator toneIndigo
```

## Components

### Server runtime

- [Server entrypoint](https://github.com/shaiinarab/pabetoop-league/blob/main/cmd/server/main.go): `cmd/server/main.go`
- [HTTP application](https://github.com/shaiinarab/pabetoop-league/blob/main/internal/web/server.go): `internal/web/server.go`
- [Sessions and security](https://github.com/shaiinarab/pabetoop-league/blob/main/internal/web/security.go): `internal/web/security.go`

### Competition operations

- [Public pages](https://github.com/shaiinarab/pabetoop-league/blob/main/internal/web/public_handlers.go): `internal/web/public_handlers.go`
- [Admin management](https://github.com/shaiinarab/pabetoop-league/blob/main/internal/web/admin_handlers.go): `internal/web/admin_handlers.go`
- [Season management](https://github.com/shaiinarab/pabetoop-league/blob/main/internal/web/season_handlers.go): `internal/web/season_handlers.go`
- [Competition registration](https://github.com/shaiinarab/pabetoop-league/blob/main/internal/web/competition_handlers.go): `internal/web/competition_handlers.go`
- [Fixture management](https://github.com/shaiinarab/pabetoop-league/blob/main/internal/web/fixture_handlers.go): `internal/web/fixture_handlers.go`
- [Fixture import workflow](https://github.com/shaiinarab/pabetoop-league/blob/main/internal/web/import_handlers.go): `internal/web/import_handlers.go`
- [Result entry](https://github.com/shaiinarab/pabetoop-league/blob/main/internal/web/result_handlers.go): `internal/web/result_handlers.go`
- [Audit history](https://github.com/shaiinarab/pabetoop-league/blob/main/internal/web/audit_handlers.go): `internal/web/audit_handlers.go`
- [Backup and status](https://github.com/shaiinarab/pabetoop-league/blob/main/internal/web/backup_handlers.go): `internal/web/backup_handlers.go`

### Domain logic

- [CSV parsing](https://github.com/shaiinarab/pabetoop-league/blob/main/internal/import/parser.go): `internal/import/parser.go`
- [Import validation](https://github.com/shaiinarab/pabetoop-league/blob/main/internal/import/validate.go): `internal/import/validate.go`
- [Standings engine](https://github.com/shaiinarab/pabetoop-league/blob/main/internal/standing/standing.go): `internal/standing/standing.go`
- [Jalali calendar](https://github.com/shaiinarab/pabetoop-league/blob/main/internal/jalali/jalali.go): `internal/jalali/jalali.go`

### Presentation and identity

- [White-label identity](https://github.com/shaiinarab/pabetoop-league/blob/main/internal/site/site.go): `internal/site/site.go`
- [HTML rendering](https://github.com/shaiinarab/pabetoop-league/blob/main/internal/web/render.go): `internal/web/render.go`
- [HTMX enhancement](https://github.com/shaiinarab/pabetoop-league/blob/main/web/static/js/app.ts): `web/static/js/app.ts`

### Persistence

- [Data store](https://github.com/shaiinarab/pabetoop-league/blob/main/internal/store/store.go): `internal/store/store.go`
- **SQLite database**

### Other components

- **Public visitor**
- **Administrator**

## Connections

- Public visitor → HTTP application: browses (evidence: `README.md`)
- Administrator → HTTP application: administers (evidence: `README.md`)
- Server entrypoint → Data store: opens and migrates (evidence: `cmd/server/main.go`)
- Server entrypoint → HTTP application: starts (evidence: `cmd/server/main.go`)
- HTTP application → White-label identity: configures identity (evidence: `internal/web/server.go`)
- HTTP application → Data store: uses (evidence: `internal/web/server.go`)
- HTTP application → Sessions and security: applies protections
- HTTP application → Public pages: routes public requests (evidence: `README.md`)
- HTTP application → Admin management: routes admin requests (evidence: `README.md`)
- HTTP application → Season management: routes admin requests
- HTTP application → Competition registration: routes admin requests
- HTTP application → Fixture management: routes admin requests
- HTTP application → Fixture import workflow: routes admin requests
- HTTP application → Result entry: routes admin requests
- HTTP application → Audit history: routes admin requests
- HTTP application → Backup and status: routes admin requests
- Public pages → Data store: reads league data (evidence: `internal/web/public_handlers.go`)
- Public pages → Standings engine: computes tables (evidence: `internal/web/public_handlers.go`)
- Admin management → Data store: manages clubs and teams (evidence: `internal/web/admin_handlers.go`)
- Season management → Data store: manages seasons (evidence: `internal/web/season_handlers.go`)
- Season management → Jalali calendar: formats dates (evidence: `internal/web/season_handlers.go`)
- Competition registration → Data store: manages competitions (evidence: `internal/web/competition_handlers.go`)
- Fixture management → Data store: manages fixtures (evidence: `internal/web/fixture_handlers.go`)
- Fixture management → Jalali calendar: formats dates (evidence: `internal/web/fixture_handlers.go`)
- Fixture import workflow → CSV parsing: parses uploads (evidence: `internal/web/import_handlers.go`)
- Fixture import workflow → Import validation: validates rows (evidence: `internal/web/import_handlers.go`)
- Fixture import workflow → Data store: imports confirmed fixtures (evidence: `internal/web/import_handlers.go`)
- CSV parsing → Jalali calendar: parses dates (evidence: `internal/import/parser.go`)
- Import validation → Jalali calendar: formats digits (evidence: `internal/import/validate.go`)
- Result entry → Data store: reads and saves results (evidence: `internal/web/result_handlers.go`)
- Result entry → Standings engine: computes tables (evidence: `internal/web/result_handlers.go`)
- Audit history → Data store: reads audit records (evidence: `internal/web/audit_handlers.go`)
- Backup and status → Data store: backs up data
- Data store → SQLite database: reads and writes (evidence: `README.md`)
- HTTP application → HTML rendering: renders HTML (evidence: `README.md`)
- HTTP application → White-label identity: resolves interface identity (evidence: `internal/web/server.go`)
- HTMX enhancement → HTTP application: enhances interactions (evidence: `README.md`)
