# frappe/central architecture

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

- Interactive diagram: https://gitdiagram.com/frappe/central
- Repository: https://github.com/frappe/central

## Overview

Central is Frappe Cloud v2’s control plane, with a Frappe backend and Vue console. The main user journey is managing a team’s identity and resources, provisioning services such as object storage, and viewing or paying for resulting usage and bills. Billing spans catalog and subscription intent, metering, invoicing, payment collection, and reporting; additional branches cover server/site operations, notifications, and SSO. The graph uses documented product scope and shown imports/calls; paths for unsampled subsystems come from the tree, and their internal links are omitted where evidence is unavailable.

Main entry points: [`central/billing/payments/charges.py`](https://github.com/frappe/central/blob/develop/central/billing/payments/charges.py) (Invoice charges), [`central/billing/catalog/subscriptions.py`](https://github.com/frappe/central/blob/develop/central/billing/catalog/subscriptions.py) (Subscriptions), [`central/services/doctype/team_service/team_service.py`](https://github.com/frappe/central/blob/develop/central/services/doctype/team_service/team_service.py) (Team services), [`dashboard/src/main.ts`](https://github.com/frappe/central/blob/develop/dashboard/src/main.ts) (Vue console)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_console["Console and APIs"]
  node_dashboard["Vue console<br/>[main.ts]"]
  node_team_api["Team and resource APIs<br/>[teams.py]"]
  node_storage_api["Storage API<br/>[storage.py]"]
end

subgraph group_control["Team and Resources"]
  node_sites_servers["Sites and servers<br/>[servers.py]"]
  node_team_services["Team services<br/>[team_service.py]"]
  node_storage_client["Object storage client<br/>[object_storage.py]"]
end

subgraph group_billing["Billing"]
  node_catalog["Plans and pricing<br/>[pricing.py]"]
  node_subscriptions["Subscriptions<br/>[subscriptions.py]"]
  node_metering["Usage metering<br/>[metering.py]"]
  node_storage_meter["Storage usage bridge<br/>[storage_bridge.py]"]
  node_invoices["Invoices<br/>[invoice.py]"]
  node_payments["Payment lifecycle<br/>[payments.py]"]
  node_charges["Invoice charges<br/>[charges.py]"]
  node_gateway_registry["Gateway adapters<br/>[registry.py]"]
  node_webhooks["Gateway webhooks<br/>[webhooks.py]"]
  node_corrections["Payment corrections<br/>[corrections.py]"]
  node_projection["Billing projection<br/>[engine.py]"]
  node_reports["Billing reports"]
  node_credits["Credits<br/>[credits.py]"]
  node_tax["Tax calculation<br/>[tax.py]"]
  node_states["Billing state model<br/>[states.py]"]
end

subgraph group_platform["Integrations and Identity"]
  node_notifications["Notifications<br/>[engine.py]"]
  node_iam["Access control<br/>[iam.py]"]
  node_sso["Single sign-on<br/>[sso.py]"]
  node_identity_api["Identity API<br/>[identity.py]"]
end

node_user(("Cloud user"))
node_cargo{{"Cargo"}}

node_user -->|"uses"| node_dashboard
node_dashboard -.->|"manages"| node_team_api
node_dashboard -.->|"manages buckets"| node_storage_api
node_user -.->|"authenticates"| node_identity_api
node_team_api -.->|"checks access"| node_iam
node_sites_servers -->|"provisions"| node_subscriptions
node_team_services -->|"provisions service plan"| node_subscriptions
node_team_services -->|"manages bucket"| node_storage_client
node_storage_api -->|"loads team service"| node_team_services
node_storage_client -->|"calls bucket API"| node_cargo
node_catalog -->|"prices plans"| node_subscriptions
node_subscriptions -->|"uses pricing"| node_catalog
node_storage_meter -->|"reads bucket usage"| node_team_services
node_storage_meter -.->|"supplies usage"| node_metering
node_subscriptions -->|"calculates tax"| node_tax
node_charges -->|"selects adapter"| node_gateway_registry
node_payments -->|"initiates charges"| node_charges
node_webhooks -->|"dispatches events"| node_charges
node_webhooks -->|"dispatches refunds"| node_corrections
node_charges -->|"handles disputes"| node_corrections
node_invoices -->|"uses corrections"| node_corrections
node_charges -->|"uses credits"| node_credits
node_charges -->|"sends alerts"| node_notifications
node_charges -->|"transitions state"| node_states
node_payments -->|"transitions state"| node_states
node_projection -->|"reads invoices"| node_invoices
node_user -.->|"reviews billing"| node_reports
node_user -.->|"signs in"| node_sso

click node_dashboard "https://github.com/frappe/central/blob/develop/dashboard/src/main.ts"
click node_team_api "https://github.com/frappe/central/blob/develop/central/api/teams.py"
click node_storage_api "https://github.com/frappe/central/blob/develop/central/services/api/storage.py"
click node_sites_servers "https://github.com/frappe/central/blob/develop/central/api/servers.py"
click node_team_services "https://github.com/frappe/central/blob/develop/central/services/doctype/team_service/team_service.py"
click node_storage_client "https://github.com/frappe/central/blob/develop/central/integrations/object_storage.py"
click node_catalog "https://github.com/frappe/central/blob/develop/central/billing/catalog/pricing.py"
click node_subscriptions "https://github.com/frappe/central/blob/develop/central/billing/catalog/subscriptions.py"
click node_metering "https://github.com/frappe/central/blob/develop/central/billing/api/metering.py"
click node_storage_meter "https://github.com/frappe/central/blob/develop/central/billing/revenue/storage_bridge.py"
click node_invoices "https://github.com/frappe/central/blob/develop/central/billing/doctype/invoice/invoice.py"
click node_payments "https://github.com/frappe/central/blob/develop/central/billing/payments/payments.py"
click node_charges "https://github.com/frappe/central/blob/develop/central/billing/payments/charges.py"
click node_gateway_registry "https://github.com/frappe/central/blob/develop/central/billing/gateways/registry.py"
click node_webhooks "https://github.com/frappe/central/blob/develop/central/billing/payments/webhooks.py"
click node_corrections "https://github.com/frappe/central/blob/develop/central/billing/payments/corrections.py"
click node_projection "https://github.com/frappe/central/blob/develop/central/billing/projection/engine.py"
click node_reports "https://github.com/frappe/central/tree/develop/central/billing/report"
click node_credits "https://github.com/frappe/central/blob/develop/central/billing/revenue/credits.py"
click node_tax "https://github.com/frappe/central/blob/develop/central/billing/revenue/tax.py"
click node_states "https://github.com/frappe/central/blob/develop/central/billing/states.py"
click node_notifications "https://github.com/frappe/central/blob/develop/central/notification/engine.py"
click node_iam "https://github.com/frappe/central/blob/develop/central/iam.py"
click node_sso "https://github.com/frappe/central/blob/develop/central/sso.py"
click node_identity_api "https://github.com/frappe/central/blob/develop/central/api/identity.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_dashboard,node_team_api,node_storage_api,node_user toneBlue
class node_sites_servers,node_team_services,node_storage_client toneAmber
class node_catalog,node_subscriptions,node_metering,node_storage_meter,node_invoices,node_payments,node_charges,node_gateway_registry,node_webhooks,node_corrections,node_projection,node_reports,node_credits,node_tax,node_states toneMint
class node_notifications,node_iam,node_sso,node_identity_api toneRose
class node_cargo toneIndigo
```

## Components

### Console and APIs

- [Vue console](https://github.com/frappe/central/blob/develop/dashboard/src/main.ts): `dashboard/src/main.ts`
- [Team and resource APIs](https://github.com/frappe/central/blob/develop/central/api/teams.py): `central/api/teams.py`
- [Storage API](https://github.com/frappe/central/blob/develop/central/services/api/storage.py): `central/services/api/storage.py`

### Team and Resources

- [Sites and servers](https://github.com/frappe/central/blob/develop/central/api/servers.py): `central/api/servers.py`
- [Team services](https://github.com/frappe/central/blob/develop/central/services/doctype/team_service/team_service.py): `central/services/doctype/team_service/team_service.py`
- [Object storage client](https://github.com/frappe/central/blob/develop/central/integrations/object_storage.py): `central/integrations/object_storage.py`

### Billing

- [Plans and pricing](https://github.com/frappe/central/blob/develop/central/billing/catalog/pricing.py): `central/billing/catalog/pricing.py`
- [Subscriptions](https://github.com/frappe/central/blob/develop/central/billing/catalog/subscriptions.py): `central/billing/catalog/subscriptions.py`
- [Usage metering](https://github.com/frappe/central/blob/develop/central/billing/api/metering.py): `central/billing/api/metering.py`
- [Storage usage bridge](https://github.com/frappe/central/blob/develop/central/billing/revenue/storage_bridge.py): `central/billing/revenue/storage_bridge.py`
- [Invoices](https://github.com/frappe/central/blob/develop/central/billing/doctype/invoice/invoice.py): `central/billing/doctype/invoice/invoice.py`
- [Payment lifecycle](https://github.com/frappe/central/blob/develop/central/billing/payments/payments.py): `central/billing/payments/payments.py`
- [Invoice charges](https://github.com/frappe/central/blob/develop/central/billing/payments/charges.py): `central/billing/payments/charges.py`
- [Gateway adapters](https://github.com/frappe/central/blob/develop/central/billing/gateways/registry.py): `central/billing/gateways/registry.py`
- [Gateway webhooks](https://github.com/frappe/central/blob/develop/central/billing/payments/webhooks.py): `central/billing/payments/webhooks.py`
- [Payment corrections](https://github.com/frappe/central/blob/develop/central/billing/payments/corrections.py): `central/billing/payments/corrections.py`
- [Billing projection](https://github.com/frappe/central/blob/develop/central/billing/projection/engine.py): `central/billing/projection/engine.py`
- [Billing reports](https://github.com/frappe/central/tree/develop/central/billing/report): `central/billing/report`
- [Credits](https://github.com/frappe/central/blob/develop/central/billing/revenue/credits.py): `central/billing/revenue/credits.py`
- [Tax calculation](https://github.com/frappe/central/blob/develop/central/billing/revenue/tax.py): `central/billing/revenue/tax.py`
- [Billing state model](https://github.com/frappe/central/blob/develop/central/billing/states.py): `central/billing/states.py`

### Integrations and Identity

- [Notifications](https://github.com/frappe/central/blob/develop/central/notification/engine.py): `central/notification/engine.py`
- [Access control](https://github.com/frappe/central/blob/develop/central/iam.py): `central/iam.py`
- [Single sign-on](https://github.com/frappe/central/blob/develop/central/sso.py): `central/sso.py`
- [Identity API](https://github.com/frappe/central/blob/develop/central/api/identity.py): `central/api/identity.py`

### Other components

- **Cloud user**
- **Cargo**

## Connections

- Cloud user → Vue console: uses
- Vue console → Team and resource APIs: manages
- Vue console → Storage API: manages buckets
- Cloud user → Identity API: authenticates
- Team and resource APIs → Access control: checks access
- Sites and servers → Subscriptions: provisions (evidence: `central/billing/catalog/subscriptions.py`)
- Team services → Subscriptions: provisions service plan (evidence: `central/services/doctype/team_service/team_service.py`)
- Team services → Object storage client: manages bucket (evidence: `central/services/doctype/team_service/team_service.py`)
- Storage API → Team services: loads team service (evidence: `central/services/api/storage.py`)
- Object storage client → Cargo: calls bucket API (evidence: `central/integrations/object_storage.py`)
- Plans and pricing → Subscriptions: prices plans (evidence: `central/billing/catalog/services.py`)
- Subscriptions → Plans and pricing: uses pricing (evidence: `central/billing/catalog/subscriptions.py`)
- Storage usage bridge → Team services: reads bucket usage (evidence: `central/billing/revenue/storage_bridge.py`)
- Storage usage bridge → Usage metering: supplies usage
- Subscriptions → Tax calculation: calculates tax (evidence: `central/billing/catalog/subscriptions.py`)
- Invoice charges → Gateway adapters: selects adapter (evidence: `central/billing/payments/charges.py`)
- Payment lifecycle → Invoice charges: initiates charges (evidence: `central/billing/payments/payments.py`)
- Gateway webhooks → Invoice charges: dispatches events (evidence: `central/billing/payments/webhooks.py`)
- Gateway webhooks → Payment corrections: dispatches refunds (evidence: `central/billing/payments/webhooks.py`)
- Invoice charges → Payment corrections: handles disputes (evidence: `central/billing/payments/charges.py`)
- Invoices → Payment corrections: uses corrections (evidence: `central/billing/doctype/invoice/invoice.py`)
- Invoice charges → Credits: uses credits (evidence: `central/billing/payments/charges.py`)
- Invoice charges → Notifications: sends alerts (evidence: `central/billing/payments/charges.py`)
- Invoice charges → Billing state model: transitions state (evidence: `central/billing/payments/charges.py`)
- Payment lifecycle → Billing state model: transitions state (evidence: `central/billing/payments/payments.py`)
- Billing projection → Invoices: reads invoices (evidence: `central/billing/projection/engine.py`)
- Cloud user → Billing reports: reviews billing
- Cloud user → Single sign-on: signs in
