# sienghor-dev/business-management-system architecture

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

- Interactive diagram: https://gitdiagram.com/sienghor-dev/business-management-system
- Repository: https://github.com/sienghor-dev/business-management-system

## Overview

This is a multi-tenant, subscription-based business-management SaaS with a Vue client and Hono API. A member selects a business, then uses entitled and permitted modules for stock, sales, finance, tax, payroll, and reporting; API routes handle those requests and operate on tenant-scoped business data. The graph preserves the major documented product domains, plus access control and subscriptions. Source excerpts are selective, so unshown client/API and domain-to-storage links are not asserted as verified calls.

Main entry points: [`apps/api/src/modules/routes.ts`](https://github.com/sienghor-dev/business-management-system/blob/main/apps/api/src/modules/routes.ts) (API composition), [`apps/api/src/middleware/tenant.ts`](https://github.com/sienghor-dev/business-management-system/blob/main/apps/api/src/middleware/tenant.ts) (Tenant authorization), [`packages/database/src/schema`](https://github.com/sienghor-dev/business-management-system/tree/main/packages/database/src/schema) (PostgreSQL data), [`apps/web/src/App.vue`](https://github.com/sienghor-dev/business-management-system/blob/main/apps/web/src/App.vue) (Vue application)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web client"]
  node_web["Vue application<br/>[App.vue]"]
  node_webapi["API client<br/>[api.ts]"]
end

subgraph group_api["API and access"]
  node_entry["API composition<br/>[routes.ts]"]
  node_tenant["Tenant authorization<br/>[tenant.ts]"]
end

subgraph group_business["Business operations"]
  node_stock["Products and inventory"]
  node_sales["Point of sale"]
  node_purchasing["Purchasing and expenses"]
  node_finance["Finance and accounting"]
  node_tax["Tax"]
  node_payroll["Payroll"]
  node_reports["Reports and dashboard"]
end

subgraph group_platform["Tenant platform"]
  node_identity["Identity and membership"]
  node_tenancy["Organizations"]
  node_subscriptions["Plans and entitlements"]
end

subgraph group_data["Persistence"]
  node_database[("PostgreSQL data")]
end

node_member(("Business user"))

node_member -->|"uses"| node_web
node_web -.->|"requests data"| node_webapi
node_webapi -.->|"calls API"| node_entry
node_entry -->|"mounts routes"| node_stock
node_entry -->|"mounts routes"| node_sales
node_entry -->|"mounts routes"| node_reports
node_entry -->|"mounts routes"| node_finance
node_entry -->|"mounts routes"| node_tax
node_entry -->|"mounts routes"| node_payroll
node_entry -->|"mounts routes"| node_purchasing
node_entry -.->|"guards tenant routes"| node_tenant
node_tenant -->|"loads membership"| node_identity
node_tenant -->|"checks entitlements"| node_subscriptions
node_entry -.->|"serves organization routes"| node_tenancy
node_entry -.->|"serves platform routes"| node_subscriptions
node_finance -.->|"persists finance data"| node_database
node_stock -.->|"persists stock data"| node_database
node_sales -.->|"persists sales data"| node_database

click node_web "https://github.com/sienghor-dev/business-management-system/blob/main/apps/web/src/App.vue"
click node_webapi "https://github.com/sienghor-dev/business-management-system/blob/main/apps/web/src/app/api.ts"
click node_entry "https://github.com/sienghor-dev/business-management-system/blob/main/apps/api/src/modules/routes.ts"
click node_tenant "https://github.com/sienghor-dev/business-management-system/blob/main/apps/api/src/middleware/tenant.ts"
click node_stock "https://github.com/sienghor-dev/business-management-system/tree/main/apps/api/src/modules/products"
click node_sales "https://github.com/sienghor-dev/business-management-system/tree/main/apps/api/src/modules/sales"
click node_purchasing "https://github.com/sienghor-dev/business-management-system/tree/main/apps/api/src/modules/purchasing"
click node_finance "https://github.com/sienghor-dev/business-management-system/tree/main/apps/api/src/modules/finance"
click node_tax "https://github.com/sienghor-dev/business-management-system/tree/main/apps/api/src/modules/tax"
click node_payroll "https://github.com/sienghor-dev/business-management-system/tree/main/apps/api/src/modules/payroll"
click node_reports "https://github.com/sienghor-dev/business-management-system/tree/main/apps/api/src/modules/reports"
click node_identity "https://github.com/sienghor-dev/business-management-system/tree/main/apps/api/src/modules/identity"
click node_tenancy "https://github.com/sienghor-dev/business-management-system/tree/main/apps/api/src/modules/tenancy"
click node_subscriptions "https://github.com/sienghor-dev/business-management-system/tree/main/apps/api/src/modules/subscriptions"
click node_database "https://github.com/sienghor-dev/business-management-system/tree/main/packages/database/src/schema"

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_web,node_webapi,node_member toneBlue
class node_entry,node_tenant toneAmber
class node_stock,node_sales,node_purchasing,node_finance,node_tax,node_payroll,node_reports toneMint
class node_identity,node_tenancy,node_subscriptions toneRose
class node_database toneIndigo
```

## Components

### Web client

- [Vue application](https://github.com/sienghor-dev/business-management-system/blob/main/apps/web/src/App.vue): `apps/web/src/App.vue`
- [API client](https://github.com/sienghor-dev/business-management-system/blob/main/apps/web/src/app/api.ts): `apps/web/src/app/api.ts`

### API and access

- [API composition](https://github.com/sienghor-dev/business-management-system/blob/main/apps/api/src/modules/routes.ts): `apps/api/src/modules/routes.ts`
- [Tenant authorization](https://github.com/sienghor-dev/business-management-system/blob/main/apps/api/src/middleware/tenant.ts): `apps/api/src/middleware/tenant.ts`

### Business operations

- [Products and inventory](https://github.com/sienghor-dev/business-management-system/tree/main/apps/api/src/modules/products): `apps/api/src/modules/products`
- [Point of sale](https://github.com/sienghor-dev/business-management-system/tree/main/apps/api/src/modules/sales): `apps/api/src/modules/sales`
- [Purchasing and expenses](https://github.com/sienghor-dev/business-management-system/tree/main/apps/api/src/modules/purchasing): `apps/api/src/modules/purchasing`
- [Finance and accounting](https://github.com/sienghor-dev/business-management-system/tree/main/apps/api/src/modules/finance): `apps/api/src/modules/finance`
- [Tax](https://github.com/sienghor-dev/business-management-system/tree/main/apps/api/src/modules/tax): `apps/api/src/modules/tax`
- [Payroll](https://github.com/sienghor-dev/business-management-system/tree/main/apps/api/src/modules/payroll): `apps/api/src/modules/payroll`
- [Reports and dashboard](https://github.com/sienghor-dev/business-management-system/tree/main/apps/api/src/modules/reports): `apps/api/src/modules/reports`

### Tenant platform

- [Identity and membership](https://github.com/sienghor-dev/business-management-system/tree/main/apps/api/src/modules/identity): `apps/api/src/modules/identity`
- [Organizations](https://github.com/sienghor-dev/business-management-system/tree/main/apps/api/src/modules/tenancy): `apps/api/src/modules/tenancy`
- [Plans and entitlements](https://github.com/sienghor-dev/business-management-system/tree/main/apps/api/src/modules/subscriptions): `apps/api/src/modules/subscriptions`

### Persistence

- [PostgreSQL data](https://github.com/sienghor-dev/business-management-system/tree/main/packages/database/src/schema): `packages/database/src/schema`

### Other components

- **Business user**

## Connections

- Business user → Vue application: uses (evidence: `README.md`)
- Vue application → API client: requests data
- API client → API composition: calls API
- API composition → Products and inventory: mounts routes (evidence: `apps/api/src/modules/routes.ts`)
- API composition → Point of sale: mounts routes (evidence: `apps/api/src/modules/routes.ts`)
- API composition → Reports and dashboard: mounts routes (evidence: `apps/api/src/modules/routes.ts`)
- API composition → Finance and accounting: mounts routes (evidence: `apps/api/src/modules/routes.ts`)
- API composition → Tax: mounts routes (evidence: `apps/api/src/modules/routes.ts`)
- API composition → Payroll: mounts routes (evidence: `apps/api/src/modules/routes.ts`)
- API composition → Purchasing and expenses: mounts routes (evidence: `apps/api/src/modules/routes.ts`)
- API composition → Tenant authorization: guards tenant routes
- Tenant authorization → Identity and membership: loads membership (evidence: `apps/api/src/middleware/tenant.ts`)
- Tenant authorization → Plans and entitlements: checks entitlements (evidence: `apps/api/src/middleware/tenant.ts`)
- API composition → Organizations: serves organization routes
- API composition → Plans and entitlements: serves platform routes
- Finance and accounting → PostgreSQL data: persists finance data
- Products and inventory → PostgreSQL data: persists stock data
- Point of sale → PostgreSQL data: persists sales data
