# sayemr0018/dokanbhai__dbmslab architecture

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

- Interactive diagram: https://gitdiagram.com/sayemr0018/dokanbhai__dbmslab
- Repository: https://github.com/sayemr0018/dokanbhai__dbmslab

## Overview

DokanBhai is a bilingual shop ledger and POS for Bangladeshi retailers, with a separate platform-admin area. A shop owner registers or signs in by mobile number, manages shop-specific catalog and contacts, then records sales and payments; the dashboard and hisab ledger surface sales, stock, and dues. Supabase is used when configured, with a device-local copy only when it is not. The tree and excerpts establish the app entry points and some auth/data behavior; several screen-to-data calls and admin internals were not sampled, so uncertain links are omitted.

Main entry points: [`src/App.jsx`](https://github.com/sayemr0018/dokanbhai__dbmslab/blob/main/src/App.jsx) (App router), [`src/context/AuthContext.jsx`](https://github.com/sayemr0018/dokanbhai__dbmslab/blob/main/src/context/AuthContext.jsx) (Shop and admin auth), [`src/lib/data.js`](https://github.com/sayemr0018/dokanbhai__dbmslab/blob/main/src/lib/data.js) (Shop data access), [`src/lib/supabaseClient.js`](https://github.com/sayemr0018/dokanbhai__dbmslab/blob/main/src/lib/supabaseClient.js) (Supabase service)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_shop_access["Shop Access"]
  node_app["App router<br/>[App.jsx]"]
  node_landing["Home and tour<br/>[LandingPage.jsx]"]
  node_registration["Shop registration<br/>[RegisterPage.jsx]"]
  node_phone_login["Phone login"]
  node_auth["Shop and admin auth<br/>[AuthContext.jsx]"]
end

subgraph group_shop_operations["Shop Operations"]
  node_dashboard["Dashboard and import"]
  node_catalog["Products and stock"]
  node_categories["Categories"]
  node_vendors["Suppliers<br/>[VendorsScreen.jsx]"]
  node_pos["POS checkout<br/>[NewSaleScreen.jsx]"]
  node_sales["Sales history<br/>[SalesScreen.jsx]"]
  node_customers["Customers"]
  node_ledger["Due ledger<br/>[HisabScreen.jsx]"]
end

subgraph group_data_services["Data Services"]
  node_importer["Ledger import<br/>[ledgerImport.js]"]
  node_reminders["Payment reminders<br/>[reminders.js]"]
  node_profile["Shop profile<br/>[dokanProfile.js]"]
  node_data_api["Shop data access<br/>[data.js]"]
  node_local_store[("Local store<br/>[localDb.js]")]
end

subgraph group_platform_admin["Platform Admin"]
  node_admin_login["Admin login<br/>[AdminLogin.jsx]"]
  node_admin_dashboard["Admin overview<br/>[AdminDashboard.jsx]"]
  node_admin_api["Admin data access<br/>[adminApi.js]"]
  node_admin_shops["Shop administration<br/>[AdminShops.jsx]"]
  node_admin_products["Product administration<br/>[AdminProducts.jsx]"]
  node_admin_reports["Admin reports<br/>[AdminReports.jsx]"]
end

node_shop_owner(("Shop owner"))
node_supabase[("Supabase service<br/>[supabaseClient.js]")]
node_external_db[("Supabase database")]
node_message_services["WhatsApp or SMS"]

node_shop_owner -->|"opens app"| node_app
node_app -->|"routes home"| node_landing
node_app -->|"routes register"| node_registration
node_app -->|"routes login"| node_phone_login
node_app -->|"routes shop"| node_dashboard
node_app -->|"routes shop"| node_catalog
node_app -->|"routes shop"| node_categories
node_app -->|"routes shop"| node_vendors
node_app -->|"routes shop"| node_pos
node_app -->|"routes shop"| node_sales
node_app -->|"routes shop"| node_customers
node_app -->|"routes shop"| node_ledger
node_app -->|"routes admin"| node_admin_login
node_app -->|"routes admin"| node_admin_dashboard
node_app -->|"routes admin"| node_admin_shops
node_app -->|"routes admin"| node_admin_products
node_app -->|"routes admin"| node_admin_reports
node_registration -->|"registers shop"| node_auth
node_phone_login -->|"checks phone"| node_auth
node_auth -->|"loads shop profile"| node_profile
node_auth -->|"sets shop scope"| node_data_api
node_auth -.->|"syncs profile"| node_supabase
node_dashboard -->|"imports ledger"| node_importer
node_pos -->|"creates sale"| node_data_api
node_ledger -->|"records payment"| node_data_api
node_ledger -->|"prepares reminder"| node_reminders
node_reminders -.->|"opens message channel"| node_message_services
node_data_api -.->|"uses offline store"| node_local_store
node_data_api -.->|"uses configured service"| node_supabase
node_supabase -->|"reads and writes"| node_external_db
node_admin_dashboard -->|"loads overview"| node_admin_api
node_admin_api -.->|"requests admin data"| node_supabase

click node_app "https://github.com/sayemr0018/dokanbhai__dbmslab/blob/main/src/App.jsx"
click node_landing "https://github.com/sayemr0018/dokanbhai__dbmslab/blob/main/src/pages/LandingPage.jsx"
click node_registration "https://github.com/sayemr0018/dokanbhai__dbmslab/blob/main/src/pages/RegisterPage.jsx"
click node_phone_login "https://github.com/sayemr0018/dokanbhai__dbmslab/blob/main/src/components/PhoneGateScreen.jsx"
click node_auth "https://github.com/sayemr0018/dokanbhai__dbmslab/blob/main/src/context/AuthContext.jsx"
click node_dashboard "https://github.com/sayemr0018/dokanbhai__dbmslab/blob/main/src/pages/DashboardScreen.jsx"
click node_catalog "https://github.com/sayemr0018/dokanbhai__dbmslab/blob/main/src/pages/InventoryScreen.jsx"
click node_categories "https://github.com/sayemr0018/dokanbhai__dbmslab/blob/main/src/pages/CategoriesScreen.jsx"
click node_vendors "https://github.com/sayemr0018/dokanbhai__dbmslab/blob/main/src/pages/VendorsScreen.jsx"
click node_pos "https://github.com/sayemr0018/dokanbhai__dbmslab/blob/main/src/pages/NewSaleScreen.jsx"
click node_sales "https://github.com/sayemr0018/dokanbhai__dbmslab/blob/main/src/pages/SalesScreen.jsx"
click node_customers "https://github.com/sayemr0018/dokanbhai__dbmslab/blob/main/src/pages/CustomersScreen.jsx"
click node_ledger "https://github.com/sayemr0018/dokanbhai__dbmslab/blob/main/src/pages/HisabScreen.jsx"
click node_importer "https://github.com/sayemr0018/dokanbhai__dbmslab/blob/main/src/lib/ledgerImport.js"
click node_reminders "https://github.com/sayemr0018/dokanbhai__dbmslab/blob/main/src/lib/reminders.js"
click node_profile "https://github.com/sayemr0018/dokanbhai__dbmslab/blob/main/src/lib/dokanProfile.js"
click node_data_api "https://github.com/sayemr0018/dokanbhai__dbmslab/blob/main/src/lib/data.js"
click node_local_store "https://github.com/sayemr0018/dokanbhai__dbmslab/blob/main/src/lib/localDb.js"
click node_supabase "https://github.com/sayemr0018/dokanbhai__dbmslab/blob/main/src/lib/supabaseClient.js"
click node_admin_login "https://github.com/sayemr0018/dokanbhai__dbmslab/blob/main/src/pages/admin/AdminLogin.jsx"
click node_admin_dashboard "https://github.com/sayemr0018/dokanbhai__dbmslab/blob/main/src/pages/admin/AdminDashboard.jsx"
click node_admin_api "https://github.com/sayemr0018/dokanbhai__dbmslab/blob/main/src/lib/adminApi.js"
click node_admin_shops "https://github.com/sayemr0018/dokanbhai__dbmslab/blob/main/src/pages/admin/AdminShops.jsx"
click node_admin_products "https://github.com/sayemr0018/dokanbhai__dbmslab/blob/main/src/pages/admin/AdminProducts.jsx"
click node_admin_reports "https://github.com/sayemr0018/dokanbhai__dbmslab/blob/main/src/pages/admin/AdminReports.jsx"

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_landing,node_registration,node_phone_login,node_auth toneBlue
class node_dashboard,node_catalog,node_categories,node_vendors,node_pos,node_sales,node_customers,node_ledger,node_supabase,node_external_db toneAmber
class node_importer,node_reminders,node_profile,node_data_api,node_local_store toneMint
class node_admin_login,node_admin_dashboard,node_admin_api,node_admin_shops,node_admin_products,node_admin_reports toneRose
class node_shop_owner,node_message_services toneIndigo
```

## Components

### Shop Access

- [App router](https://github.com/sayemr0018/dokanbhai__dbmslab/blob/main/src/App.jsx): `src/App.jsx`
- [Home and tour](https://github.com/sayemr0018/dokanbhai__dbmslab/blob/main/src/pages/LandingPage.jsx): `src/pages/LandingPage.jsx`
- [Shop registration](https://github.com/sayemr0018/dokanbhai__dbmslab/blob/main/src/pages/RegisterPage.jsx): `src/pages/RegisterPage.jsx`
- [Phone login](https://github.com/sayemr0018/dokanbhai__dbmslab/blob/main/src/components/PhoneGateScreen.jsx): `src/components/PhoneGateScreen.jsx`
- [Shop and admin auth](https://github.com/sayemr0018/dokanbhai__dbmslab/blob/main/src/context/AuthContext.jsx): `src/context/AuthContext.jsx`

### Shop Operations

- [Dashboard and import](https://github.com/sayemr0018/dokanbhai__dbmslab/blob/main/src/pages/DashboardScreen.jsx): `src/pages/DashboardScreen.jsx`
- [Products and stock](https://github.com/sayemr0018/dokanbhai__dbmslab/blob/main/src/pages/InventoryScreen.jsx): `src/pages/InventoryScreen.jsx`
- [Categories](https://github.com/sayemr0018/dokanbhai__dbmslab/blob/main/src/pages/CategoriesScreen.jsx): `src/pages/CategoriesScreen.jsx`
- [Suppliers](https://github.com/sayemr0018/dokanbhai__dbmslab/blob/main/src/pages/VendorsScreen.jsx): `src/pages/VendorsScreen.jsx`
- [POS checkout](https://github.com/sayemr0018/dokanbhai__dbmslab/blob/main/src/pages/NewSaleScreen.jsx): `src/pages/NewSaleScreen.jsx`
- [Sales history](https://github.com/sayemr0018/dokanbhai__dbmslab/blob/main/src/pages/SalesScreen.jsx): `src/pages/SalesScreen.jsx`
- [Customers](https://github.com/sayemr0018/dokanbhai__dbmslab/blob/main/src/pages/CustomersScreen.jsx): `src/pages/CustomersScreen.jsx`
- [Due ledger](https://github.com/sayemr0018/dokanbhai__dbmslab/blob/main/src/pages/HisabScreen.jsx): `src/pages/HisabScreen.jsx`

### Data Services

- [Ledger import](https://github.com/sayemr0018/dokanbhai__dbmslab/blob/main/src/lib/ledgerImport.js): `src/lib/ledgerImport.js`
- [Payment reminders](https://github.com/sayemr0018/dokanbhai__dbmslab/blob/main/src/lib/reminders.js): `src/lib/reminders.js`
- [Shop profile](https://github.com/sayemr0018/dokanbhai__dbmslab/blob/main/src/lib/dokanProfile.js): `src/lib/dokanProfile.js`
- [Shop data access](https://github.com/sayemr0018/dokanbhai__dbmslab/blob/main/src/lib/data.js): `src/lib/data.js`
- [Local store](https://github.com/sayemr0018/dokanbhai__dbmslab/blob/main/src/lib/localDb.js): `src/lib/localDb.js`

### Platform Admin

- [Admin login](https://github.com/sayemr0018/dokanbhai__dbmslab/blob/main/src/pages/admin/AdminLogin.jsx): `src/pages/admin/AdminLogin.jsx`
- [Admin overview](https://github.com/sayemr0018/dokanbhai__dbmslab/blob/main/src/pages/admin/AdminDashboard.jsx): `src/pages/admin/AdminDashboard.jsx`
- [Admin data access](https://github.com/sayemr0018/dokanbhai__dbmslab/blob/main/src/lib/adminApi.js): `src/lib/adminApi.js`
- [Shop administration](https://github.com/sayemr0018/dokanbhai__dbmslab/blob/main/src/pages/admin/AdminShops.jsx): `src/pages/admin/AdminShops.jsx`
- [Product administration](https://github.com/sayemr0018/dokanbhai__dbmslab/blob/main/src/pages/admin/AdminProducts.jsx): `src/pages/admin/AdminProducts.jsx`
- [Admin reports](https://github.com/sayemr0018/dokanbhai__dbmslab/blob/main/src/pages/admin/AdminReports.jsx): `src/pages/admin/AdminReports.jsx`

### Other components

- **Shop owner**
- [Supabase service](https://github.com/sayemr0018/dokanbhai__dbmslab/blob/main/src/lib/supabaseClient.js): `src/lib/supabaseClient.js`
- **Supabase database**
- **WhatsApp or SMS**

## Connections

- Shop owner → App router: opens app
- App router → Home and tour: routes home
- App router → Shop registration: routes register
- App router → Phone login: routes login
- App router → Dashboard and import: routes shop
- App router → Products and stock: routes shop
- App router → Categories: routes shop
- App router → Suppliers: routes shop
- App router → POS checkout: routes shop
- App router → Sales history: routes shop
- App router → Customers: routes shop
- App router → Due ledger: routes shop
- App router → Admin login: routes admin
- App router → Admin overview: routes admin
- App router → Shop administration: routes admin
- App router → Product administration: routes admin
- App router → Admin reports: routes admin
- Shop registration → Shop and admin auth: registers shop
- Phone login → Shop and admin auth: checks phone
- Shop and admin auth → Shop profile: loads shop profile
- Shop and admin auth → Shop data access: sets shop scope
- Shop and admin auth → Supabase service: syncs profile
- Dashboard and import → Ledger import: imports ledger
- POS checkout → Shop data access: creates sale
- Due ledger → Shop data access: records payment
- Due ledger → Payment reminders: prepares reminder
- Payment reminders → WhatsApp or SMS: opens message channel
- Shop data access → Local store: uses offline store
- Shop data access → Supabase service: uses configured service
- Supabase service → Supabase database: reads and writes
- Admin overview → Admin data access: loads overview
- Admin data access → Supabase service: requests admin data
