# coderhoper/bolt architecture

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

- Interactive diagram: https://gitdiagram.com/coderhoper/bolt
- Repository: https://github.com/coderhoper/bolt

## Overview

Hardware Business Manager is a multi-tenant business operations app. Users enter a tenant workspace, authenticate, and reach role-aware inventory, sales, purchasing/receiving, staff, and reporting screens. The repository also includes a separate platform-owner control plane for tenant provisioning and support, plus payment and inbound-document integrations. The main app routing and tenant bootstrap are excerpted; several domain screens and integrations are represented by README capabilities or filenames, so their internal call paths are not asserted.

Main entry points: [`project/src/App.tsx`](https://github.com/coderhoper/bolt/blob/main/project/src/App.tsx) (App router), [`project/src/TenantBootstrap.tsx`](https://github.com/coderhoper/bolt/blob/main/project/src/TenantBootstrap.tsx) (Tenant bootstrap), [`project/supabase/functions/process-receiving-document/index.ts`](https://github.com/coderhoper/bolt/blob/main/project/supabase/functions/process-receiving-document/index.ts) (Document processor), [`project/src/owner/OwnerOperations.tsx`](https://github.com/coderhoper/bolt/blob/main/project/src/owner/OwnerOperations.tsx) (Owner operations)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workspace["Tenant workspace"]
  node_tenant_bootstrap["Tenant bootstrap"]
  node_app_router["App router<br/>[App.tsx]"]
  node_auth["Authentication<br/>[AuthContext.tsx]"]
  node_tenant_client["Tenant Supabase client<br/>[supabase.ts]"]
end

subgraph group_operations["Business operations"]
  node_inventory["Inventory and products<br/>[Products.tsx]"]
  node_stock["Stock movements<br/>[StockMovements.tsx]"]
  node_sales["Sales<br/>[Sales.tsx]"]
  node_purchasing["Purchases and suppliers<br/>[Purchases.tsx]"]
  node_receiving["Receiving documents<br/>[Receiving.tsx]"]
  node_automation["Automation<br/>[Automation.tsx]"]
end

subgraph group_oversight["Finance and oversight"]
  node_dashboard["Dashboard<br/>[Dashboard.tsx]"]
  node_finance_reports["Finance and reports<br/>[Reports.tsx]"]
  node_staff["Employees and salaries<br/>[Employees.tsx]"]
  node_audit["Audit logs<br/>[AuditLogs.tsx]"]
end

subgraph group_platform["Platform control plane"]
  node_owner_console["Owner console<br/>[OwnerConsole.tsx]"]
  node_owner_operations["Owner operations"]
  node_owner_provisioning["Tenant provisioning<br/>[index.ts]"]
  node_tenant_migrations["Tenant migrations"]
  node_tenant_bridge["Tenant support bridge<br/>[index.ts]"]
end

subgraph group_integrations["External integrations"]
  node_payment_gateway["Payment gateway<br/>[index.ts]"]
  node_receiving_processor["Document processor<br/>[index.ts]"]
  node_whatsapp_webhook["WhatsApp webhook<br/>[index.ts]"]
  node_supabase[("Supabase services")]
  node_azure["Azure Document Intelligence"]
  node_openai["OpenAI"]
end

node_business_user(("Business user"))

node_business_user -->|"opens tenant"| node_tenant_bootstrap
node_tenant_bootstrap -->|"resolves tenant"| node_supabase
node_tenant_bootstrap -->|"sets connection"| node_tenant_client
node_tenant_bootstrap -->|"renders app"| node_app_router
node_app_router -->|"provides auth"| node_auth
node_auth -->|"authenticates through"| node_tenant_client
node_app_router -->|"routes to"| node_inventory
node_app_router -->|"routes to"| node_stock
node_app_router -->|"routes to"| node_sales
node_app_router -->|"routes to"| node_purchasing
node_app_router -->|"routes to"| node_receiving
node_app_router -->|"routes to"| node_automation
node_app_router -->|"routes to"| node_dashboard
node_app_router -->|"routes to"| node_finance_reports
node_app_router -->|"routes to"| node_staff
node_app_router -->|"routes to"| node_audit
node_owner_provisioning -->|"loads migrations"| node_tenant_migrations
node_owner_provisioning -.->|"configures tenant"| node_supabase
node_owner_console -.->|"delegates operations"| node_owner_operations
node_owner_operations -.->|"requests provisioning"| node_owner_provisioning
node_owner_operations -.->|"uses support bridge"| node_tenant_bridge
node_sales -.->|"initiates payment"| node_payment_gateway
node_receiving -.->|"submits document"| node_receiving_processor
node_whatsapp_webhook -.->|"processes inbound document"| node_receiving_processor
node_receiving_processor -->|"scans document"| node_azure
node_receiving_processor -->|"extracts fields"| node_openai

click node_tenant_bootstrap "https://github.com/coderhoper/bolt/blob/main/project/src/TenantBootstrap.tsx"
click node_app_router "https://github.com/coderhoper/bolt/blob/main/project/src/App.tsx"
click node_auth "https://github.com/coderhoper/bolt/blob/main/project/src/context/AuthContext.tsx"
click node_tenant_client "https://github.com/coderhoper/bolt/blob/main/project/src/lib/supabase.ts"
click node_inventory "https://github.com/coderhoper/bolt/blob/main/project/src/pages/Products.tsx"
click node_stock "https://github.com/coderhoper/bolt/blob/main/project/src/pages/StockMovements.tsx"
click node_sales "https://github.com/coderhoper/bolt/blob/main/project/src/pages/Sales.tsx"
click node_purchasing "https://github.com/coderhoper/bolt/blob/main/project/src/pages/Purchases.tsx"
click node_receiving "https://github.com/coderhoper/bolt/blob/main/project/src/pages/Receiving.tsx"
click node_automation "https://github.com/coderhoper/bolt/blob/main/project/src/pages/Automation.tsx"
click node_dashboard "https://github.com/coderhoper/bolt/blob/main/project/src/pages/Dashboard.tsx"
click node_finance_reports "https://github.com/coderhoper/bolt/blob/main/project/src/pages/Reports.tsx"
click node_staff "https://github.com/coderhoper/bolt/blob/main/project/src/pages/Employees.tsx"
click node_audit "https://github.com/coderhoper/bolt/blob/main/project/src/pages/AuditLogs.tsx"
click node_owner_console "https://github.com/coderhoper/bolt/blob/main/project/src/owner/OwnerConsole.tsx"
click node_owner_operations "https://github.com/coderhoper/bolt/blob/main/project/src/owner/OwnerOperations.tsx"
click node_owner_provisioning "https://github.com/coderhoper/bolt/blob/main/project/supabase-owner/supabase/functions/owner-provisioning/index.ts"
click node_tenant_migrations "https://github.com/coderhoper/bolt/blob/main/project/supabase-owner/supabase/functions/owner-provisioning/tenantMigrations.ts"
click node_tenant_bridge "https://github.com/coderhoper/bolt/blob/main/project/supabase-owner/supabase/functions/tenant-bridge/index.ts"
click node_payment_gateway "https://github.com/coderhoper/bolt/blob/main/project/supabase/functions/payment-gateway/index.ts"
click node_receiving_processor "https://github.com/coderhoper/bolt/blob/main/project/supabase/functions/process-receiving-document/index.ts"
click node_whatsapp_webhook "https://github.com/coderhoper/bolt/blob/main/project/supabase/functions/whatsapp-webhook/index.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_tenant_bootstrap,node_app_router,node_auth,node_tenant_client,node_business_user toneBlue
class node_inventory,node_stock,node_sales,node_purchasing,node_receiving,node_automation toneAmber
class node_dashboard,node_finance_reports,node_staff,node_audit toneMint
class node_owner_console,node_owner_operations,node_owner_provisioning,node_tenant_migrations,node_tenant_bridge toneRose
class node_payment_gateway,node_receiving_processor,node_whatsapp_webhook,node_supabase,node_azure,node_openai toneIndigo
```

## Components

### Tenant workspace

- [Tenant bootstrap](https://github.com/coderhoper/bolt/blob/main/project/src/TenantBootstrap.tsx): `project/src/TenantBootstrap.tsx`
- [App router](https://github.com/coderhoper/bolt/blob/main/project/src/App.tsx): `project/src/App.tsx`
- [Authentication](https://github.com/coderhoper/bolt/blob/main/project/src/context/AuthContext.tsx): `project/src/context/AuthContext.tsx`
- [Tenant Supabase client](https://github.com/coderhoper/bolt/blob/main/project/src/lib/supabase.ts): `project/src/lib/supabase.ts`

### Business operations

- [Inventory and products](https://github.com/coderhoper/bolt/blob/main/project/src/pages/Products.tsx): `project/src/pages/Products.tsx`
- [Stock movements](https://github.com/coderhoper/bolt/blob/main/project/src/pages/StockMovements.tsx): `project/src/pages/StockMovements.tsx`
- [Sales](https://github.com/coderhoper/bolt/blob/main/project/src/pages/Sales.tsx): `project/src/pages/Sales.tsx`
- [Purchases and suppliers](https://github.com/coderhoper/bolt/blob/main/project/src/pages/Purchases.tsx): `project/src/pages/Purchases.tsx`
- [Receiving documents](https://github.com/coderhoper/bolt/blob/main/project/src/pages/Receiving.tsx): `project/src/pages/Receiving.tsx`
- [Automation](https://github.com/coderhoper/bolt/blob/main/project/src/pages/Automation.tsx): `project/src/pages/Automation.tsx`

### Finance and oversight

- [Dashboard](https://github.com/coderhoper/bolt/blob/main/project/src/pages/Dashboard.tsx): `project/src/pages/Dashboard.tsx`
- [Finance and reports](https://github.com/coderhoper/bolt/blob/main/project/src/pages/Reports.tsx): `project/src/pages/Reports.tsx`
- [Employees and salaries](https://github.com/coderhoper/bolt/blob/main/project/src/pages/Employees.tsx): `project/src/pages/Employees.tsx`
- [Audit logs](https://github.com/coderhoper/bolt/blob/main/project/src/pages/AuditLogs.tsx): `project/src/pages/AuditLogs.tsx`

### Platform control plane

- [Owner console](https://github.com/coderhoper/bolt/blob/main/project/src/owner/OwnerConsole.tsx): `project/src/owner/OwnerConsole.tsx`
- [Owner operations](https://github.com/coderhoper/bolt/blob/main/project/src/owner/OwnerOperations.tsx): `project/src/owner/OwnerOperations.tsx`
- [Tenant provisioning](https://github.com/coderhoper/bolt/blob/main/project/supabase-owner/supabase/functions/owner-provisioning/index.ts): `project/supabase-owner/supabase/functions/owner-provisioning/index.ts`
- [Tenant migrations](https://github.com/coderhoper/bolt/blob/main/project/supabase-owner/supabase/functions/owner-provisioning/tenantMigrations.ts): `project/supabase-owner/supabase/functions/owner-provisioning/tenantMigrations.ts`
- [Tenant support bridge](https://github.com/coderhoper/bolt/blob/main/project/supabase-owner/supabase/functions/tenant-bridge/index.ts): `project/supabase-owner/supabase/functions/tenant-bridge/index.ts`

### External integrations

- [Payment gateway](https://github.com/coderhoper/bolt/blob/main/project/supabase/functions/payment-gateway/index.ts): `project/supabase/functions/payment-gateway/index.ts`
- [Document processor](https://github.com/coderhoper/bolt/blob/main/project/supabase/functions/process-receiving-document/index.ts): `project/supabase/functions/process-receiving-document/index.ts`
- [WhatsApp webhook](https://github.com/coderhoper/bolt/blob/main/project/supabase/functions/whatsapp-webhook/index.ts): `project/supabase/functions/whatsapp-webhook/index.ts`
- **Supabase services**
- **Azure Document Intelligence**
- **OpenAI**

### Other components

- **Business user**

## Connections

- Business user → Tenant bootstrap: opens tenant
- Tenant bootstrap → Supabase services: resolves tenant (evidence: `project/src/TenantBootstrap.tsx`)
- Tenant bootstrap → Tenant Supabase client: sets connection (evidence: `project/src/TenantBootstrap.tsx`)
- Tenant bootstrap → App router: renders app (evidence: `project/src/TenantBootstrap.tsx`)
- App router → Authentication: provides auth (evidence: `project/src/App.tsx`)
- Authentication → Tenant Supabase client: authenticates through (evidence: `project/src/context/AuthContext.tsx`)
- App router → Inventory and products: routes to (evidence: `project/src/App.tsx`)
- App router → Stock movements: routes to (evidence: `project/src/App.tsx`)
- App router → Sales: routes to (evidence: `project/src/App.tsx`)
- App router → Purchases and suppliers: routes to (evidence: `project/src/App.tsx`)
- App router → Receiving documents: routes to (evidence: `project/src/App.tsx`)
- App router → Automation: routes to (evidence: `project/src/App.tsx`)
- App router → Dashboard: routes to (evidence: `project/src/App.tsx`)
- App router → Finance and reports: routes to (evidence: `project/src/App.tsx`)
- App router → Employees and salaries: routes to (evidence: `project/src/App.tsx`)
- App router → Audit logs: routes to (evidence: `project/src/App.tsx`)
- Tenant provisioning → Tenant migrations: loads migrations (evidence: `project/supabase-owner/supabase/functions/owner-provisioning/index.ts`)
- Tenant provisioning → Supabase services: configures tenant
- Owner console → Owner operations: delegates operations
- Owner operations → Tenant provisioning: requests provisioning
- Owner operations → Tenant support bridge: uses support bridge
- Sales → Payment gateway: initiates payment
- Receiving documents → Document processor: submits document
- WhatsApp webhook → Document processor: processes inbound document
- Document processor → Azure Document Intelligence: scans document (evidence: `project/supabase/functions/process-receiving-document/index.ts`)
- Document processor → OpenAI: extracts fields (evidence: `project/supabase/functions/process-receiving-document/index.ts`)
