# kikaiuto/csce4901-capstone architecture

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

- Interactive diagram: https://gitdiagram.com/kikaiuto/csce4901-capstone
- Repository: https://github.com/kikaiuto/csce4901-capstone

## Overview

Sector 7 AI is a multi-tenant ERP with customer, catalog, inventory, sales, procurement, accounting, reporting, AI assistance, and forecasting capabilities. The intended user workflow is through the addon-based frontend; today its screens use fixtures, while the backend provides authenticated, tenant-scoped read APIs and addon routing. Operational write services are described in the code but are not yet wired from frontend actions. The excerpts show sales and receiving workflows invoking inventory and accounting contracts. Unshown addon internals and frontend routes limit finer-grained flow claims.

Main entry points: [`backend/app/core/modules/loading.py`](https://github.com/kikaiuto/csce4901-capstone/blob/main/backend/app/core/modules/loading.py) (Addon loader), [`backend/app/core/contracts`](https://github.com/kikaiuto/csce4901-capstone/tree/main/backend/app/core/contracts) (Service contracts), [`backend/app/addons/sales`](https://github.com/kikaiuto/csce4901-capstone/tree/main/backend/app/addons/sales) (Sales orders), [`backend/app/addons/procurement`](https://github.com/kikaiuto/csce4901-capstone/tree/main/backend/app/addons/procurement) (Procurement and receiving)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Frontend experience"]
  node_webapp["Addon screens"]
  node_appshell["App shell"]
  node_apiclient["API client<br/>[api.ts]"]
end

subgraph group_backend["Backend platform"]
  node_entry["API application<br/>[main.py]"]
  node_addonloader["Addon loader<br/>[loading.py]"]
  node_tenant["Tenant security<br/>[tenancy.py]"]
  node_contracts["Service contracts"]
  node_store[("Relational database<br/>[db.py]")]
end

subgraph group_operations["ERP operations"]
  node_sales["Sales orders"]
  node_inventory["Inventory and catalog"]
  node_procurement["Procurement and receiving"]
  node_accounting["Accounting ledger"]
end

subgraph group_insights["Insights and identity"]
  node_base["Identity and access"]
  node_home["Home reporting"]
  node_ai["AI assistance"]
  node_forecasting["Forecasting"]
end

node_user(("ERP user"))

node_user -->|"uses"| node_webapp
node_webapp -.->|"renders in"| node_appshell
node_webapp -.->|"uses"| node_apiclient
node_entry -->|"mounts routers"| node_addonloader
node_addonloader -->|"mounts"| node_base
node_addonloader -->|"mounts"| node_sales
node_addonloader -->|"mounts"| node_inventory
node_addonloader -->|"mounts"| node_procurement
node_addonloader -->|"mounts"| node_accounting
node_addonloader -->|"mounts"| node_home
node_addonloader -->|"mounts"| node_ai
node_addonloader -->|"mounts"| node_forecasting
node_sales -->|"uses contracts"| node_contracts
node_sales -->|"requests stock"| node_inventory
node_sales -->|"posts sale"| node_accounting
node_procurement -->|"records receipt"| node_inventory
node_procurement -->|"posts receipt"| node_accounting
node_procurement -->|"uses contracts"| node_contracts
node_home -->|"reads metrics"| node_contracts
node_ai -->|"read-only access"| node_contracts
node_contracts -->|"binds session"| node_tenant
node_tenant -->|"scopes queries"| node_store
node_base -->|"loads identity"| node_store

click node_webapp "https://github.com/kikaiuto/csce4901-capstone/tree/main/frontend/src/addons"
click node_appshell "https://github.com/kikaiuto/csce4901-capstone/tree/main/frontend/src/core/app"
click node_apiclient "https://github.com/kikaiuto/csce4901-capstone/blob/main/frontend/src/core/lib/api.ts"
click node_entry "https://github.com/kikaiuto/csce4901-capstone/blob/main/backend/app/main.py"
click node_addonloader "https://github.com/kikaiuto/csce4901-capstone/blob/main/backend/app/core/modules/loading.py"
click node_tenant "https://github.com/kikaiuto/csce4901-capstone/blob/main/backend/app/core/tenancy.py"
click node_contracts "https://github.com/kikaiuto/csce4901-capstone/tree/main/backend/app/core/contracts"
click node_store "https://github.com/kikaiuto/csce4901-capstone/blob/main/backend/app/core/db.py"
click node_base "https://github.com/kikaiuto/csce4901-capstone/tree/main/backend/app/addons/base"
click node_sales "https://github.com/kikaiuto/csce4901-capstone/tree/main/backend/app/addons/sales"
click node_inventory "https://github.com/kikaiuto/csce4901-capstone/tree/main/backend/app/addons/inventory"
click node_procurement "https://github.com/kikaiuto/csce4901-capstone/tree/main/backend/app/addons/procurement"
click node_accounting "https://github.com/kikaiuto/csce4901-capstone/tree/main/backend/app/addons/accounting"
click node_home "https://github.com/kikaiuto/csce4901-capstone/tree/main/backend/app/addons/home"
click node_ai "https://github.com/kikaiuto/csce4901-capstone/tree/main/backend/app/addons/ai"
click node_forecasting "https://github.com/kikaiuto/csce4901-capstone/tree/main/backend/app/addons/forecasting"

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_webapp,node_appshell,node_apiclient,node_user toneBlue
class node_entry,node_addonloader,node_tenant,node_contracts,node_store toneAmber
class node_sales,node_inventory,node_procurement,node_accounting toneMint
class node_base,node_home,node_ai,node_forecasting toneRose
```

## Components

### Frontend experience

- [Addon screens](https://github.com/kikaiuto/csce4901-capstone/tree/main/frontend/src/addons): `frontend/src/addons`
- [App shell](https://github.com/kikaiuto/csce4901-capstone/tree/main/frontend/src/core/app): `frontend/src/core/app`
- [API client](https://github.com/kikaiuto/csce4901-capstone/blob/main/frontend/src/core/lib/api.ts): `frontend/src/core/lib/api.ts`

### Backend platform

- [API application](https://github.com/kikaiuto/csce4901-capstone/blob/main/backend/app/main.py): `backend/app/main.py`
- [Addon loader](https://github.com/kikaiuto/csce4901-capstone/blob/main/backend/app/core/modules/loading.py): `backend/app/core/modules/loading.py`
- [Tenant security](https://github.com/kikaiuto/csce4901-capstone/blob/main/backend/app/core/tenancy.py): `backend/app/core/tenancy.py`
- [Service contracts](https://github.com/kikaiuto/csce4901-capstone/tree/main/backend/app/core/contracts): `backend/app/core/contracts`
- [Relational database](https://github.com/kikaiuto/csce4901-capstone/blob/main/backend/app/core/db.py): `backend/app/core/db.py`

### ERP operations

- [Sales orders](https://github.com/kikaiuto/csce4901-capstone/tree/main/backend/app/addons/sales): `backend/app/addons/sales`
- [Inventory and catalog](https://github.com/kikaiuto/csce4901-capstone/tree/main/backend/app/addons/inventory): `backend/app/addons/inventory`
- [Procurement and receiving](https://github.com/kikaiuto/csce4901-capstone/tree/main/backend/app/addons/procurement): `backend/app/addons/procurement`
- [Accounting ledger](https://github.com/kikaiuto/csce4901-capstone/tree/main/backend/app/addons/accounting): `backend/app/addons/accounting`

### Insights and identity

- [Identity and access](https://github.com/kikaiuto/csce4901-capstone/tree/main/backend/app/addons/base): `backend/app/addons/base`
- [Home reporting](https://github.com/kikaiuto/csce4901-capstone/tree/main/backend/app/addons/home): `backend/app/addons/home`
- [AI assistance](https://github.com/kikaiuto/csce4901-capstone/tree/main/backend/app/addons/ai): `backend/app/addons/ai`
- [Forecasting](https://github.com/kikaiuto/csce4901-capstone/tree/main/backend/app/addons/forecasting): `backend/app/addons/forecasting`

### Other components

- **ERP user**

## Connections

- ERP user → Addon screens: uses (evidence: `README.md`)
- Addon screens → App shell: renders in
- Addon screens → API client: uses
- API application → Addon loader: mounts routers (evidence: `backend/app/main.py`)
- Addon loader → Identity and access: mounts
- Addon loader → Sales orders: mounts
- Addon loader → Inventory and catalog: mounts
- Addon loader → Procurement and receiving: mounts
- Addon loader → Accounting ledger: mounts
- Addon loader → Home reporting: mounts
- Addon loader → AI assistance: mounts
- Addon loader → Forecasting: mounts
- Sales orders → Service contracts: uses contracts (evidence: `backend/app/addons/sales/service.py`)
- Sales orders → Inventory and catalog: requests stock (evidence: `backend/app/addons/sales/service.py`)
- Sales orders → Accounting ledger: posts sale (evidence: `backend/app/addons/sales/service.py`)
- Procurement and receiving → Inventory and catalog: records receipt (evidence: `backend/app/addons/procurement/service.py`)
- Procurement and receiving → Accounting ledger: posts receipt (evidence: `backend/app/addons/procurement/service.py`)
- Procurement and receiving → Service contracts: uses contracts (evidence: `backend/app/addons/procurement/service.py`)
- Home reporting → Service contracts: reads metrics (evidence: `backend/app/addons/home/service.py`)
- AI assistance → Service contracts: read-only access (evidence: `README.md`)
- Service contracts → Tenant security: binds session (evidence: `backend/app/core/contracts/__init__.py`)
- Tenant security → Relational database: scopes queries (evidence: `backend/app/core/tenancy.py`)
- Identity and access → Relational database: loads identity (evidence: `backend/app/addons/base/service.py`)
