# solana-thailand/bethere architecture

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

- Interactive diagram: https://gitdiagram.com/solana-thailand/bethere
- Repository: https://github.com/solana-thailand/bethere

## Overview

BeThere is an event-management and check-in platform whose central workflow is event setup, attendee registration and deposit, staff check-in, then refund or forfeiture and an attendance badge. The Leptos frontend calls a Cloudflare Worker API; shared domain types support both. The repository also includes event discovery and recaps, admin tools, campaigns and learning adventures, and an on-chain escrow program. The graph reflects the README and sampled entry points; several broader subsystem connections are documented capabilities rather than inspected call sites.

Main entry points: [`worker/src/lib.rs`](https://github.com/solana-thailand/bethere/blob/main/worker/src/lib.rs) (HTTP worker), [`frontend-leptos/src/lib.rs`](https://github.com/solana-thailand/bethere/blob/main/frontend-leptos/src/lib.rs) (Leptos application), [`frontend-leptos/src/api`](https://github.com/solana-thailand/bethere/tree/main/frontend-leptos/src/api) (API client), [`worker/src/db`](https://github.com/solana-thailand/bethere/tree/main/worker/src/db) (Worker database)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["User experience"]
  node_frontend["Leptos application<br/>[lib.rs]"]
  node_event_pages["Discovery and events"]
  node_registration_pages["Registration and deposit"]
  node_checkin_pages["Ticket and check-in"]
  node_admin_pages["Admin and reports<br/>[admin.rs]"]
  node_adventure_pages["Adventure game"]
  node_frontend_api["API client"]
end

subgraph group_api["Worker API"]
  node_worker["HTTP worker<br/>[lib.rs]"]
  node_auth["Authentication<br/>[auth.rs]"]
end

subgraph group_operations["Event operations"]
  node_event_handlers["Event management"]
  node_registration_handlers["Registration and attendance"]
  node_checkin_handlers["Check-in and attendees<br/>[checkin.rs]"]
  node_campaigns["Campaigns and progress<br/>[campaigns.rs]"]
  node_adventure["Adventure service<br/>[adventure.rs]"]
  node_event_store[("Event store")]
  node_d1[("Worker database")]
  node_sheets["Google Sheets"]
  node_r2[("Asset storage<br/>[storage.rs]")]
end

subgraph group_payments["Deposits and chain"]
  node_deposit_handlers["Deposit workflows"]
  node_claim["Claim and mint"]
  node_escrow["Escrow program<br/>[lib.rs]"]
  node_solana_builders["Solana transactions"]
  node_indexer["Escrow indexer"]
end

subgraph group_shared["Shared domain"]
  node_domain["Shared models and rules<br/>[lib.rs]"]
end

node_attendee(("Attendee"))
node_organizer(("Organizer / staff"))
node_solana{{"Solana network"}}
node_helius{{"Helius webhooks"}}
node_google{{"Google Sheets service"}}
node_nft{{"NFT mint service"}}

node_attendee -->|"uses"| node_frontend
node_organizer -->|"manages events"| node_frontend
node_frontend -->|"renders"| node_event_pages
node_frontend -->|"renders"| node_registration_pages
node_frontend -->|"renders"| node_checkin_pages
node_frontend -->|"renders"| node_admin_pages
node_frontend -->|"renders"| node_adventure_pages
node_event_pages -->|"requests event data"| node_frontend_api
node_registration_pages -->|"requests deposits"| node_frontend_api
node_checkin_pages -->|"requests check-in"| node_frontend_api
node_admin_pages -->|"requests admin actions"| node_frontend_api
node_adventure_pages -->|"requests adventure data"| node_frontend_api
node_frontend_api -->|"calls API"| node_worker
node_worker -->|"dispatches"| node_auth
node_worker -->|"dispatches"| node_event_handlers
node_worker -->|"dispatches"| node_registration_handlers
node_worker -->|"dispatches"| node_checkin_handlers
node_worker -->|"dispatches"| node_deposit_handlers
node_worker -->|"dispatches"| node_campaigns
node_worker -->|"dispatches"| node_adventure
node_event_handlers -->|"reads and writes"| node_event_store
node_event_store -->|"persists data"| node_d1
node_registration_handlers -->|"reads and writes"| node_d1
node_checkin_handlers -->|"reads and writes"| node_d1
node_checkin_handlers -->|"syncs attendance"| node_sheets
node_deposit_handlers -->|"reads and writes"| node_d1
node_deposit_handlers -->|"builds transactions"| node_solana_builders
node_solana_builders -->|"submits transactions"| node_solana
node_solana -->|"executes instructions"| node_escrow
node_claim -->|"reads and writes"| node_d1
node_claim -.->|"mints badge"| node_nft
node_indexer -->|"stores indexed events"| node_d1
node_helius -.->|"sends transactions"| node_indexer
node_worker -->|"stores and serves assets"| node_r2
node_event_handlers -->|"uses shared models"| node_domain
node_registration_handlers -->|"uses shared models"| node_domain
node_deposit_handlers -->|"uses shared models"| node_domain
node_sheets -.->|"reads and writes"| node_google

click node_frontend "https://github.com/solana-thailand/bethere/blob/main/frontend-leptos/src/lib.rs"
click node_event_pages "https://github.com/solana-thailand/bethere/tree/main/frontend-leptos/src/pages/public"
click node_registration_pages "https://github.com/solana-thailand/bethere/tree/main/frontend-leptos/src/pages/deposit"
click node_checkin_pages "https://github.com/solana-thailand/bethere/tree/main/frontend-leptos/src/pages/scanner"
click node_admin_pages "https://github.com/solana-thailand/bethere/blob/main/frontend-leptos/src/pages/admin.rs"
click node_adventure_pages "https://github.com/solana-thailand/bethere/tree/main/frontend-leptos/src/pages/adventure"
click node_frontend_api "https://github.com/solana-thailand/bethere/tree/main/frontend-leptos/src/api"
click node_worker "https://github.com/solana-thailand/bethere/blob/main/worker/src/lib.rs"
click node_auth "https://github.com/solana-thailand/bethere/blob/main/worker/src/handlers/auth.rs"
click node_event_handlers "https://github.com/solana-thailand/bethere/tree/main/worker/src/handlers/events"
click node_registration_handlers "https://github.com/solana-thailand/bethere/tree/main/worker/src/handlers/register"
click node_checkin_handlers "https://github.com/solana-thailand/bethere/blob/main/worker/src/handlers/checkin.rs"
click node_campaigns "https://github.com/solana-thailand/bethere/blob/main/worker/src/handlers/campaigns.rs"
click node_adventure "https://github.com/solana-thailand/bethere/blob/main/worker/src/handlers/adventure.rs"
click node_event_store "https://github.com/solana-thailand/bethere/tree/main/worker/src/event_store"
click node_d1 "https://github.com/solana-thailand/bethere/tree/main/worker/src/db"
click node_sheets "https://github.com/solana-thailand/bethere/tree/main/worker/src/sheets"
click node_deposit_handlers "https://github.com/solana-thailand/bethere/tree/main/worker/src/handlers/deposit"
click node_claim "https://github.com/solana-thailand/bethere/tree/main/worker/src/claim"
click node_escrow "https://github.com/solana-thailand/bethere/blob/main/bethere-escrow/src/lib.rs"
click node_solana_builders "https://github.com/solana-thailand/bethere/tree/main/worker/src/solana_escrow/tx_builders"
click node_indexer "https://github.com/solana-thailand/bethere/tree/main/worker/src/escrow_indexer"
click node_r2 "https://github.com/solana-thailand/bethere/blob/main/worker/src/storage.rs"
click node_domain "https://github.com/solana-thailand/bethere/blob/main/domain/src/lib.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_frontend,node_event_pages,node_registration_pages,node_checkin_pages,node_admin_pages,node_adventure_pages,node_frontend_api toneBlue
class node_worker,node_auth toneAmber
class node_event_handlers,node_registration_handlers,node_checkin_handlers,node_campaigns,node_adventure,node_event_store,node_d1,node_sheets,node_r2,node_helius toneMint
class node_deposit_handlers,node_claim,node_escrow,node_solana_builders,node_indexer toneRose
class node_domain,node_attendee,node_organizer,node_solana,node_google,node_nft toneIndigo
```

## Components

### User experience

- [Leptos application](https://github.com/solana-thailand/bethere/blob/main/frontend-leptos/src/lib.rs): `frontend-leptos/src/lib.rs`
- [Discovery and events](https://github.com/solana-thailand/bethere/tree/main/frontend-leptos/src/pages/public): `frontend-leptos/src/pages/public`
- [Registration and deposit](https://github.com/solana-thailand/bethere/tree/main/frontend-leptos/src/pages/deposit): `frontend-leptos/src/pages/deposit`
- [Ticket and check-in](https://github.com/solana-thailand/bethere/tree/main/frontend-leptos/src/pages/scanner): `frontend-leptos/src/pages/scanner`
- [Admin and reports](https://github.com/solana-thailand/bethere/blob/main/frontend-leptos/src/pages/admin.rs): `frontend-leptos/src/pages/admin.rs`
- [Adventure game](https://github.com/solana-thailand/bethere/tree/main/frontend-leptos/src/pages/adventure): `frontend-leptos/src/pages/adventure`
- [API client](https://github.com/solana-thailand/bethere/tree/main/frontend-leptos/src/api): `frontend-leptos/src/api`

### Worker API

- [HTTP worker](https://github.com/solana-thailand/bethere/blob/main/worker/src/lib.rs): `worker/src/lib.rs`
- [Authentication](https://github.com/solana-thailand/bethere/blob/main/worker/src/handlers/auth.rs): `worker/src/handlers/auth.rs`

### Event operations

- [Event management](https://github.com/solana-thailand/bethere/tree/main/worker/src/handlers/events): `worker/src/handlers/events`
- [Registration and attendance](https://github.com/solana-thailand/bethere/tree/main/worker/src/handlers/register): `worker/src/handlers/register`
- [Check-in and attendees](https://github.com/solana-thailand/bethere/blob/main/worker/src/handlers/checkin.rs): `worker/src/handlers/checkin.rs`
- [Campaigns and progress](https://github.com/solana-thailand/bethere/blob/main/worker/src/handlers/campaigns.rs): `worker/src/handlers/campaigns.rs`
- [Adventure service](https://github.com/solana-thailand/bethere/blob/main/worker/src/handlers/adventure.rs): `worker/src/handlers/adventure.rs`
- [Event store](https://github.com/solana-thailand/bethere/tree/main/worker/src/event_store): `worker/src/event_store`
- [Worker database](https://github.com/solana-thailand/bethere/tree/main/worker/src/db): `worker/src/db`
- [Google Sheets](https://github.com/solana-thailand/bethere/tree/main/worker/src/sheets): `worker/src/sheets`
- [Asset storage](https://github.com/solana-thailand/bethere/blob/main/worker/src/storage.rs): `worker/src/storage.rs`

### Deposits and chain

- [Deposit workflows](https://github.com/solana-thailand/bethere/tree/main/worker/src/handlers/deposit): `worker/src/handlers/deposit`
- [Claim and mint](https://github.com/solana-thailand/bethere/tree/main/worker/src/claim): `worker/src/claim`
- [Escrow program](https://github.com/solana-thailand/bethere/blob/main/bethere-escrow/src/lib.rs): `bethere-escrow/src/lib.rs`
- [Solana transactions](https://github.com/solana-thailand/bethere/tree/main/worker/src/solana_escrow/tx_builders): `worker/src/solana_escrow/tx_builders`
- [Escrow indexer](https://github.com/solana-thailand/bethere/tree/main/worker/src/escrow_indexer): `worker/src/escrow_indexer`

### Shared domain

- [Shared models and rules](https://github.com/solana-thailand/bethere/blob/main/domain/src/lib.rs): `domain/src/lib.rs`

### Other components

- **Attendee**
- **Organizer / staff**
- **Solana network**
- **Helius webhooks**
- **Google Sheets service**
- **NFT mint service**

## Connections

- Attendee → Leptos application: uses
- Organizer / staff → Leptos application: manages events
- Leptos application → Discovery and events: renders
- Leptos application → Registration and deposit: renders
- Leptos application → Ticket and check-in: renders
- Leptos application → Admin and reports: renders
- Leptos application → Adventure game: renders
- Discovery and events → API client: requests event data
- Registration and deposit → API client: requests deposits
- Ticket and check-in → API client: requests check-in
- Admin and reports → API client: requests admin actions
- Adventure game → API client: requests adventure data
- API client → HTTP worker: calls API
- HTTP worker → Authentication: dispatches
- HTTP worker → Event management: dispatches
- HTTP worker → Registration and attendance: dispatches
- HTTP worker → Check-in and attendees: dispatches
- HTTP worker → Deposit workflows: dispatches
- HTTP worker → Campaigns and progress: dispatches
- HTTP worker → Adventure service: dispatches
- Event management → Event store: reads and writes
- Event store → Worker database: persists data
- Registration and attendance → Worker database: reads and writes
- Check-in and attendees → Worker database: reads and writes
- Check-in and attendees → Google Sheets: syncs attendance
- Deposit workflows → Worker database: reads and writes
- Deposit workflows → Solana transactions: builds transactions
- Solana transactions → Solana network: submits transactions
- Solana network → Escrow program: executes instructions
- Claim and mint → Worker database: reads and writes
- Claim and mint → NFT mint service: mints badge
- Escrow indexer → Worker database: stores indexed events
- Helius webhooks → Escrow indexer: sends transactions
- HTTP worker → Asset storage: stores and serves assets
- Event management → Shared models and rules: uses shared models
- Registration and attendance → Shared models and rules: uses shared models
- Deposit workflows → Shared models and rules: uses shared models
- Google Sheets → Google Sheets service: reads and writes
