# infoadcraftstudio-hub/munshi-app architecture

> Architecture diagram of the GitHub repository infoadcraftstudio-hub/munshi-app, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-26). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/infoadcraftstudio-hub/munshi-app
- Repository: https://github.com/infoadcraftstudio-hub/munshi-app

## Overview

Munshi is a shopkeeper’s digital credit-ledger PWA. The main workflow is recording customer credit or payments, then viewing balances and sending reminders; supplier accounts, sales/profit, offline use, and AI tools are separate capabilities. The README documents these features and the stack, but the tree contains no application JavaScript or migrations, so implementation-level wiring cannot be verified. Feature paths use the existing index.html; AI logic is documented as a dashboard-managed Edge Function.

Main entry points: [`index.html`](https://github.com/infoadcraftstudio-hub/munshi-app/blob/main/index.html) (Munshi app), [`sw.js`](https://github.com/infoadcraftstudio-hub/munshi-app/blob/main/sw.js) (Service worker), [`manifest.json`](https://github.com/infoadcraftstudio-hub/munshi-app/blob/main/manifest.json) (PWA manifest)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ledger["Ledger"]
  node_app["Munshi app<br/>[index.html]"]
  node_customers["Customer accounts<br/>[index.html]"]
  node_transactions["Credit and payments<br/>[index.html]"]
  node_balances["Customer balances<br/>[index.html]"]
  node_suppliers["Supplier accounts<br/>[index.html]"]
  node_supplier_transactions["Supplier transactions<br/>[index.html]"]
end

subgraph group_business["Shop Operations"]
  node_sales["Sales and profit<br/>[index.html]"]
  node_trash["Trash and restore<br/>[index.html]"]
  node_reminders["Payment reminders<br/>[index.html]"]
  node_ai["AI queries and receipts"]
end

subgraph group_platform["App Platform"]
  node_local_store[("Offline data<br/>[index.html]")]
  node_sync["Offline sync<br/>[index.html]"]
  node_service_worker["Service worker<br/>[sw.js]"]
  node_manifest["PWA manifest<br/>[manifest.json]"]
end

subgraph group_integrations["External Services"]
  node_supabase[("Supabase")]
  node_google["Google Sign-In"]
  node_whatsapp["WhatsApp"]
end

node_shopkeeper(("Shopkeeper"))

node_shopkeeper -->|"uses"| node_app
node_app -->|"manages"| node_customers
node_app -->|"records"| node_transactions
node_transactions -->|"updates"| node_balances
node_app -->|"manages"| node_suppliers
node_app -->|"records"| node_supplier_transactions
node_app -->|"shows"| node_sales
node_app -->|"restores"| node_trash
node_app -->|"sends"| node_reminders
node_reminders -->|"delivers via"| node_whatsapp
node_app -.->|"requests"| node_ai
node_ai -.->|"runs as function"| node_supabase
node_app -->|"stores offline"| node_local_store
node_sync -->|"syncs"| node_local_store
node_sync -->|"syncs to"| node_supabase
node_app -->|"uses"| node_sync
node_app -->|"reads and writes"| node_supabase
node_app -->|"authenticates with"| node_google
node_service_worker -->|"caches"| node_manifest

click node_app "https://github.com/infoadcraftstudio-hub/munshi-app/blob/main/index.html"
click node_customers "https://github.com/infoadcraftstudio-hub/munshi-app/blob/main/index.html"
click node_transactions "https://github.com/infoadcraftstudio-hub/munshi-app/blob/main/index.html"
click node_balances "https://github.com/infoadcraftstudio-hub/munshi-app/blob/main/index.html"
click node_suppliers "https://github.com/infoadcraftstudio-hub/munshi-app/blob/main/index.html"
click node_supplier_transactions "https://github.com/infoadcraftstudio-hub/munshi-app/blob/main/index.html"
click node_sales "https://github.com/infoadcraftstudio-hub/munshi-app/blob/main/index.html"
click node_trash "https://github.com/infoadcraftstudio-hub/munshi-app/blob/main/index.html"
click node_reminders "https://github.com/infoadcraftstudio-hub/munshi-app/blob/main/index.html"
click node_local_store "https://github.com/infoadcraftstudio-hub/munshi-app/blob/main/index.html"
click node_sync "https://github.com/infoadcraftstudio-hub/munshi-app/blob/main/index.html"
click node_service_worker "https://github.com/infoadcraftstudio-hub/munshi-app/blob/main/sw.js"
click node_manifest "https://github.com/infoadcraftstudio-hub/munshi-app/blob/main/manifest.json"

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_customers,node_transactions,node_balances,node_suppliers,node_supplier_transactions toneBlue
class node_sales,node_trash,node_reminders,node_ai toneAmber
class node_local_store,node_sync,node_service_worker,node_manifest toneMint
class node_supabase,node_google,node_whatsapp toneRose
class node_shopkeeper toneIndigo
```

## Components

### Ledger

- [Munshi app](https://github.com/infoadcraftstudio-hub/munshi-app/blob/main/index.html): `index.html`
- [Customer accounts](https://github.com/infoadcraftstudio-hub/munshi-app/blob/main/index.html): `index.html`
- [Credit and payments](https://github.com/infoadcraftstudio-hub/munshi-app/blob/main/index.html): `index.html`
- [Customer balances](https://github.com/infoadcraftstudio-hub/munshi-app/blob/main/index.html): `index.html`
- [Supplier accounts](https://github.com/infoadcraftstudio-hub/munshi-app/blob/main/index.html): `index.html`
- [Supplier transactions](https://github.com/infoadcraftstudio-hub/munshi-app/blob/main/index.html): `index.html`

### Shop Operations

- [Sales and profit](https://github.com/infoadcraftstudio-hub/munshi-app/blob/main/index.html): `index.html`
- [Trash and restore](https://github.com/infoadcraftstudio-hub/munshi-app/blob/main/index.html): `index.html`
- [Payment reminders](https://github.com/infoadcraftstudio-hub/munshi-app/blob/main/index.html): `index.html`
- **AI queries and receipts**

### App Platform

- [Offline data](https://github.com/infoadcraftstudio-hub/munshi-app/blob/main/index.html): `index.html`
- [Offline sync](https://github.com/infoadcraftstudio-hub/munshi-app/blob/main/index.html): `index.html`
- [Service worker](https://github.com/infoadcraftstudio-hub/munshi-app/blob/main/sw.js): `sw.js`
- [PWA manifest](https://github.com/infoadcraftstudio-hub/munshi-app/blob/main/manifest.json): `manifest.json`

### External Services

- **Supabase**
- **Google Sign-In**
- **WhatsApp**

### Other components

- **Shopkeeper**

## Connections

- Shopkeeper → Munshi app: uses
- Munshi app → Customer accounts: manages
- Munshi app → Credit and payments: records
- Credit and payments → Customer balances: updates
- Munshi app → Supplier accounts: manages
- Munshi app → Supplier transactions: records
- Munshi app → Sales and profit: shows
- Munshi app → Trash and restore: restores
- Munshi app → Payment reminders: sends
- Payment reminders → WhatsApp: delivers via
- Munshi app → AI queries and receipts: requests
- AI queries and receipts → Supabase: runs as function
- Munshi app → Offline data: stores offline
- Offline sync → Offline data: syncs
- Offline sync → Supabase: syncs to
- Munshi app → Offline sync: uses
- Munshi app → Supabase: reads and writes
- Munshi app → Google Sign-In: authenticates with
- Service worker → PWA manifest: caches
