# meshlinkfoundation/broker architecture

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

- Interactive diagram: https://gitdiagram.com/meshlinkfoundation/broker
- Repository: https://github.com/meshlinkfoundation/broker

## Overview

meshlink Broker serves a captive-portal experience for Wi-Fi clients and an operator dashboard for access, payments, profiles, and analytics. A client loads its portal skin or operator route, requests configuration and API actions, and the Express routes coordinate tier/profile selection, payment verification, session persistence, and network authorization. The README documents Stripe Checkout and optional portal HTTPS; the indexed source also identifies on-chain payment and TLS modules. Some subsystems are represented at directory level because their implementations were not sampled; links are included only where README or excerpts establish them.

Main entry points: [`server/routes.ts`](https://github.com/meshlinkfoundation/broker/blob/main/server/routes.ts) (REST routes), [`client/src/App.tsx`](https://github.com/meshlinkfoundation/broker/blob/main/client/src/App.tsx) (App routing), [`server/index.ts`](https://github.com/meshlinkfoundation/broker/blob/main/server/index.ts) (Express bootstrap), [`client/src/pages/basic-captive-portal.tsx`](https://github.com/meshlinkfoundation/broker/blob/main/client/src/pages/basic-captive-portal.tsx) (Captive portal)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Portal and admin UI"]
  node_app["App routing<br/>[App.tsx]"]
  node_portal["Captive portal"]
  node_profile_portal["Profile portal skins"]
  node_payment_ui["Payment interface"]
  node_network_ui["Network status<br/>[hotspot-status.tsx]"]
  node_admin_ui["Admin dashboard"]
  node_dashboard_ui["User dashboard<br/>[dashboard.tsx]"]
  node_query["API query client<br/>[queryClient.ts]"]
end

subgraph group_api["Broker API"]
  node_entry["Express bootstrap<br/>[index.ts]"]
  node_routes["REST routes<br/>[routes.ts]"]
end

subgraph group_access["Access and profiles"]
  node_network["Network enforcement<br/>[network-manager.ts]"]
  node_profiles["Service profiles"]
  node_https["Portal HTTPS<br/>[portal-tls.ts]"]
end

subgraph group_payments["Payment integrations"]
  node_chain["Chain client<br/>[chain-client.ts]"]
  node_listener["Payment listener"]
  node_stripe["Stripe Checkout"]
end

subgraph group_storage["Persistence"]
  node_storage_api["Storage interface<br/>[storage.ts]"]
  node_sqlite[("SQLite storage<br/>[sqlite-storage.ts]")]
  node_schema["Domain schema<br/>[schema.ts]"]
end

node_device(("Wi-Fi client"))
node_operator(("Operator"))

node_device -->|"opens portal"| node_app
node_operator -->|"opens admin"| node_app
node_app -->|"renders default"| node_portal
node_app -->|"selects pirate skin"| node_profile_portal
node_app -->|"routes admin"| node_admin_ui
node_app -->|"routes dashboard"| node_dashboard_ui
node_app -->|"provides queries"| node_query
node_portal -.->|"shows payment"| node_payment_ui
node_entry -->|"registers routes"| node_routes
node_routes -->|"resolves profiles"| node_profiles
node_routes -->|"checks access"| node_network
node_routes -->|"reads TLS config"| node_https
node_entry -->|"configures HTTPS"| node_https
node_routes -->|"reads and writes"| node_storage_api
node_storage_api -->|"uses implementation"| node_sqlite
node_sqlite -->|"stores domain records"| node_schema
node_routes -->|"dispatches payment"| node_listener
node_listener -->|"uses chain client"| node_chain
node_routes -.->|"creates checkout"| node_stripe
node_query -.->|"requests API"| node_routes
node_routes -->|"enforces tier access"| node_network

click node_app "https://github.com/meshlinkfoundation/broker/blob/main/client/src/App.tsx"
click node_portal "https://github.com/meshlinkfoundation/broker/blob/main/client/src/pages/basic-captive-portal.tsx"
click node_profile_portal "https://github.com/meshlinkfoundation/broker/blob/main/client/src/pages/pirate-captive-portal.tsx"
click node_payment_ui "https://github.com/meshlinkfoundation/broker/blob/main/client/src/components/payment-interface.tsx"
click node_network_ui "https://github.com/meshlinkfoundation/broker/blob/main/client/src/components/hotspot-status.tsx"
click node_admin_ui "https://github.com/meshlinkfoundation/broker/blob/main/client/src/pages/admin-dashboard.tsx"
click node_dashboard_ui "https://github.com/meshlinkfoundation/broker/blob/main/client/src/pages/dashboard.tsx"
click node_query "https://github.com/meshlinkfoundation/broker/blob/main/client/src/lib/queryClient.ts"
click node_entry "https://github.com/meshlinkfoundation/broker/blob/main/server/index.ts"
click node_routes "https://github.com/meshlinkfoundation/broker/blob/main/server/routes.ts"
click node_network "https://github.com/meshlinkfoundation/broker/blob/main/server/network-manager.ts"
click node_profiles "https://github.com/meshlinkfoundation/broker/blob/main/server/service-profiles.ts"
click node_https "https://github.com/meshlinkfoundation/broker/blob/main/server/portal-tls.ts"
click node_chain "https://github.com/meshlinkfoundation/broker/blob/main/server/chain-client.ts"
click node_listener "https://github.com/meshlinkfoundation/broker/blob/main/server/payment-listener.ts"
click node_storage_api "https://github.com/meshlinkfoundation/broker/blob/main/server/storage.ts"
click node_sqlite "https://github.com/meshlinkfoundation/broker/blob/main/server/sqlite-storage.ts"
click node_schema "https://github.com/meshlinkfoundation/broker/blob/main/shared/schema.ts"

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_portal,node_profile_portal,node_payment_ui,node_network_ui,node_admin_ui,node_dashboard_ui,node_query,node_device toneBlue
class node_entry,node_routes toneAmber
class node_network,node_profiles,node_https toneMint
class node_chain,node_listener,node_stripe toneRose
class node_storage_api,node_sqlite,node_schema,node_operator toneIndigo
```

## Components

### Portal and admin UI

- [App routing](https://github.com/meshlinkfoundation/broker/blob/main/client/src/App.tsx): `client/src/App.tsx`
- [Captive portal](https://github.com/meshlinkfoundation/broker/blob/main/client/src/pages/basic-captive-portal.tsx): `client/src/pages/basic-captive-portal.tsx`
- [Profile portal skins](https://github.com/meshlinkfoundation/broker/blob/main/client/src/pages/pirate-captive-portal.tsx): `client/src/pages/pirate-captive-portal.tsx`
- [Payment interface](https://github.com/meshlinkfoundation/broker/blob/main/client/src/components/payment-interface.tsx): `client/src/components/payment-interface.tsx`
- [Network status](https://github.com/meshlinkfoundation/broker/blob/main/client/src/components/hotspot-status.tsx): `client/src/components/hotspot-status.tsx`
- [Admin dashboard](https://github.com/meshlinkfoundation/broker/blob/main/client/src/pages/admin-dashboard.tsx): `client/src/pages/admin-dashboard.tsx`
- [User dashboard](https://github.com/meshlinkfoundation/broker/blob/main/client/src/pages/dashboard.tsx): `client/src/pages/dashboard.tsx`
- [API query client](https://github.com/meshlinkfoundation/broker/blob/main/client/src/lib/queryClient.ts): `client/src/lib/queryClient.ts`

### Broker API

- [Express bootstrap](https://github.com/meshlinkfoundation/broker/blob/main/server/index.ts): `server/index.ts`
- [REST routes](https://github.com/meshlinkfoundation/broker/blob/main/server/routes.ts): `server/routes.ts`

### Access and profiles

- [Network enforcement](https://github.com/meshlinkfoundation/broker/blob/main/server/network-manager.ts): `server/network-manager.ts`
- [Service profiles](https://github.com/meshlinkfoundation/broker/blob/main/server/service-profiles.ts): `server/service-profiles.ts`
- [Portal HTTPS](https://github.com/meshlinkfoundation/broker/blob/main/server/portal-tls.ts): `server/portal-tls.ts`

### Payment integrations

- [Chain client](https://github.com/meshlinkfoundation/broker/blob/main/server/chain-client.ts): `server/chain-client.ts`
- [Payment listener](https://github.com/meshlinkfoundation/broker/blob/main/server/payment-listener.ts): `server/payment-listener.ts`
- **Stripe Checkout**

### Persistence

- [Storage interface](https://github.com/meshlinkfoundation/broker/blob/main/server/storage.ts): `server/storage.ts`
- [SQLite storage](https://github.com/meshlinkfoundation/broker/blob/main/server/sqlite-storage.ts): `server/sqlite-storage.ts`
- [Domain schema](https://github.com/meshlinkfoundation/broker/blob/main/shared/schema.ts): `shared/schema.ts`

### Other components

- **Wi-Fi client**
- **Operator**

## Connections

- Wi-Fi client → App routing: opens portal (evidence: `README.md`)
- Operator → App routing: opens admin (evidence: `README.md`)
- App routing → Captive portal: renders default (evidence: `client/src/App.tsx`)
- App routing → Profile portal skins: selects pirate skin (evidence: `client/src/App.tsx`)
- App routing → Admin dashboard: routes admin (evidence: `client/src/App.tsx`)
- App routing → User dashboard: routes dashboard (evidence: `client/src/App.tsx`)
- App routing → API query client: provides queries (evidence: `client/src/App.tsx`)
- Captive portal → Payment interface: shows payment
- Express bootstrap → REST routes: registers routes (evidence: `server/index.ts`)
- REST routes → Service profiles: resolves profiles (evidence: `server/routes.ts`)
- REST routes → Network enforcement: checks access (evidence: `server/routes.ts`)
- REST routes → Portal HTTPS: reads TLS config (evidence: `server/routes.ts`)
- Express bootstrap → Portal HTTPS: configures HTTPS (evidence: `server/index.ts`)
- REST routes → Storage interface: reads and writes (evidence: `server/routes.ts`)
- Storage interface → SQLite storage: uses implementation (evidence: `server/storage.ts`)
- SQLite storage → Domain schema: stores domain records (evidence: `server/sqlite-storage.ts`)
- REST routes → Payment listener: dispatches payment (evidence: `server/routes.ts`)
- Payment listener → Chain client: uses chain client (evidence: `server/payment-listener.ts`)
- REST routes → Stripe Checkout: creates checkout (evidence: `README.md`)
- API query client → REST routes: requests API
- REST routes → Network enforcement: enforces tier access (evidence: `README.md`)
