# aashutosh-k-das/sajilo_khata_mobile architecture

> Architecture diagram of the GitHub repository aashutosh-k-das/sajilo_khata_mobile, 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/aashutosh-k-das/sajilo_khata_mobile
- Repository: https://github.com/aashutosh-k-das/sajilo_khata_mobile

## Overview

Sajilo Khata is an offline-first ledger and billing product for small businesses. Its documented workflow is to manage customers and stock, create VAT-aware invoices, record cash or credit payments, and review sales and balances; local persistence supports offline use, with sync when online. The sampled JavaScript implements a web prototype with localStorage persistence and simulated sync/SMS. The tree also contains the documented Flutter app, but its source was not sampled, so its internal wiring is not inferred here.

Main entry points: [`app.js`](https://github.com/aashutosh-k-das/sajilo_khata_mobile/blob/main/app.js) (Workflow controller), [`db.js`](https://github.com/aashutosh-k-das/sajilo_khata_mobile/blob/main/db.js) (Persistence and sync queue), [`sajilo_khata_mobile/lib/main.dart`](https://github.com/aashutosh-k-das/sajilo_khata_mobile/blob/main/sajilo_khata_mobile/lib/main.dart) (Flutter application), [`index.html`](https://github.com/aashutosh-k-das/sajilo_khata_mobile/blob/main/index.html) (Web interface)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web workflows"]
  node_webui["Web interface<br/>[index.html]"]
  node_webapp["Workflow controller<br/>[app.js]"]
  node_inventory["Inventory<br/>[app.js]"]
  node_customers["Customers<br/>[app.js]"]
  node_billing["Billing and VAT<br/>[app.js]"]
  node_ledger["Credit ledger<br/>[app.js]"]
  node_dashboard["Sales dashboard<br/>[app.js]"]
end

subgraph group_data["Local data"]
  node_browserstore[("Browser localStorage")]
  node_db["Persistence and sync queue<br/>[db.js]"]
  node_sync["Sync simulation<br/>[db.js]"]
end

subgraph group_mobile["Flutter app"]
  node_flutter["Flutter application<br/>[main.dart]"]
  node_mobileauth["Mobile authentication<br/>[login_screen.dart]"]
  node_mobiledashboard["Mobile dashboard"]
  node_mobiledb[("Mobile database")]
end

subgraph group_integrations["Supporting services"]
  node_locale["Translations<br/>[locales.js]"]
  node_smslogic["Reminder messaging<br/>[app.js]"]
  node_smshelper["SMS helper<br/>[sparrow_sms.js]"]
end

node_owner(("Shopkeeper"))
node_smsgateway(("Sparrow SMS"))
node_firebase(("Firebase"))

node_owner -->|"uses"| node_webui
node_webui -->|"dispatches actions"| node_webapp
node_webapp -->|"handles"| node_inventory
node_webapp -->|"handles"| node_customers
node_webapp -->|"handles"| node_billing
node_webapp -->|"handles"| node_ledger
node_webapp -->|"updates"| node_dashboard
node_webapp -->|"loads translations"| node_locale
node_webapp -->|"initializes and accesses"| node_db
node_inventory -->|"reads and writes"| node_db
node_customers -->|"reads and writes"| node_db
node_billing -->|"saves bills"| node_db
node_ledger -->|"records transactions"| node_db
node_dashboard -->|"reads summaries"| node_db
node_db -->|"persists data"| node_browserstore
node_db -->|"queues changes"| node_sync
node_webapp -->|"triggers sync"| node_sync
node_smslogic -->|"generates and sends"| node_smshelper
node_smshelper -.->|"simulates request"| node_smsgateway
node_owner -->|"uses"| node_flutter
node_flutter -->|"entry flow"| node_mobileauth
node_flutter -->|"shows dashboard"| node_mobiledashboard
node_flutter -->|"uses"| node_mobiledb
node_mobiledb -.->|"syncs when online"| node_firebase

click node_webui "https://github.com/aashutosh-k-das/sajilo_khata_mobile/blob/main/index.html"
click node_webapp "https://github.com/aashutosh-k-das/sajilo_khata_mobile/blob/main/app.js"
click node_inventory "https://github.com/aashutosh-k-das/sajilo_khata_mobile/blob/main/app.js"
click node_customers "https://github.com/aashutosh-k-das/sajilo_khata_mobile/blob/main/app.js"
click node_billing "https://github.com/aashutosh-k-das/sajilo_khata_mobile/blob/main/app.js"
click node_ledger "https://github.com/aashutosh-k-das/sajilo_khata_mobile/blob/main/app.js"
click node_dashboard "https://github.com/aashutosh-k-das/sajilo_khata_mobile/blob/main/app.js"
click node_locale "https://github.com/aashutosh-k-das/sajilo_khata_mobile/blob/main/locales.js"
click node_smslogic "https://github.com/aashutosh-k-das/sajilo_khata_mobile/blob/main/app.js"
click node_smshelper "https://github.com/aashutosh-k-das/sajilo_khata_mobile/blob/main/sparrow_sms.js"
click node_db "https://github.com/aashutosh-k-das/sajilo_khata_mobile/blob/main/db.js"
click node_sync "https://github.com/aashutosh-k-das/sajilo_khata_mobile/blob/main/db.js"
click node_flutter "https://github.com/aashutosh-k-das/sajilo_khata_mobile/blob/main/sajilo_khata_mobile/lib/main.dart"
click node_mobileauth "https://github.com/aashutosh-k-das/sajilo_khata_mobile/blob/main/sajilo_khata_mobile/lib/features/auth/login_screen.dart"
click node_mobiledashboard "https://github.com/aashutosh-k-das/sajilo_khata_mobile/blob/main/sajilo_khata_mobile/lib/features/dashboard/dashboard_screen.dart"
click node_mobiledb "https://github.com/aashutosh-k-das/sajilo_khata_mobile/blob/main/sajilo_khata_mobile/lib/core/database/database_helper.dart"

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_webui,node_webapp,node_inventory,node_customers,node_billing,node_ledger,node_dashboard toneBlue
class node_browserstore,node_db,node_sync toneAmber
class node_flutter,node_mobileauth,node_mobiledashboard,node_mobiledb toneMint
class node_locale,node_smslogic,node_smshelper toneRose
class node_owner,node_smsgateway,node_firebase toneIndigo
```

## Components

### Web workflows

- [Web interface](https://github.com/aashutosh-k-das/sajilo_khata_mobile/blob/main/index.html): `index.html`
- [Workflow controller](https://github.com/aashutosh-k-das/sajilo_khata_mobile/blob/main/app.js): `app.js`
- [Inventory](https://github.com/aashutosh-k-das/sajilo_khata_mobile/blob/main/app.js): `app.js`
- [Customers](https://github.com/aashutosh-k-das/sajilo_khata_mobile/blob/main/app.js): `app.js`
- [Billing and VAT](https://github.com/aashutosh-k-das/sajilo_khata_mobile/blob/main/app.js): `app.js`
- [Credit ledger](https://github.com/aashutosh-k-das/sajilo_khata_mobile/blob/main/app.js): `app.js`
- [Sales dashboard](https://github.com/aashutosh-k-das/sajilo_khata_mobile/blob/main/app.js): `app.js`

### Local data

- **Browser localStorage**
- [Persistence and sync queue](https://github.com/aashutosh-k-das/sajilo_khata_mobile/blob/main/db.js): `db.js`
- [Sync simulation](https://github.com/aashutosh-k-das/sajilo_khata_mobile/blob/main/db.js): `db.js`

### Flutter app

- [Flutter application](https://github.com/aashutosh-k-das/sajilo_khata_mobile/blob/main/sajilo_khata_mobile/lib/main.dart): `sajilo_khata_mobile/lib/main.dart`
- [Mobile authentication](https://github.com/aashutosh-k-das/sajilo_khata_mobile/blob/main/sajilo_khata_mobile/lib/features/auth/login_screen.dart): `sajilo_khata_mobile/lib/features/auth/login_screen.dart`
- [Mobile dashboard](https://github.com/aashutosh-k-das/sajilo_khata_mobile/blob/main/sajilo_khata_mobile/lib/features/dashboard/dashboard_screen.dart): `sajilo_khata_mobile/lib/features/dashboard/dashboard_screen.dart`
- [Mobile database](https://github.com/aashutosh-k-das/sajilo_khata_mobile/blob/main/sajilo_khata_mobile/lib/core/database/database_helper.dart): `sajilo_khata_mobile/lib/core/database/database_helper.dart`

### Supporting services

- [Translations](https://github.com/aashutosh-k-das/sajilo_khata_mobile/blob/main/locales.js): `locales.js`
- [Reminder messaging](https://github.com/aashutosh-k-das/sajilo_khata_mobile/blob/main/app.js): `app.js`
- [SMS helper](https://github.com/aashutosh-k-das/sajilo_khata_mobile/blob/main/sparrow_sms.js): `sparrow_sms.js`

### Other components

- **Shopkeeper**
- **Sparrow SMS**
- **Firebase**

## Connections

- Shopkeeper → Web interface: uses
- Web interface → Workflow controller: dispatches actions
- Workflow controller → Inventory: handles
- Workflow controller → Customers: handles
- Workflow controller → Billing and VAT: handles
- Workflow controller → Credit ledger: handles
- Workflow controller → Sales dashboard: updates
- Workflow controller → Translations: loads translations
- Workflow controller → Persistence and sync queue: initializes and accesses
- Inventory → Persistence and sync queue: reads and writes
- Customers → Persistence and sync queue: reads and writes
- Billing and VAT → Persistence and sync queue: saves bills
- Credit ledger → Persistence and sync queue: records transactions
- Sales dashboard → Persistence and sync queue: reads summaries
- Persistence and sync queue → Browser localStorage: persists data
- Persistence and sync queue → Sync simulation: queues changes
- Workflow controller → Sync simulation: triggers sync
- Reminder messaging → SMS helper: generates and sends
- SMS helper → Sparrow SMS: simulates request
- Shopkeeper → Flutter application: uses
- Flutter application → Mobile authentication: entry flow
- Flutter application → Mobile dashboard: shows dashboard
- Flutter application → Mobile database: uses
- Mobile database → Firebase: syncs when online
