# shaiinarab/pabetoop-club architecture

> Architecture diagram of the GitHub repository shaiinarab/pabetoop-club, 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-club
- Repository: https://github.com/shaiinarab/pabetoop-club

## Overview

Pabetoop Club is a white-label membership and billing platform for sports clubs. A guardian or manager signs in to a server-rendered portal: guardians review player, subscription and invoice status and can start payment; managers maintain members and family links, plans and invoices. Payment then proceeds through provider initiation, callback verification and settlement. PocketBase manages the embedded SQLite-backed records. The graph also preserves documented dunning, branding, PWA, backup-integrity and ACWR capabilities; the ACWR code is explicitly not wired to routes. Some unsampled integrations are shown only as unverified.

Main entry points: [`internal/app/payments_v2.go`](https://github.com/shaiinarab/pabetoop-club/blob/main/internal/app/payments_v2.go) (Payment lifecycle), [`internal/app/auth.go`](https://github.com/shaiinarab/pabetoop-club/blob/main/internal/app/auth.go) (Sessions and security), [`internal/app/dashboard.go`](https://github.com/shaiinarab/pabetoop-club/blob/main/internal/app/dashboard.go) (Manager and family portals), [`internal/app/app.go`](https://github.com/shaiinarab/pabetoop-club/blob/main/internal/app/app.go) (HTTP application)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_access["Access and portals"]
  node_app["HTTP application<br/>[app.go]"]
  node_auth["Sessions and security<br/>[auth.go]"]
  node_portals["Manager and family portals<br/>[dashboard.go]"]
end

subgraph group_membership["Membership operations"]
  node_members["Plans and family links<br/>[manager_billing.go]"]
  node_operations["Player subscriptions"]
  node_dunning["Reminder scan<br/>[reminders.go]"]
end

subgraph group_money["Billing and payments"]
  node_payments["Payment lifecycle<br/>[payments_v2.go]"]
  node_gateway["Zarinpal gateway<br/>[payments_v2.go]"]
end

subgraph group_platform["Platform capabilities"]
  node_sms["Stub service adapters<br/>[stub.go]"]
  node_identity["White-label identity<br/>[brand.go]"]
  node_analytics["ACWR calculations<br/>[acwr.go]"]
  node_pwa["Installable PWA<br/>[sw.js]"]
  node_backup["Backup integrity checker<br/>[main.rs]"]
  node_database[("PocketBase / SQLite")]
end

node_guardian(("Guardian"))
node_manager(("Manager"))
node_payment_service{{"Zarinpal service"}}

node_guardian -->|"signs in"| node_auth
node_manager -->|"signs in"| node_auth
node_auth -->|"authenticates against"| node_database
node_guardian -->|"views status"| node_portals
node_manager -->|"manages members"| node_portals
node_portals -->|"reads records"| node_database
node_members -->|"writes billing records"| node_database
node_operations -->|"writes subscriptions"| node_database
node_dunning -->|"scans and audits"| node_database
node_guardian -->|"starts invoice payment"| node_payments
node_payments -->|"updates payment records"| node_database
node_payments -->|"starts and verifies"| node_payment_service
node_identity -->|"provides deployment brand"| node_app
node_app -->|"embeds PocketBase"| node_database
node_backup -->|"checks backup contents"| node_database
node_guardian -->|"installs portal"| node_pwa
node_sms -.->|"may send reminders"| node_dunning

click node_app "https://github.com/shaiinarab/pabetoop-club/blob/main/internal/app/app.go"
click node_auth "https://github.com/shaiinarab/pabetoop-club/blob/main/internal/app/auth.go"
click node_portals "https://github.com/shaiinarab/pabetoop-club/blob/main/internal/app/dashboard.go"
click node_members "https://github.com/shaiinarab/pabetoop-club/blob/main/internal/app/manager_billing.go"
click node_operations "https://github.com/shaiinarab/pabetoop-club/blob/main/internal/app/manager_operations.go"
click node_dunning "https://github.com/shaiinarab/pabetoop-club/blob/main/internal/app/reminders.go"
click node_payments "https://github.com/shaiinarab/pabetoop-club/blob/main/internal/app/payments_v2.go"
click node_gateway "https://github.com/shaiinarab/pabetoop-club/blob/main/internal/app/payments_v2.go"
click node_sms "https://github.com/shaiinarab/pabetoop-club/blob/main/internal/adapters/stub.go"
click node_identity "https://github.com/shaiinarab/pabetoop-club/blob/main/internal/brand/brand.go"
click node_analytics "https://github.com/shaiinarab/pabetoop-club/blob/main/internal/domain/acwr.go"
click node_pwa "https://github.com/shaiinarab/pabetoop-club/blob/main/assets/js/sw.js"
click node_backup "https://github.com/shaiinarab/pabetoop-club/blob/main/tools/backup-check/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_app,node_auth,node_portals toneBlue
class node_members,node_operations,node_dunning toneAmber
class node_payments,node_gateway toneMint
class node_sms,node_identity,node_analytics,node_pwa,node_backup,node_database toneRose
class node_guardian,node_manager,node_payment_service toneIndigo
```

## Components

### Access and portals

- [HTTP application](https://github.com/shaiinarab/pabetoop-club/blob/main/internal/app/app.go): `internal/app/app.go`
- [Sessions and security](https://github.com/shaiinarab/pabetoop-club/blob/main/internal/app/auth.go): `internal/app/auth.go`
- [Manager and family portals](https://github.com/shaiinarab/pabetoop-club/blob/main/internal/app/dashboard.go): `internal/app/dashboard.go`

### Membership operations

- [Plans and family links](https://github.com/shaiinarab/pabetoop-club/blob/main/internal/app/manager_billing.go): `internal/app/manager_billing.go`
- [Player subscriptions](https://github.com/shaiinarab/pabetoop-club/blob/main/internal/app/manager_operations.go): `internal/app/manager_operations.go`
- [Reminder scan](https://github.com/shaiinarab/pabetoop-club/blob/main/internal/app/reminders.go): `internal/app/reminders.go`

### Billing and payments

- [Payment lifecycle](https://github.com/shaiinarab/pabetoop-club/blob/main/internal/app/payments_v2.go): `internal/app/payments_v2.go`
- [Zarinpal gateway](https://github.com/shaiinarab/pabetoop-club/blob/main/internal/app/payments_v2.go): `internal/app/payments_v2.go`

### Platform capabilities

- [Stub service adapters](https://github.com/shaiinarab/pabetoop-club/blob/main/internal/adapters/stub.go): `internal/adapters/stub.go`
- [White-label identity](https://github.com/shaiinarab/pabetoop-club/blob/main/internal/brand/brand.go): `internal/brand/brand.go`
- [ACWR calculations](https://github.com/shaiinarab/pabetoop-club/blob/main/internal/domain/acwr.go): `internal/domain/acwr.go`
- [Installable PWA](https://github.com/shaiinarab/pabetoop-club/blob/main/assets/js/sw.js): `assets/js/sw.js`
- [Backup integrity checker](https://github.com/shaiinarab/pabetoop-club/blob/main/tools/backup-check/src/main.rs): `tools/backup-check/src/main.rs`
- **PocketBase / SQLite**

### Other components

- **Guardian**
- **Manager**
- **Zarinpal service**

## Connections

- Guardian → Sessions and security: signs in (evidence: `internal/app/auth.go`)
- Manager → Sessions and security: signs in (evidence: `internal/app/auth.go`)
- Sessions and security → PocketBase / SQLite: authenticates against (evidence: `internal/app/auth.go`)
- Guardian → Manager and family portals: views status (evidence: `README.md`)
- Manager → Manager and family portals: manages members (evidence: `README.md`)
- Manager and family portals → PocketBase / SQLite: reads records (evidence: `internal/app/dashboard.go`)
- Plans and family links → PocketBase / SQLite: writes billing records (evidence: `internal/app/manager_billing.go`)
- Player subscriptions → PocketBase / SQLite: writes subscriptions (evidence: `internal/app/manager_operations.go`)
- Reminder scan → PocketBase / SQLite: scans and audits (evidence: `README.md`)
- Guardian → Payment lifecycle: starts invoice payment (evidence: `README.md`)
- Payment lifecycle → PocketBase / SQLite: updates payment records (evidence: `internal/app/payments_v2.go`)
- Payment lifecycle → Zarinpal service: starts and verifies (evidence: `README.md`)
- White-label identity → HTTP application: provides deployment brand (evidence: `internal/app/app.go`)
- HTTP application → PocketBase / SQLite: embeds PocketBase (evidence: `README.md`)
- Backup integrity checker → PocketBase / SQLite: checks backup contents (evidence: `README.md`)
- Guardian → Installable PWA: installs portal (evidence: `README.md`)
- Stub service adapters → Reminder scan: may send reminders
