# vishnupriyen/hanubix architecture

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

- Interactive diagram: https://gitdiagram.com/vishnupriyen/hanubix
- Repository: https://github.com/vishnupriyen/hanubix

## Overview

DBRoX is an offline-first distributor operations app with a companion server for accounts, synchronization, and AI photo reading. The main workflow is to submit a file or plain-language request, review the resulting table, correct issues, and approve changes; the app also supports ordering, billing, inventory, delivery, collections, and accounts. The graph includes major README capabilities and sampled core modules. Some unsampled subsystems are represented by their existing core or server directories; their internal wiring is not inferred.

Main entry points: [`app/src/core/engine.ts`](https://github.com/vishnupriyen/hanubix/blob/main/app/src/core/engine.ts) (RoX Engine), [`server/src/app.ts`](https://github.com/vishnupriyen/hanubix/blob/main/server/src/app.ts) (Server API), [`app/src/core/billing.ts`](https://github.com/vishnupriyen/hanubix/blob/main/app/src/core/billing.ts) (Billing), [`app/src/core/db.ts`](https://github.com/vishnupriyen/hanubix/blob/main/app/src/core/db.ts) (Offline Database)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Phone App"]
  node_app_shell["App Shell<br/>[App.tsx]"]
  node_chat["Chat Input<br/>[Chat.tsx]"]
  node_review["Review and Approve<br/>[Approve.tsx]"]
end

subgraph group_operations["Distributor Operations"]
  node_engine["RoX Engine<br/>[engine.ts]"]
  node_company_engine["Company Engine<br/>[companyEngine.ts]"]
  node_readers["File Readers<br/>[readers.ts]"]
  node_matching["Product Matching<br/>[match.ts]"]
  node_proposals["Change Proposals<br/>[proposals.ts]"]
  node_order_delivery["Order and Delivery<br/>[pipeline.ts]"]
  node_billing["Billing<br/>[billing.ts]"]
  node_accounts["Accounts and Credit<br/>[credit.ts]"]
  node_gst["GST Rules<br/>[gst.ts]"]
  node_field["Field Operations<br/>[field.ts]"]
  node_claims_reports["Claims and Reports"]
end

subgraph group_server["Server Services"]
  node_server_app["Server API<br/>[app.ts]"]
  node_auth["Login and Auth<br/>[auth.ts]"]
  node_server_db[("PostgreSQL<br/>[db.ts]")]
  node_scan["RoX Scan<br/>[scan.ts]"]
  node_archive["Data Archive<br/>[archive.ts]"]
end

subgraph group_storage["Data and Rules"]
  node_local_db[("Offline Database<br/>[db.ts]")]
  node_sync["Offline Sync<br/>[sync.ts]"]
end

node_distributor(("Distributor User"))

node_distributor -->|"uses"| node_app_shell
node_app_shell -->|"opens"| node_chat
node_chat -->|"submits requests"| node_engine
node_engine -->|"delegates company requests"| node_company_engine
node_engine -->|"reads attachments"| node_readers
node_engine -->|"matches products"| node_matching
node_engine -->|"reads data"| node_local_db
node_engine -.->|"creates proposals"| node_proposals
node_engine -->|"presents changes"| node_review
node_distributor -->|"checks and approves"| node_review
node_proposals -->|"validates orders"| node_billing
node_proposals -->|"checks write-off"| node_accounts
node_order_delivery -->|"checks orders"| node_billing
node_billing -->|"uses tax rules"| node_gst
node_billing -->|"reads and writes"| node_local_db
node_accounts -->|"uses billing data"| node_billing
node_accounts -->|"reads and writes"| node_local_db
node_field -->|"reads and writes"| node_local_db
node_sync -->|"syncs local records"| node_local_db
node_sync -->|"syncs over HTTP"| node_server_app
node_server_app -->|"checks credentials"| node_auth
node_server_app -->|"routes scan requests"| node_scan
node_server_app -->|"uses archive service"| node_archive
node_server_app -.->|"persists server data"| node_server_db

click node_app_shell "https://github.com/vishnupriyen/hanubix/blob/main/app/src/App.tsx"
click node_chat "https://github.com/vishnupriyen/hanubix/blob/main/app/src/ui/Chat.tsx"
click node_review "https://github.com/vishnupriyen/hanubix/blob/main/app/src/ui/Approve.tsx"
click node_engine "https://github.com/vishnupriyen/hanubix/blob/main/app/src/core/engine.ts"
click node_company_engine "https://github.com/vishnupriyen/hanubix/blob/main/app/src/core/companyEngine.ts"
click node_readers "https://github.com/vishnupriyen/hanubix/blob/main/app/src/core/readers.ts"
click node_matching "https://github.com/vishnupriyen/hanubix/blob/main/app/src/core/match.ts"
click node_proposals "https://github.com/vishnupriyen/hanubix/blob/main/app/src/core/proposals.ts"
click node_order_delivery "https://github.com/vishnupriyen/hanubix/blob/main/app/src/core/pipeline.ts"
click node_billing "https://github.com/vishnupriyen/hanubix/blob/main/app/src/core/billing.ts"
click node_accounts "https://github.com/vishnupriyen/hanubix/blob/main/app/src/core/credit.ts"
click node_gst "https://github.com/vishnupriyen/hanubix/blob/main/app/src/core/gst.ts"
click node_field "https://github.com/vishnupriyen/hanubix/blob/main/app/src/core/field.ts"
click node_claims_reports "https://github.com/vishnupriyen/hanubix/tree/main/app/src/core"
click node_local_db "https://github.com/vishnupriyen/hanubix/blob/main/app/src/core/db.ts"
click node_sync "https://github.com/vishnupriyen/hanubix/blob/main/app/src/core/sync.ts"
click node_server_app "https://github.com/vishnupriyen/hanubix/blob/main/server/src/app.ts"
click node_auth "https://github.com/vishnupriyen/hanubix/blob/main/server/src/auth.ts"
click node_server_db "https://github.com/vishnupriyen/hanubix/blob/main/server/src/db.ts"
click node_scan "https://github.com/vishnupriyen/hanubix/blob/main/server/src/scan.ts"
click node_archive "https://github.com/vishnupriyen/hanubix/blob/main/server/src/archive.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_shell,node_chat,node_review,node_distributor toneBlue
class node_engine,node_company_engine,node_readers,node_matching,node_proposals,node_order_delivery,node_billing,node_accounts,node_gst,node_field,node_claims_reports toneAmber
class node_server_app,node_auth,node_server_db,node_scan,node_archive toneMint
class node_local_db,node_sync toneRose
```

## Components

### Phone App

- [App Shell](https://github.com/vishnupriyen/hanubix/blob/main/app/src/App.tsx): `app/src/App.tsx`
- [Chat Input](https://github.com/vishnupriyen/hanubix/blob/main/app/src/ui/Chat.tsx): `app/src/ui/Chat.tsx`
- [Review and Approve](https://github.com/vishnupriyen/hanubix/blob/main/app/src/ui/Approve.tsx): `app/src/ui/Approve.tsx`

### Distributor Operations

- [RoX Engine](https://github.com/vishnupriyen/hanubix/blob/main/app/src/core/engine.ts): `app/src/core/engine.ts`
- [Company Engine](https://github.com/vishnupriyen/hanubix/blob/main/app/src/core/companyEngine.ts): `app/src/core/companyEngine.ts`
- [File Readers](https://github.com/vishnupriyen/hanubix/blob/main/app/src/core/readers.ts): `app/src/core/readers.ts`
- [Product Matching](https://github.com/vishnupriyen/hanubix/blob/main/app/src/core/match.ts): `app/src/core/match.ts`
- [Change Proposals](https://github.com/vishnupriyen/hanubix/blob/main/app/src/core/proposals.ts): `app/src/core/proposals.ts`
- [Order and Delivery](https://github.com/vishnupriyen/hanubix/blob/main/app/src/core/pipeline.ts): `app/src/core/pipeline.ts`
- [Billing](https://github.com/vishnupriyen/hanubix/blob/main/app/src/core/billing.ts): `app/src/core/billing.ts`
- [Accounts and Credit](https://github.com/vishnupriyen/hanubix/blob/main/app/src/core/credit.ts): `app/src/core/credit.ts`
- [GST Rules](https://github.com/vishnupriyen/hanubix/blob/main/app/src/core/gst.ts): `app/src/core/gst.ts`
- [Field Operations](https://github.com/vishnupriyen/hanubix/blob/main/app/src/core/field.ts): `app/src/core/field.ts`
- [Claims and Reports](https://github.com/vishnupriyen/hanubix/tree/main/app/src/core): `app/src/core`

### Server Services

- [Server API](https://github.com/vishnupriyen/hanubix/blob/main/server/src/app.ts): `server/src/app.ts`
- [Login and Auth](https://github.com/vishnupriyen/hanubix/blob/main/server/src/auth.ts): `server/src/auth.ts`
- [PostgreSQL](https://github.com/vishnupriyen/hanubix/blob/main/server/src/db.ts): `server/src/db.ts`
- [RoX Scan](https://github.com/vishnupriyen/hanubix/blob/main/server/src/scan.ts): `server/src/scan.ts`
- [Data Archive](https://github.com/vishnupriyen/hanubix/blob/main/server/src/archive.ts): `server/src/archive.ts`

### Data and Rules

- [Offline Database](https://github.com/vishnupriyen/hanubix/blob/main/app/src/core/db.ts): `app/src/core/db.ts`
- [Offline Sync](https://github.com/vishnupriyen/hanubix/blob/main/app/src/core/sync.ts): `app/src/core/sync.ts`

### Other components

- **Distributor User**

## Connections

- Distributor User → App Shell: uses (evidence: `README.md`)
- App Shell → Chat Input: opens (evidence: `app/src/App.tsx`)
- Chat Input → RoX Engine: submits requests (evidence: `README.md`)
- RoX Engine → Company Engine: delegates company requests (evidence: `app/src/core/engine.ts`)
- RoX Engine → File Readers: reads attachments (evidence: `app/src/core/engine.ts`)
- RoX Engine → Product Matching: matches products (evidence: `app/src/core/engine.ts`)
- RoX Engine → Offline Database: reads data (evidence: `app/src/core/engine.ts`)
- RoX Engine → Change Proposals: creates proposals (evidence: `app/src/core/engine.ts`)
- RoX Engine → Review and Approve: presents changes (evidence: `README.md`)
- Distributor User → Review and Approve: checks and approves (evidence: `README.md`)
- Change Proposals → Billing: validates orders (evidence: `app/src/core/proposals.ts`)
- Change Proposals → Accounts and Credit: checks write-off (evidence: `app/src/core/proposals.ts`)
- Order and Delivery → Billing: checks orders (evidence: `app/src/core/pipeline.ts`)
- Billing → GST Rules: uses tax rules (evidence: `app/src/core/billing.ts`)
- Billing → Offline Database: reads and writes (evidence: `app/src/core/billing.ts`)
- Accounts and Credit → Billing: uses billing data (evidence: `app/src/core/credit.ts`)
- Accounts and Credit → Offline Database: reads and writes (evidence: `app/src/core/credit.ts`)
- Field Operations → Offline Database: reads and writes (evidence: `app/src/core/field.ts`)
- Offline Sync → Offline Database: syncs local records (evidence: `app/src/core/sync.ts`)
- Offline Sync → Server API: syncs over HTTP (evidence: `README.md`)
- Server API → Login and Auth: checks credentials (evidence: `server/src/app.ts`)
- Server API → RoX Scan: routes scan requests (evidence: `server/src/app.ts`)
- Server API → Data Archive: uses archive service (evidence: `server/src/app.ts`)
- Server API → PostgreSQL: persists server data
