# jawadabuhalaweh/saas-dashboard architecture

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

- Interactive diagram: https://gitdiagram.com/jawadabuhalaweh/saas-dashboard
- Repository: https://github.com/jawadabuhalaweh/saas-dashboard

## Overview

Zenith Business Command Center is a multi-company finance and operations command center. The main workflow is executive or operational staff selecting a company/branch scope, navigating a dashboard or domain view, drilling into financial or transactional detail, and recording vouchers that update the ledger. Supporting branches include governance and reconciliation, collaboration, and grounded AI analysis. The source index and excerpts establish the UI routing and several service calls; other README-described capabilities are included, but unsampled implementation links are omitted or marked unverified.

Main entry points: [`src/App.tsx`](https://github.com/jawadabuhalaweh/saas-dashboard/blob/main/src/App.tsx) (App router), [`src/services/database.ts`](https://github.com/jawadabuhalaweh/saas-dashboard/blob/main/src/services/database.ts) (In-memory repository), [`src/components/intelligence/AIAnalystView.tsx`](https://github.com/jawadabuhalaweh/saas-dashboard/blob/main/src/components/intelligence/AIAnalystView.tsx) (AI analyst), [`src/services/postingEngine.ts`](https://github.com/jawadabuhalaweh/saas-dashboard/blob/main/src/services/postingEngine.ts) (Posting engine)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Application shell"]
  node_app["App router<br/>[App.tsx]"]
end

subgraph group_operations["Business operations"]
  node_companies["Companies<br/>[CompaniesView.tsx]"]
  node_branches["Branches<br/>[BranchesView.tsx]"]
  node_sales["Sales and customers<br/>[SalesView.tsx]"]
  node_purchases["Purchases and suppliers<br/>[PurchasesView.tsx]"]
  node_inventory["Inventory<br/>[InventoryView.tsx]"]
  node_expenses["Expenses<br/>[ExpensesView.tsx]"]
end

subgraph group_finance["Finance and governance"]
  node_reports["Financial reports"]
  node_ledger["General ledger"]
  node_treasury["Cash and banking"]
  node_voucher["Journal voucher"]
  node_reconcile["Reconciliation"]
  node_audit["Audit center<br/>[AuditCenter.tsx]"]
  node_approvals["Approvals<br/>[ApprovalsView.tsx]"]
end

subgraph group_insight["Intelligence and collaboration"]
  node_dashboard["Executive dashboard"]
  node_ai["AI analyst<br/>[AIAnalystView.tsx]"]
  node_tasks["Tasks<br/>[TasksView.tsx]"]
  node_messages["Messages<br/>[MessagesView.tsx]"]
end

subgraph group_core["Shared runtime"]
  node_scope["Scope and drill-down<br/>[ScopeContext.tsx]"]
  node_auth["Role access<br/>[AuthContext.tsx]"]
  node_i18n["Arabic/English<br/>[I18nContext.tsx]"]
  node_posting["Posting engine<br/>[postingEngine.ts]"]
  node_reporting["Reporting service"]
  node_reconciliation_service["Invariant auditor"]
  node_permissions["Permission evaluator"]
  node_db[("In-memory repository<br/>[database.ts]")]
end

node_owner(("Business user"))
node_gemini["Gemini SDK"]

node_owner -->|"uses"| node_app
node_app -->|"provides scope"| node_scope
node_app -->|"provides identity"| node_auth
node_app -->|"provides language"| node_i18n
node_app -->|"routes to"| node_dashboard
node_app -->|"routes to"| node_companies
node_app -->|"routes to"| node_branches
node_app -->|"routes to"| node_sales
node_app -->|"routes to"| node_purchases
node_app -->|"routes to"| node_inventory
node_app -->|"routes to"| node_expenses
node_app -->|"routes to"| node_reports
node_app -->|"routes to"| node_ledger
node_app -->|"routes to"| node_treasury
node_app -->|"routes to"| node_reconcile
node_app -->|"routes to"| node_audit
node_app -->|"routes to"| node_approvals
node_app -->|"routes to"| node_ai
node_app -->|"routes to"| node_tasks
node_app -->|"routes to"| node_messages
node_companies -->|"reads"| node_db
node_branches -->|"reads"| node_db
node_sales -->|"reads"| node_db
node_sales -->|"opens"| node_voucher
node_expenses -->|"posts expense"| node_posting
node_voucher -->|"posts voucher"| node_posting
node_posting -->|"saves journal"| node_db
node_ledger -->|"uses"| node_posting
node_ledger -->|"reads"| node_db
node_dashboard -->|"requests KPIs"| node_reporting
node_reports -->|"requests reports"| node_reporting
node_reporting -->|"reads"| node_db
node_reconcile -->|"runs checks"| node_reconciliation_service
node_reconciliation_service -->|"reads"| node_db
node_auth -->|"checks access"| node_permissions
node_auth -->|"loads users"| node_db
node_ai -->|"reads business data"| node_db
node_ai -->|"requests metrics"| node_reporting
node_tasks -->|"reads and updates"| node_db
node_messages -->|"uses messages"| node_db
node_ai -.->|"queries model"| node_gemini

click node_app "https://github.com/jawadabuhalaweh/saas-dashboard/blob/main/src/App.tsx"
click node_scope "https://github.com/jawadabuhalaweh/saas-dashboard/blob/main/src/context/ScopeContext.tsx"
click node_auth "https://github.com/jawadabuhalaweh/saas-dashboard/blob/main/src/context/AuthContext.tsx"
click node_i18n "https://github.com/jawadabuhalaweh/saas-dashboard/blob/main/src/context/I18nContext.tsx"
click node_companies "https://github.com/jawadabuhalaweh/saas-dashboard/blob/main/src/components/companies/CompaniesView.tsx"
click node_branches "https://github.com/jawadabuhalaweh/saas-dashboard/blob/main/src/components/branches/BranchesView.tsx"
click node_sales "https://github.com/jawadabuhalaweh/saas-dashboard/blob/main/src/components/operations/SalesView.tsx"
click node_purchases "https://github.com/jawadabuhalaweh/saas-dashboard/blob/main/src/components/operations/PurchasesView.tsx"
click node_inventory "https://github.com/jawadabuhalaweh/saas-dashboard/blob/main/src/components/operations/InventoryView.tsx"
click node_expenses "https://github.com/jawadabuhalaweh/saas-dashboard/blob/main/src/components/operations/ExpensesView.tsx"
click node_dashboard "https://github.com/jawadabuhalaweh/saas-dashboard/blob/main/src/components/dashboard/ExecutiveDashboard.tsx"
click node_reports "https://github.com/jawadabuhalaweh/saas-dashboard/blob/main/src/components/finance/FinancialReportsView.tsx"
click node_ledger "https://github.com/jawadabuhalaweh/saas-dashboard/blob/main/src/components/finance/GeneralLedgerView.tsx"
click node_treasury "https://github.com/jawadabuhalaweh/saas-dashboard/blob/main/src/components/finance/CashBankingView.tsx"
click node_voucher "https://github.com/jawadabuhalaweh/saas-dashboard/blob/main/src/components/modals/NewJournalVoucherModal.tsx"
click node_reconcile "https://github.com/jawadabuhalaweh/saas-dashboard/blob/main/src/components/governance/ReconciliationCenter.tsx"
click node_audit "https://github.com/jawadabuhalaweh/saas-dashboard/blob/main/src/components/governance/AuditCenter.tsx"
click node_approvals "https://github.com/jawadabuhalaweh/saas-dashboard/blob/main/src/components/governance/ApprovalsView.tsx"
click node_ai "https://github.com/jawadabuhalaweh/saas-dashboard/blob/main/src/components/intelligence/AIAnalystView.tsx"
click node_tasks "https://github.com/jawadabuhalaweh/saas-dashboard/blob/main/src/components/collaboration/TasksView.tsx"
click node_messages "https://github.com/jawadabuhalaweh/saas-dashboard/blob/main/src/components/collaboration/MessagesView.tsx"
click node_posting "https://github.com/jawadabuhalaweh/saas-dashboard/blob/main/src/services/postingEngine.ts"
click node_reporting "https://github.com/jawadabuhalaweh/saas-dashboard/blob/main/src/services/reportingService.ts"
click node_reconciliation_service "https://github.com/jawadabuhalaweh/saas-dashboard/blob/main/src/services/reconciliationService.ts"
click node_permissions "https://github.com/jawadabuhalaweh/saas-dashboard/blob/main/src/services/permissionService.ts"
click node_db "https://github.com/jawadabuhalaweh/saas-dashboard/blob/main/src/services/database.ts"

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_app,node_owner toneBlue
class node_companies,node_branches,node_sales,node_purchases,node_inventory,node_expenses toneAmber
class node_reports,node_ledger,node_treasury,node_voucher,node_reconcile,node_audit,node_approvals toneMint
class node_dashboard,node_ai,node_tasks,node_messages toneRose
class node_scope,node_auth,node_i18n,node_posting,node_reporting,node_reconciliation_service,node_permissions,node_db,node_gemini toneIndigo
```

## Components

### Application shell

- [App router](https://github.com/jawadabuhalaweh/saas-dashboard/blob/main/src/App.tsx): `src/App.tsx`

### Business operations

- [Companies](https://github.com/jawadabuhalaweh/saas-dashboard/blob/main/src/components/companies/CompaniesView.tsx): `src/components/companies/CompaniesView.tsx`
- [Branches](https://github.com/jawadabuhalaweh/saas-dashboard/blob/main/src/components/branches/BranchesView.tsx): `src/components/branches/BranchesView.tsx`
- [Sales and customers](https://github.com/jawadabuhalaweh/saas-dashboard/blob/main/src/components/operations/SalesView.tsx): `src/components/operations/SalesView.tsx`
- [Purchases and suppliers](https://github.com/jawadabuhalaweh/saas-dashboard/blob/main/src/components/operations/PurchasesView.tsx): `src/components/operations/PurchasesView.tsx`
- [Inventory](https://github.com/jawadabuhalaweh/saas-dashboard/blob/main/src/components/operations/InventoryView.tsx): `src/components/operations/InventoryView.tsx`
- [Expenses](https://github.com/jawadabuhalaweh/saas-dashboard/blob/main/src/components/operations/ExpensesView.tsx): `src/components/operations/ExpensesView.tsx`

### Finance and governance

- [Financial reports](https://github.com/jawadabuhalaweh/saas-dashboard/blob/main/src/components/finance/FinancialReportsView.tsx): `src/components/finance/FinancialReportsView.tsx`
- [General ledger](https://github.com/jawadabuhalaweh/saas-dashboard/blob/main/src/components/finance/GeneralLedgerView.tsx): `src/components/finance/GeneralLedgerView.tsx`
- [Cash and banking](https://github.com/jawadabuhalaweh/saas-dashboard/blob/main/src/components/finance/CashBankingView.tsx): `src/components/finance/CashBankingView.tsx`
- [Journal voucher](https://github.com/jawadabuhalaweh/saas-dashboard/blob/main/src/components/modals/NewJournalVoucherModal.tsx): `src/components/modals/NewJournalVoucherModal.tsx`
- [Reconciliation](https://github.com/jawadabuhalaweh/saas-dashboard/blob/main/src/components/governance/ReconciliationCenter.tsx): `src/components/governance/ReconciliationCenter.tsx`
- [Audit center](https://github.com/jawadabuhalaweh/saas-dashboard/blob/main/src/components/governance/AuditCenter.tsx): `src/components/governance/AuditCenter.tsx`
- [Approvals](https://github.com/jawadabuhalaweh/saas-dashboard/blob/main/src/components/governance/ApprovalsView.tsx): `src/components/governance/ApprovalsView.tsx`

### Intelligence and collaboration

- [Executive dashboard](https://github.com/jawadabuhalaweh/saas-dashboard/blob/main/src/components/dashboard/ExecutiveDashboard.tsx): `src/components/dashboard/ExecutiveDashboard.tsx`
- [AI analyst](https://github.com/jawadabuhalaweh/saas-dashboard/blob/main/src/components/intelligence/AIAnalystView.tsx): `src/components/intelligence/AIAnalystView.tsx`
- [Tasks](https://github.com/jawadabuhalaweh/saas-dashboard/blob/main/src/components/collaboration/TasksView.tsx): `src/components/collaboration/TasksView.tsx`
- [Messages](https://github.com/jawadabuhalaweh/saas-dashboard/blob/main/src/components/collaboration/MessagesView.tsx): `src/components/collaboration/MessagesView.tsx`

### Shared runtime

- [Scope and drill-down](https://github.com/jawadabuhalaweh/saas-dashboard/blob/main/src/context/ScopeContext.tsx): `src/context/ScopeContext.tsx`
- [Role access](https://github.com/jawadabuhalaweh/saas-dashboard/blob/main/src/context/AuthContext.tsx): `src/context/AuthContext.tsx`
- [Arabic/English](https://github.com/jawadabuhalaweh/saas-dashboard/blob/main/src/context/I18nContext.tsx): `src/context/I18nContext.tsx`
- [Posting engine](https://github.com/jawadabuhalaweh/saas-dashboard/blob/main/src/services/postingEngine.ts): `src/services/postingEngine.ts`
- [Reporting service](https://github.com/jawadabuhalaweh/saas-dashboard/blob/main/src/services/reportingService.ts): `src/services/reportingService.ts`
- [Invariant auditor](https://github.com/jawadabuhalaweh/saas-dashboard/blob/main/src/services/reconciliationService.ts): `src/services/reconciliationService.ts`
- [Permission evaluator](https://github.com/jawadabuhalaweh/saas-dashboard/blob/main/src/services/permissionService.ts): `src/services/permissionService.ts`
- [In-memory repository](https://github.com/jawadabuhalaweh/saas-dashboard/blob/main/src/services/database.ts): `src/services/database.ts`

### Other components

- **Business user**
- **Gemini SDK**

## Connections

- Business user → App router: uses (evidence: `README.md`)
- App router → Scope and drill-down: provides scope (evidence: `src/App.tsx`)
- App router → Role access: provides identity (evidence: `src/App.tsx`)
- App router → Arabic/English: provides language (evidence: `src/App.tsx`)
- App router → Executive dashboard: routes to (evidence: `src/App.tsx`)
- App router → Companies: routes to (evidence: `src/App.tsx`)
- App router → Branches: routes to (evidence: `src/App.tsx`)
- App router → Sales and customers: routes to (evidence: `src/App.tsx`)
- App router → Purchases and suppliers: routes to (evidence: `src/App.tsx`)
- App router → Inventory: routes to (evidence: `src/App.tsx`)
- App router → Expenses: routes to (evidence: `src/App.tsx`)
- App router → Financial reports: routes to (evidence: `src/App.tsx`)
- App router → General ledger: routes to (evidence: `src/App.tsx`)
- App router → Cash and banking: routes to (evidence: `src/App.tsx`)
- App router → Reconciliation: routes to (evidence: `src/App.tsx`)
- App router → Audit center: routes to (evidence: `src/App.tsx`)
- App router → Approvals: routes to (evidence: `src/App.tsx`)
- App router → AI analyst: routes to (evidence: `src/App.tsx`)
- App router → Tasks: routes to (evidence: `src/App.tsx`)
- App router → Messages: routes to (evidence: `src/App.tsx`)
- Companies → In-memory repository: reads (evidence: `src/components/companies/CompaniesView.tsx`)
- Branches → In-memory repository: reads (evidence: `src/components/branches/BranchesView.tsx`)
- Sales and customers → In-memory repository: reads (evidence: `src/components/operations/SalesView.tsx`)
- Sales and customers → Journal voucher: opens (evidence: `src/App.tsx`)
- Expenses → Posting engine: posts expense
- Journal voucher → Posting engine: posts voucher (evidence: `src/services/postingEngine.ts`)
- Posting engine → In-memory repository: saves journal (evidence: `src/services/postingEngine.ts`)
- General ledger → Posting engine: uses (evidence: `src/components/finance/GeneralLedgerView.tsx`)
- General ledger → In-memory repository: reads (evidence: `src/components/finance/GeneralLedgerView.tsx`)
- Executive dashboard → Reporting service: requests KPIs (evidence: `src/components/dashboard/ExecutiveDashboard.tsx`)
- Financial reports → Reporting service: requests reports (evidence: `src/components/finance/FinancialReportsView.tsx`)
- Reporting service → In-memory repository: reads (evidence: `src/services/reportingService.ts`)
- Reconciliation → Invariant auditor: runs checks (evidence: `src/components/governance/ReconciliationCenter.tsx`)
- Invariant auditor → In-memory repository: reads (evidence: `src/services/reconciliationService.ts`)
- Role access → Permission evaluator: checks access (evidence: `src/context/AuthContext.tsx`)
- Role access → In-memory repository: loads users (evidence: `src/context/AuthContext.tsx`)
- AI analyst → In-memory repository: reads business data (evidence: `src/components/intelligence/AIAnalystView.tsx`)
- AI analyst → Reporting service: requests metrics (evidence: `src/components/intelligence/AIAnalystView.tsx`)
- Tasks → In-memory repository: reads and updates (evidence: `src/components/collaboration/TasksView.tsx`)
- Messages → In-memory repository: uses messages (evidence: `src/components/collaboration/MessagesView.tsx`)
- AI analyst → Gemini SDK: queries model (evidence: `README.md`)
