System architecture — Overview
Purpose
Section titled “Purpose”Describe how leekimerp fits into a standard Frappe / ERPNext deployment: clients, application layer, persistence, and third-party services.
Scope in codebase
Section titled “Scope in codebase”leekimerp/leekimerp/hooks.py— app hooks, assets, events, schedulersleekimerp/leekimerp/api/— HTTP API surface- Root
package.json— optional Node/socket layer (separate concern)
Architecture diagram
Section titled “Architecture diagram”flowchart TB subgraph clients["Clients"] Browser["Browser / Desk"] Mobile["Optional clients"] end subgraph frappe["Frappe / ERPNext Site"] Desk["Desk UI + Custom Pages"] Whitelist["@frappe.whitelist API"] Hooks["doc_events / scheduler_events"] Workers["Background workers / scheduler"] end subgraph data["Data"] MariaDB[(MariaDB)] Files["File attachments"] end subgraph external["External services"] Xero["Xero API + Webhooks"] Stripe["Stripe"] DocuSign["DocuSign"] Singpass["Singpass"] end Browser --> Desk Mobile --> Whitelist Desk --> MariaDB Whitelist --> MariaDB Hooks --> MariaDB Workers --> Hooks Whitelist --> Xero Whitelist --> Stripe Desk --> DocuSign Whitelist --> SingpassKey DocTypes & documents
Section titled “Key DocTypes & documents”Inherited from ERPNext where applicable (Company, Sales Invoice, Employee, …) plus many custom DocTypes under lee_kim_alliance_erp/doctype/. See Custom DocTypes & data.
Entry points
Section titled “Entry points”| Layer | Entry |
|---|---|
| UI | Frappe Desk, custom Pages under lee_kim_alliance_erp/page/ |
| API | leekimerp.api.* whitelisted methods |
| Background | Scheduler in hooks.py, tasks in tasks.py, scheduler_events/ |
Dependencies
Section titled “Dependencies”- ERPNext standard modules (sales, accounts, HR, etc.) as installed on the site
- External APIs: Xero, Stripe, DocuSign, Singpass (per configuration)
Configuration
Section titled “Configuration”- Site config:
site_config.jsonon the server (secrets, not in repo) - Company / integration DocTypes: Xero tenants, Stripe settings, etc.
Operational notes
Section titled “Operational notes”- Long-running or failing jobs: check Error Log, scheduler logs, and integration-specific logs in Frappe.
Known gaps
Section titled “Known gaps”Record Frappe / ERPNext / Python versions from your production Bench (bench version) in internal runbooks; they are not pinned in leekimerp/requirements.txt (minimal file in app).