# frappe/erpnext architecture

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

- Interactive diagram: https://gitdiagram.com/frappe/erpnext
- Repository: https://github.com/frappe/erpnext
- Video tour (about a minute): https://gitdiagram.com/frappe/erpnext/video

## Overview

ERPNext is an open-source ERP for business operations. Users work in its application to record and manage accounting, orders and inventory, manufacturing, assets, and projects; accounting also supports financial reporting. The repository contains a banking interface alongside the Python ERP modules. The README establishes the product capabilities, while the sampled source supports selected accounting, stock, serial/batch, and subcontracting relationships; unsampled domain links are left unverified.

Main entry points: [`erpnext`](https://github.com/frappe/erpnext/tree/develop/erpnext) (ERPNext), [`erpnext/controllers/stock_controller.py`](https://github.com/frappe/erpnext/blob/develop/erpnext/controllers/stock_controller.py) (Stock transactions), [`banking/src`](https://github.com/frappe/erpnext/tree/develop/banking/src) (Banking interface), [`erpnext/controllers/accounts_controller.py`](https://github.com/frappe/erpnext/blob/develop/erpnext/controllers/accounts_controller.py) (Accounting documents)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["ERP application"]
  node_erpnext["ERPNext"]
  node_banking_ui["Banking interface"]
end

subgraph group_accounting["Accounting"]
  node_accounts_controller["Accounting documents"]
  node_general_ledger[("General ledger<br/>[general_ledger.py]")]
  node_financial_reports["Financial reports"]
  node_bank_reconciliation["Bank reconciliation"]
  node_bank_import["Statement import"]
end

subgraph group_orders["Orders and inventory"]
  node_buying["Buying workflow"]
  node_item_details["Item and pricing"]
  node_stock_controller["Stock transactions"]
  node_stock_ledger[("Stock ledger<br/>[stock_ledger.py]")]
  node_serial_batch["Serial and batch tracking"]
  node_identity["Serial/batch identity"]
end

subgraph group_manufacturing["Manufacturing"]
  node_subcontracting["Subcontracting"]
  node_routing["Production routing<br/>[routing.py]"]
  node_scheduling["Production scheduling<br/>[engine.py]"]
end

subgraph group_assets_projects["Assets and projects"]
  node_assets["Asset management"]
  node_projects["Project delivery"]
end

node_user(("Business user"))

node_user -->|"uses"| node_erpnext
node_erpnext -.->|"supports accounting"| node_accounts_controller
node_erpnext -.->|"supports orders"| node_buying
node_erpnext -.->|"supports inventory"| node_stock_controller
node_erpnext -.->|"supports manufacturing"| node_routing
node_erpnext -.->|"supports assets"| node_assets
node_erpnext -.->|"supports projects"| node_projects
node_erpnext -.->|"includes interface"| node_banking_ui
node_accounts_controller -->|"imports ledger functions"| node_general_ledger
node_accounts_controller -.->|"supports reporting"| node_financial_reports
node_banking_ui -.->|"supports reconciliation"| node_bank_reconciliation
node_banking_ui -.->|"supports import"| node_bank_import
node_buying -->|"imports item details"| node_item_details
node_stock_controller -.->|"manages stock ledger"| node_stock_ledger
node_stock_controller -->|"handles reservations"| node_serial_batch
node_serial_batch -->|"uses identity"| node_identity
node_subcontracting -->|"uses bundles"| node_serial_batch
node_subcontracting -->|"imports controller"| node_stock_controller
node_routing -.->|"coordinates production"| node_scheduling

click node_erpnext "https://github.com/frappe/erpnext/tree/develop/erpnext"
click node_banking_ui "https://github.com/frappe/erpnext/tree/develop/banking/src"
click node_accounts_controller "https://github.com/frappe/erpnext/blob/develop/erpnext/controllers/accounts_controller.py"
click node_general_ledger "https://github.com/frappe/erpnext/blob/develop/erpnext/accounts/general_ledger.py"
click node_financial_reports "https://github.com/frappe/erpnext/blob/develop/erpnext/accounts/doctype/financial_report_template/financial_report_engine.py"
click node_bank_reconciliation "https://github.com/frappe/erpnext/tree/develop/erpnext/accounts/doctype/bank_reconciliation_tool"
click node_bank_import "https://github.com/frappe/erpnext/tree/develop/erpnext/accounts/doctype/bank_statement_import"
click node_buying "https://github.com/frappe/erpnext/blob/develop/erpnext/controllers/buying_controller.py"
click node_item_details "https://github.com/frappe/erpnext/blob/develop/erpnext/stock/get_item_details.py"
click node_stock_controller "https://github.com/frappe/erpnext/blob/develop/erpnext/controllers/stock_controller.py"
click node_stock_ledger "https://github.com/frappe/erpnext/blob/develop/erpnext/stock/stock_ledger.py"
click node_serial_batch "https://github.com/frappe/erpnext/blob/develop/erpnext/stock/doctype/serial_and_batch_bundle/serial_and_batch_bundle.py"
click node_identity "https://github.com/frappe/erpnext/blob/develop/erpnext/stock/serial_batch_identity.py"
click node_subcontracting "https://github.com/frappe/erpnext/blob/develop/erpnext/controllers/subcontracting_controller.py"
click node_routing "https://github.com/frappe/erpnext/blob/develop/erpnext/manufacturing/doctype/routing/routing.py"
click node_scheduling "https://github.com/frappe/erpnext/blob/develop/erpnext/manufacturing/scheduling/engine.py"
click node_assets "https://github.com/frappe/erpnext/tree/develop/erpnext/assets"
click node_projects "https://github.com/frappe/erpnext/tree/develop/erpnext/projects"

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_erpnext,node_banking_ui,node_user toneBlue
class node_accounts_controller,node_general_ledger,node_financial_reports,node_bank_reconciliation,node_bank_import toneAmber
class node_buying,node_item_details,node_stock_controller,node_stock_ledger,node_serial_batch,node_identity toneMint
class node_subcontracting,node_routing,node_scheduling toneRose
class node_assets,node_projects toneIndigo
```

## Components

### ERP application

- [ERPNext](https://github.com/frappe/erpnext/tree/develop/erpnext): `erpnext`
- [Banking interface](https://github.com/frappe/erpnext/tree/develop/banking/src): `banking/src`

### Accounting

- [Accounting documents](https://github.com/frappe/erpnext/blob/develop/erpnext/controllers/accounts_controller.py): `erpnext/controllers/accounts_controller.py`
- [General ledger](https://github.com/frappe/erpnext/blob/develop/erpnext/accounts/general_ledger.py): `erpnext/accounts/general_ledger.py`
- [Financial reports](https://github.com/frappe/erpnext/blob/develop/erpnext/accounts/doctype/financial_report_template/financial_report_engine.py): `erpnext/accounts/doctype/financial_report_template/financial_report_engine.py`
- [Bank reconciliation](https://github.com/frappe/erpnext/tree/develop/erpnext/accounts/doctype/bank_reconciliation_tool): `erpnext/accounts/doctype/bank_reconciliation_tool`
- [Statement import](https://github.com/frappe/erpnext/tree/develop/erpnext/accounts/doctype/bank_statement_import): `erpnext/accounts/doctype/bank_statement_import`

### Orders and inventory

- [Buying workflow](https://github.com/frappe/erpnext/blob/develop/erpnext/controllers/buying_controller.py): `erpnext/controllers/buying_controller.py`
- [Item and pricing](https://github.com/frappe/erpnext/blob/develop/erpnext/stock/get_item_details.py): `erpnext/stock/get_item_details.py`
- [Stock transactions](https://github.com/frappe/erpnext/blob/develop/erpnext/controllers/stock_controller.py): `erpnext/controllers/stock_controller.py`
- [Stock ledger](https://github.com/frappe/erpnext/blob/develop/erpnext/stock/stock_ledger.py): `erpnext/stock/stock_ledger.py`
- [Serial and batch tracking](https://github.com/frappe/erpnext/blob/develop/erpnext/stock/doctype/serial_and_batch_bundle/serial_and_batch_bundle.py): `erpnext/stock/doctype/serial_and_batch_bundle/serial_and_batch_bundle.py`
- [Serial/batch identity](https://github.com/frappe/erpnext/blob/develop/erpnext/stock/serial_batch_identity.py): `erpnext/stock/serial_batch_identity.py`

### Manufacturing

- [Subcontracting](https://github.com/frappe/erpnext/blob/develop/erpnext/controllers/subcontracting_controller.py): `erpnext/controllers/subcontracting_controller.py`
- [Production routing](https://github.com/frappe/erpnext/blob/develop/erpnext/manufacturing/doctype/routing/routing.py): `erpnext/manufacturing/doctype/routing/routing.py`
- [Production scheduling](https://github.com/frappe/erpnext/blob/develop/erpnext/manufacturing/scheduling/engine.py): `erpnext/manufacturing/scheduling/engine.py`

### Assets and projects

- [Asset management](https://github.com/frappe/erpnext/tree/develop/erpnext/assets): `erpnext/assets`
- [Project delivery](https://github.com/frappe/erpnext/tree/develop/erpnext/projects): `erpnext/projects`

### Other components

- **Business user**

## Connections

- Business user → ERPNext: uses
- ERPNext → Accounting documents: supports accounting (evidence: `erpnext/stock/get_item_details.py`)
- ERPNext → Buying workflow: supports orders (evidence: `erpnext/controllers/sales_and_purchase_return.py`)
- ERPNext → Stock transactions: supports inventory (evidence: `erpnext/controllers/subcontracting_controller.py`)
- ERPNext → Production routing: supports manufacturing (evidence: `erpnext/manufacturing/doctype/routing/routing.py`)
- ERPNext → Asset management: supports assets (evidence: `erpnext/accounts/doctype/journal_entry/services/asset_service.py`)
- ERPNext → Project delivery: supports projects (evidence: `erpnext/controllers/stock_controller.py`)
- ERPNext → Banking interface: includes interface
- Accounting documents → General ledger: imports ledger functions (evidence: `erpnext/controllers/accounts_controller.py`)
- Accounting documents → Financial reports: supports reporting
- Banking interface → Bank reconciliation: supports reconciliation
- Banking interface → Statement import: supports import
- Buying workflow → Item and pricing: imports item details (evidence: `erpnext/controllers/buying_controller.py`)
- Stock transactions → Stock ledger: manages stock ledger (evidence: `erpnext/controllers/stock_controller.py`)
- Stock transactions → Serial and batch tracking: handles reservations (evidence: `erpnext/controllers/stock_controller.py`)
- Serial and batch tracking → Serial/batch identity: uses identity (evidence: `erpnext/stock/doctype/serial_and_batch_bundle/serial_and_batch_bundle.py`)
- Subcontracting → Serial and batch tracking: uses bundles (evidence: `erpnext/controllers/subcontracting_controller.py`)
- Subcontracting → Stock transactions: imports controller (evidence: `erpnext/controllers/subcontracting_controller.py`)
- Production routing → Production scheduling: coordinates production
