# nou254/nou-hotspot-billing-system architecture

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

- Interactive diagram: https://gitdiagram.com/nou254/nou-hotspot-billing-system
- Repository: https://github.com/nou254/nou-hotspot-billing-system

## Overview

N.O.U. Hotspot Biller is a multi-tenant billing and hotspot-access platform for ISPs, their subscribers, and platform staff. Its backend exposes authenticated ISP, subscriber, and superadmin APIs alongside public signup and captive-portal endpoints; domain services and workers support billing, payments, provisioning, and reporting. The source excerpts show application startup, tenant-session resolution, and role authorization, but not the detailed wiring from frontend screens into API operations or most service implementations, so those links are not asserted.

Main entry points: [`nou-hotspot-biller/backend/src/nou/main.py`](https://github.com/nou254/nou-hotspot-billing-system/blob/main/nou-hotspot-biller/backend/src/nou/main.py) (API application), [`nou-hotspot-biller/backend/src/nou/api/v1/isp/routes.py`](https://github.com/nou254/nou-hotspot-billing-system/blob/main/nou-hotspot-biller/backend/src/nou/api/v1/isp/routes.py) (ISP management API), [`nou-hotspot-biller/backend/src/nou/services/payments.py`](https://github.com/nou254/nou-hotspot-billing-system/blob/main/nou-hotspot-biller/backend/src/nou/services/payments.py) (Payment services), [`nou-hotspot-biller/backend/src/nou/api/deps/auth.py`](https://github.com/nou254/nou-hotspot-billing-system/blob/main/nou-hotspot-biller/backend/src/nou/api/deps/auth.py) (Role authorization)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_clients["User applications"]
  node_captive_ui["Captive portal<br/>[page.tsx]"]
  node_customer_ui["Customer portal<br/>[page.tsx]"]
  node_isp_ui["ISP admin<br/>[page.tsx]"]
  node_superadmin_ui["Superadmin console<br/>[page.tsx]"]
end

subgraph group_api["API and access"]
  node_app["API application<br/>[main.py]"]
  node_authz["Role authorization<br/>[auth.py]"]
  node_tenant_context["Tenant context<br/>[tenant_context.py]"]
  node_public_api["Public signup and plans<br/>[routes.py]"]
  node_captive_api["Captive access API<br/>[routes.py]"]
  node_customer_api["Subscriber portal API<br/>[routes.py]"]
  node_isp_api["ISP management API<br/>[routes.py]"]
  node_superadmin_api["Platform admin API<br/>[routes.py]"]
end

subgraph group_billing["Billing and subscriber domains"]
  node_payment_services["Payment services<br/>[payments.py]"]
  node_subscriber_services["Subscriber lifecycle<br/>[lifecycle.py]"]
  node_provisioning["Network provisioning<br/>[provisioning.py]"]
end

subgraph group_operations["Platform operations"]
  node_reporting["Reports and analytics<br/>[reporting.py]"]
  node_workers["Background workers<br/>[tasks.py]"]
  node_adapters["Payment and network adapters<br/>[payment.py]"]
end

subgraph group_storage["Persistence and infrastructure"]
  node_tenant_sessions["Tenant sessions<br/>[tenant_session.py]"]
  node_database[("PostgreSQL<br/>[database.py]")]
  node_redis[("Redis<br/>[redis.py]")]
  node_jwt["JWT security<br/>[jwt.py]"]
end

node_visitor(("Hotspot visitor"))
node_subscriber(("Subscriber"))
node_isp_staff(("ISP staff"))
node_platform_staff(("Platform staff"))

node_app -.->|"routes via"| node_public_api
node_app -.->|"routes via"| node_captive_api
node_app -.->|"routes via"| node_customer_api
node_app -.->|"routes via"| node_isp_api
node_app -.->|"routes via"| node_superadmin_api
node_app -->|"configures"| node_database
node_app -->|"closes"| node_redis
node_app -.->|"uses"| node_authz
node_app -.->|"uses"| node_tenant_context
node_authz -->|"checks claims"| node_jwt
node_tenant_context -->|"opens session"| node_tenant_sessions
node_tenant_context -->|"looks up tenant"| node_database
node_isp_api -->|"requires roles"| node_authz
node_superadmin_api -->|"requires roles"| node_authz
node_public_api -.-> node_captive_api
node_customer_api -.->|"delegates"| node_payment_services
node_isp_api -.->|"delegates"| node_subscriber_services
node_isp_api -.->|"delegates"| node_provisioning
node_isp_api -->|"delegates"| node_reporting
node_workers -.->|"processes"| node_payment_services
node_payment_services -.->|"uses"| node_adapters
node_payment_services -.->|"uses"| node_tenant_sessions
node_reporting -.->|"uses"| node_tenant_sessions
node_captive_ui -.->|"serves"| node_visitor
node_customer_ui -.->|"serves"| node_subscriber
node_isp_ui -.->|"serves"| node_isp_staff
node_superadmin_ui -.->|"serves"| node_platform_staff

click node_captive_ui "https://github.com/nou254/nou-hotspot-billing-system/blob/main/nou-hotspot-biller/frontend/apps/captive/src/app/page.tsx"
click node_customer_ui "https://github.com/nou254/nou-hotspot-billing-system/blob/main/nou-hotspot-biller/frontend/apps/customer/src/app/dashboard/page.tsx"
click node_isp_ui "https://github.com/nou254/nou-hotspot-billing-system/blob/main/nou-hotspot-biller/frontend/apps/isp-admin/src/app/onboarding/page.tsx"
click node_superadmin_ui "https://github.com/nou254/nou-hotspot-billing-system/blob/main/nou-hotspot-biller/apps/superadmin/src/app/dashboard/page.tsx"
click node_app "https://github.com/nou254/nou-hotspot-billing-system/blob/main/nou-hotspot-biller/backend/src/nou/main.py"
click node_authz "https://github.com/nou254/nou-hotspot-billing-system/blob/main/nou-hotspot-biller/backend/src/nou/api/deps/auth.py"
click node_tenant_context "https://github.com/nou254/nou-hotspot-billing-system/blob/main/nou-hotspot-biller/backend/src/nou/api/deps/tenant_context.py"
click node_public_api "https://github.com/nou254/nou-hotspot-billing-system/blob/main/nou-hotspot-biller/backend/src/nou/api/v1/public/routes.py"
click node_captive_api "https://github.com/nou254/nou-hotspot-billing-system/blob/main/nou-hotspot-biller/backend/src/nou/api/v1/captive/routes.py"
click node_customer_api "https://github.com/nou254/nou-hotspot-billing-system/blob/main/nou-hotspot-biller/backend/src/nou/api/v1/customer/routes.py"
click node_isp_api "https://github.com/nou254/nou-hotspot-billing-system/blob/main/nou-hotspot-biller/backend/src/nou/api/v1/isp/routes.py"
click node_superadmin_api "https://github.com/nou254/nou-hotspot-billing-system/blob/main/nou-hotspot-biller/backend/src/nou/api/v1/superadmin/routes.py"
click node_payment_services "https://github.com/nou254/nou-hotspot-billing-system/blob/main/nou-hotspot-biller/backend/src/nou/services/payments.py"
click node_subscriber_services "https://github.com/nou254/nou-hotspot-billing-system/blob/main/nou-hotspot-biller/backend/src/nou/services/lifecycle.py"
click node_provisioning "https://github.com/nou254/nou-hotspot-billing-system/blob/main/nou-hotspot-biller/backend/src/nou/services/provisioning.py"
click node_reporting "https://github.com/nou254/nou-hotspot-billing-system/blob/main/nou-hotspot-biller/backend/src/nou/services/reporting.py"
click node_workers "https://github.com/nou254/nou-hotspot-billing-system/blob/main/nou-hotspot-biller/backend/src/nou/workers/tasks.py"
click node_tenant_sessions "https://github.com/nou254/nou-hotspot-billing-system/blob/main/nou-hotspot-biller/backend/src/nou/core/tenant_session.py"
click node_database "https://github.com/nou254/nou-hotspot-billing-system/blob/main/nou-hotspot-biller/backend/src/nou/core/database.py"
click node_redis "https://github.com/nou254/nou-hotspot-billing-system/blob/main/nou-hotspot-biller/backend/src/nou/core/redis.py"
click node_jwt "https://github.com/nou254/nou-hotspot-billing-system/blob/main/nou-hotspot-biller/backend/src/nou/core/security/jwt.py"
click node_adapters "https://github.com/nou254/nou-hotspot-billing-system/blob/main/nou-hotspot-biller/backend/src/nou/adapters/payment.py"

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_captive_ui,node_customer_ui,node_isp_ui,node_superadmin_ui toneBlue
class node_app,node_authz,node_tenant_context,node_public_api,node_captive_api,node_customer_api,node_isp_api,node_superadmin_api toneAmber
class node_payment_services,node_subscriber_services,node_provisioning toneMint
class node_reporting,node_workers,node_adapters toneRose
class node_tenant_sessions,node_database,node_redis,node_jwt,node_visitor,node_subscriber,node_isp_staff,node_platform_staff toneIndigo
```

## Components

### User applications

- [Captive portal](https://github.com/nou254/nou-hotspot-billing-system/blob/main/nou-hotspot-biller/frontend/apps/captive/src/app/page.tsx): `nou-hotspot-biller/frontend/apps/captive/src/app/page.tsx`
- [Customer portal](https://github.com/nou254/nou-hotspot-billing-system/blob/main/nou-hotspot-biller/frontend/apps/customer/src/app/dashboard/page.tsx): `nou-hotspot-biller/frontend/apps/customer/src/app/dashboard/page.tsx`
- [ISP admin](https://github.com/nou254/nou-hotspot-billing-system/blob/main/nou-hotspot-biller/frontend/apps/isp-admin/src/app/onboarding/page.tsx): `nou-hotspot-biller/frontend/apps/isp-admin/src/app/onboarding/page.tsx`
- [Superadmin console](https://github.com/nou254/nou-hotspot-billing-system/blob/main/nou-hotspot-biller/apps/superadmin/src/app/dashboard/page.tsx): `nou-hotspot-biller/apps/superadmin/src/app/dashboard/page.tsx`

### API and access

- [API application](https://github.com/nou254/nou-hotspot-billing-system/blob/main/nou-hotspot-biller/backend/src/nou/main.py): `nou-hotspot-biller/backend/src/nou/main.py`
- [Role authorization](https://github.com/nou254/nou-hotspot-billing-system/blob/main/nou-hotspot-biller/backend/src/nou/api/deps/auth.py): `nou-hotspot-biller/backend/src/nou/api/deps/auth.py`
- [Tenant context](https://github.com/nou254/nou-hotspot-billing-system/blob/main/nou-hotspot-biller/backend/src/nou/api/deps/tenant_context.py): `nou-hotspot-biller/backend/src/nou/api/deps/tenant_context.py`
- [Public signup and plans](https://github.com/nou254/nou-hotspot-billing-system/blob/main/nou-hotspot-biller/backend/src/nou/api/v1/public/routes.py): `nou-hotspot-biller/backend/src/nou/api/v1/public/routes.py`
- [Captive access API](https://github.com/nou254/nou-hotspot-billing-system/blob/main/nou-hotspot-biller/backend/src/nou/api/v1/captive/routes.py): `nou-hotspot-biller/backend/src/nou/api/v1/captive/routes.py`
- [Subscriber portal API](https://github.com/nou254/nou-hotspot-billing-system/blob/main/nou-hotspot-biller/backend/src/nou/api/v1/customer/routes.py): `nou-hotspot-biller/backend/src/nou/api/v1/customer/routes.py`
- [ISP management API](https://github.com/nou254/nou-hotspot-billing-system/blob/main/nou-hotspot-biller/backend/src/nou/api/v1/isp/routes.py): `nou-hotspot-biller/backend/src/nou/api/v1/isp/routes.py`
- [Platform admin API](https://github.com/nou254/nou-hotspot-billing-system/blob/main/nou-hotspot-biller/backend/src/nou/api/v1/superadmin/routes.py): `nou-hotspot-biller/backend/src/nou/api/v1/superadmin/routes.py`

### Billing and subscriber domains

- [Payment services](https://github.com/nou254/nou-hotspot-billing-system/blob/main/nou-hotspot-biller/backend/src/nou/services/payments.py): `nou-hotspot-biller/backend/src/nou/services/payments.py`
- [Subscriber lifecycle](https://github.com/nou254/nou-hotspot-billing-system/blob/main/nou-hotspot-biller/backend/src/nou/services/lifecycle.py): `nou-hotspot-biller/backend/src/nou/services/lifecycle.py`
- [Network provisioning](https://github.com/nou254/nou-hotspot-billing-system/blob/main/nou-hotspot-biller/backend/src/nou/services/provisioning.py): `nou-hotspot-biller/backend/src/nou/services/provisioning.py`

### Platform operations

- [Reports and analytics](https://github.com/nou254/nou-hotspot-billing-system/blob/main/nou-hotspot-biller/backend/src/nou/services/reporting.py): `nou-hotspot-biller/backend/src/nou/services/reporting.py`
- [Background workers](https://github.com/nou254/nou-hotspot-billing-system/blob/main/nou-hotspot-biller/backend/src/nou/workers/tasks.py): `nou-hotspot-biller/backend/src/nou/workers/tasks.py`
- [Payment and network adapters](https://github.com/nou254/nou-hotspot-billing-system/blob/main/nou-hotspot-biller/backend/src/nou/adapters/payment.py): `nou-hotspot-biller/backend/src/nou/adapters/payment.py`

### Persistence and infrastructure

- [Tenant sessions](https://github.com/nou254/nou-hotspot-billing-system/blob/main/nou-hotspot-biller/backend/src/nou/core/tenant_session.py): `nou-hotspot-biller/backend/src/nou/core/tenant_session.py`
- [PostgreSQL](https://github.com/nou254/nou-hotspot-billing-system/blob/main/nou-hotspot-biller/backend/src/nou/core/database.py): `nou-hotspot-biller/backend/src/nou/core/database.py`
- [Redis](https://github.com/nou254/nou-hotspot-billing-system/blob/main/nou-hotspot-biller/backend/src/nou/core/redis.py): `nou-hotspot-biller/backend/src/nou/core/redis.py`
- [JWT security](https://github.com/nou254/nou-hotspot-billing-system/blob/main/nou-hotspot-biller/backend/src/nou/core/security/jwt.py): `nou-hotspot-biller/backend/src/nou/core/security/jwt.py`

### Other components

- **Hotspot visitor**
- **Subscriber**
- **ISP staff**
- **Platform staff**

## Connections

- API application → Public signup and plans: routes via
- API application → Captive access API: routes via
- API application → Subscriber portal API: routes via
- API application → ISP management API: routes via
- API application → Platform admin API: routes via
- API application → PostgreSQL: configures (evidence: `nou-hotspot-biller/backend/src/nou/main.py`)
- API application → Redis: closes (evidence: `nou-hotspot-biller/backend/src/nou/main.py`)
- API application → Role authorization: uses
- API application → Tenant context: uses
- Role authorization → JWT security: checks claims (evidence: `nou-hotspot-biller/backend/src/nou/api/deps/auth.py`)
- Tenant context → Tenant sessions: opens session (evidence: `nou-hotspot-biller/backend/src/nou/api/deps/tenant_context.py`)
- Tenant context → PostgreSQL: looks up tenant (evidence: `nou-hotspot-biller/backend/src/nou/api/deps/tenant_context.py`)
- ISP management API → Role authorization: requires roles (evidence: `nou-hotspot-biller/backend/src/nou/api/v1/isp/routes.py`)
- Platform admin API → Role authorization: requires roles (evidence: `nou-hotspot-biller/backend/src/nou/api/v1/superadmin/routes.py`)
- Public signup and plans → Captive access API
- Subscriber portal API → Payment services: delegates
- ISP management API → Subscriber lifecycle: delegates
- ISP management API → Network provisioning: delegates
- ISP management API → Reports and analytics: delegates
- Background workers → Payment services: processes
- Payment services → Payment and network adapters: uses (evidence: `nou-hotspot-biller/backend/src/nou/services/payments.py`)
- Payment services → Tenant sessions: uses
- Reports and analytics → Tenant sessions: uses
- Captive portal → Hotspot visitor: serves
- Customer portal → Subscriber: serves
- ISP admin → ISP staff: serves
- Superadmin console → Platform staff: serves
