# acdeena1994/bill_desk architecture

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

- Interactive diagram: https://gitdiagram.com/acdeena1994/bill_desk
- Repository: https://github.com/acdeena1994/bill_desk

## Overview

Bill Desk is an offline-first pharmacy POS and statutory register app. The main workflow is medicine selection and cart editing, bill review, atomic checkout with stock deduction, then invoice retrieval or sharing. Separate branches cover inventory import/maintenance, sales analytics and exports, pharmacy settings and backup/restore, onboarding, and multilingual UI. Source excerpts establish core billing, persistence, and draft-recovery calls; README statements support documented capabilities whose implementation was not sampled.

Main entry points: [`src/navigation/RootNavigator.tsx`](https://github.com/acdeena1994/bill_desk/blob/main/src/navigation/RootNavigator.tsx) (Navigation), [`src/db/billQueries.ts`](https://github.com/acdeena1994/bill_desk/blob/main/src/db/billQueries.ts) (Bill queries), [`src/db/stockQueries.ts`](https://github.com/acdeena1994/bill_desk/blob/main/src/db/stockQueries.ts) (Stock queries), [`src/screens/Billing/BillingScreen.tsx`](https://github.com/acdeena1994/bill_desk/blob/main/src/screens/Billing/BillingScreen.tsx) (POS billing)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["App experience"]
  node_app["App bootstrap<br/>[App.tsx]"]
  node_navigation["Navigation<br/>[RootNavigator.tsx]"]
  node_onboarding["Onboarding"]
end

subgraph group_sales["Billing and registers"]
  node_billing["POS billing<br/>[BillingScreen.tsx]"]
  node_billing_state["Bill state<br/>[useBillingStore.ts]"]
  node_drafts["Draft recovery"]
  node_review["Bill review"]
  node_receipt["Invoice sharing<br/>[billingSharePdf.ts]"]
  node_share_text["Text receipt format"]
  node_bills["Bill queries<br/>[billQueries.ts]"]
  node_analytics["Sales analytics"]
  node_register_pdf["Register PDF export<br/>[pdfGenerator.ts]"]
  node_register_excel["Register Excel export<br/>[excelGenerator.ts]"]
end

subgraph group_inventory["Stock management"]
  node_stock_screen["Stock screen<br/>[StockScreen.tsx]"]
  node_stock_state["Stock state<br/>[useStockStore.ts]"]
  node_stock_queries["Stock queries<br/>[stockQueries.ts]"]
  node_catalog_import["Catalog import<br/>[excelParser.ts]"]
end

subgraph group_operations["Pharmacy operations"]
  node_settings["Pharmacy settings<br/>[SettingsScreen.tsx]"]
  node_settings_state["Settings state"]
  node_backup["Backup and restore<br/>[backupService.ts]"]
  node_language["Language support<br/>[i18n.ts]"]
  node_database[("Local SQLite<br/>[index.ts]")]
end

node_pharmacist(("Pharmacist"))

node_pharmacist -->|"opens"| node_app
node_app -->|"starts"| node_navigation
node_navigation -->|"routes"| node_onboarding
node_navigation -->|"routes"| node_billing
node_navigation -->|"routes"| node_analytics
node_navigation -->|"routes"| node_stock_screen
node_navigation -->|"routes"| node_settings
node_billing -->|"searches stock"| node_stock_queries
node_billing -->|"edits cart"| node_billing_state
node_billing_state -->|"creates bill"| node_bills
node_billing_state -->|"clears draft"| node_drafts
node_app -->|"checks recovery"| node_drafts
node_billing -->|"reviews bill"| node_review
node_review -->|"loads bill"| node_bills
node_review -->|"shares PDF"| node_receipt
node_review -->|"formats receipt"| node_share_text
node_bills -->|"deducts stock"| node_stock_queries
node_analytics -->|"reads sales"| node_bills
node_analytics -->|"exports register"| node_register_pdf
node_analytics -->|"exports workbook"| node_register_excel
node_stock_screen -->|"manages stock"| node_stock_state
node_stock_state -->|"updates inventory"| node_stock_queries
node_stock_screen -->|"parses imports"| node_catalog_import
node_catalog_import -.->|"bulk imports"| node_stock_queries
node_settings -->|"updates profile"| node_settings_state
node_settings -->|"manages backup"| node_backup
node_settings_state -->|"changes language"| node_language
node_settings_state -->|"loads settings"| node_database
node_backup -->|"backs up database"| node_database
node_bills -->|"queries SQLite"| node_database
node_stock_queries -->|"queries SQLite"| node_database

click node_app "https://github.com/acdeena1994/bill_desk/blob/main/App.tsx"
click node_navigation "https://github.com/acdeena1994/bill_desk/blob/main/src/navigation/RootNavigator.tsx"
click node_billing "https://github.com/acdeena1994/bill_desk/blob/main/src/screens/Billing/BillingScreen.tsx"
click node_billing_state "https://github.com/acdeena1994/bill_desk/blob/main/src/store/useBillingStore.ts"
click node_drafts "https://github.com/acdeena1994/bill_desk/blob/main/src/services/billingDraftService.ts"
click node_review "https://github.com/acdeena1994/bill_desk/blob/main/src/screens/Billing/BillPreviewScreen.tsx"
click node_receipt "https://github.com/acdeena1994/bill_desk/blob/main/src/screens/Billing/billingSharePdf.ts"
click node_share_text "https://github.com/acdeena1994/bill_desk/blob/main/src/screens/Billing/billingShareFormatter.ts"
click node_bills "https://github.com/acdeena1994/bill_desk/blob/main/src/db/billQueries.ts"
click node_analytics "https://github.com/acdeena1994/bill_desk/blob/main/src/screens/Analytics/AnalyticsScreen.tsx"
click node_register_pdf "https://github.com/acdeena1994/bill_desk/blob/main/src/utils/pdfGenerator.ts"
click node_register_excel "https://github.com/acdeena1994/bill_desk/blob/main/src/utils/excelGenerator.ts"
click node_stock_screen "https://github.com/acdeena1994/bill_desk/blob/main/src/screens/Stock/StockScreen.tsx"
click node_stock_state "https://github.com/acdeena1994/bill_desk/blob/main/src/store/useStockStore.ts"
click node_stock_queries "https://github.com/acdeena1994/bill_desk/blob/main/src/db/stockQueries.ts"
click node_catalog_import "https://github.com/acdeena1994/bill_desk/blob/main/src/utils/excelParser.ts"
click node_settings "https://github.com/acdeena1994/bill_desk/blob/main/src/screens/Settings/SettingsScreen.tsx"
click node_settings_state "https://github.com/acdeena1994/bill_desk/blob/main/src/store/useSettingsStore.ts"
click node_backup "https://github.com/acdeena1994/bill_desk/blob/main/src/services/backupService.ts"
click node_language "https://github.com/acdeena1994/bill_desk/blob/main/src/localization/i18n.ts"
click node_onboarding "https://github.com/acdeena1994/bill_desk/blob/main/src/screens/Onboarding/OnboardingScreen.tsx"
click node_database "https://github.com/acdeena1994/bill_desk/blob/main/src/db/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_app,node_navigation,node_onboarding toneBlue
class node_billing,node_billing_state,node_drafts,node_review,node_receipt,node_share_text,node_bills,node_analytics,node_register_pdf,node_register_excel toneAmber
class node_stock_screen,node_stock_state,node_stock_queries,node_catalog_import toneMint
class node_settings,node_settings_state,node_backup,node_language,node_database toneRose
class node_pharmacist toneIndigo
```

## Components

### App experience

- [App bootstrap](https://github.com/acdeena1994/bill_desk/blob/main/App.tsx): `App.tsx`
- [Navigation](https://github.com/acdeena1994/bill_desk/blob/main/src/navigation/RootNavigator.tsx): `src/navigation/RootNavigator.tsx`
- [Onboarding](https://github.com/acdeena1994/bill_desk/blob/main/src/screens/Onboarding/OnboardingScreen.tsx): `src/screens/Onboarding/OnboardingScreen.tsx`

### Billing and registers

- [POS billing](https://github.com/acdeena1994/bill_desk/blob/main/src/screens/Billing/BillingScreen.tsx): `src/screens/Billing/BillingScreen.tsx`
- [Bill state](https://github.com/acdeena1994/bill_desk/blob/main/src/store/useBillingStore.ts): `src/store/useBillingStore.ts`
- [Draft recovery](https://github.com/acdeena1994/bill_desk/blob/main/src/services/billingDraftService.ts): `src/services/billingDraftService.ts`
- [Bill review](https://github.com/acdeena1994/bill_desk/blob/main/src/screens/Billing/BillPreviewScreen.tsx): `src/screens/Billing/BillPreviewScreen.tsx`
- [Invoice sharing](https://github.com/acdeena1994/bill_desk/blob/main/src/screens/Billing/billingSharePdf.ts): `src/screens/Billing/billingSharePdf.ts`
- [Text receipt format](https://github.com/acdeena1994/bill_desk/blob/main/src/screens/Billing/billingShareFormatter.ts): `src/screens/Billing/billingShareFormatter.ts`
- [Bill queries](https://github.com/acdeena1994/bill_desk/blob/main/src/db/billQueries.ts): `src/db/billQueries.ts`
- [Sales analytics](https://github.com/acdeena1994/bill_desk/blob/main/src/screens/Analytics/AnalyticsScreen.tsx): `src/screens/Analytics/AnalyticsScreen.tsx`
- [Register PDF export](https://github.com/acdeena1994/bill_desk/blob/main/src/utils/pdfGenerator.ts): `src/utils/pdfGenerator.ts`
- [Register Excel export](https://github.com/acdeena1994/bill_desk/blob/main/src/utils/excelGenerator.ts): `src/utils/excelGenerator.ts`

### Stock management

- [Stock screen](https://github.com/acdeena1994/bill_desk/blob/main/src/screens/Stock/StockScreen.tsx): `src/screens/Stock/StockScreen.tsx`
- [Stock state](https://github.com/acdeena1994/bill_desk/blob/main/src/store/useStockStore.ts): `src/store/useStockStore.ts`
- [Stock queries](https://github.com/acdeena1994/bill_desk/blob/main/src/db/stockQueries.ts): `src/db/stockQueries.ts`
- [Catalog import](https://github.com/acdeena1994/bill_desk/blob/main/src/utils/excelParser.ts): `src/utils/excelParser.ts`

### Pharmacy operations

- [Pharmacy settings](https://github.com/acdeena1994/bill_desk/blob/main/src/screens/Settings/SettingsScreen.tsx): `src/screens/Settings/SettingsScreen.tsx`
- [Settings state](https://github.com/acdeena1994/bill_desk/blob/main/src/store/useSettingsStore.ts): `src/store/useSettingsStore.ts`
- [Backup and restore](https://github.com/acdeena1994/bill_desk/blob/main/src/services/backupService.ts): `src/services/backupService.ts`
- [Language support](https://github.com/acdeena1994/bill_desk/blob/main/src/localization/i18n.ts): `src/localization/i18n.ts`
- [Local SQLite](https://github.com/acdeena1994/bill_desk/blob/main/src/db/index.ts): `src/db/index.ts`

### Other components

- **Pharmacist**

## Connections

- Pharmacist → App bootstrap: opens (evidence: `README.md`)
- App bootstrap → Navigation: starts (evidence: `App.tsx`)
- Navigation → Onboarding: routes (evidence: `src/navigation/RootNavigator.tsx`)
- Navigation → POS billing: routes
- Navigation → Sales analytics: routes
- Navigation → Stock screen: routes
- Navigation → Pharmacy settings: routes
- POS billing → Stock queries: searches stock (evidence: `src/screens/Billing/BillingScreen.tsx`)
- POS billing → Bill state: edits cart (evidence: `src/screens/Billing/BillingScreen.tsx`)
- Bill state → Bill queries: creates bill (evidence: `src/store/useBillingStore.ts`)
- Bill state → Draft recovery: clears draft (evidence: `src/store/useBillingStore.ts`)
- App bootstrap → Draft recovery: checks recovery (evidence: `App.tsx`)
- POS billing → Bill review: reviews bill (evidence: `README.md`)
- Bill review → Bill queries: loads bill (evidence: `src/screens/Billing/BillPreviewScreen.tsx`)
- Bill review → Invoice sharing: shares PDF (evidence: `src/screens/Billing/BillPreviewScreen.tsx`)
- Bill review → Text receipt format: formats receipt (evidence: `README.md`)
- Bill queries → Stock queries: deducts stock (evidence: `src/db/billQueries.ts`)
- Sales analytics → Bill queries: reads sales (evidence: `README.md`)
- Sales analytics → Register PDF export: exports register (evidence: `README.md`)
- Sales analytics → Register Excel export: exports workbook (evidence: `README.md`)
- Stock screen → Stock state: manages stock (evidence: `src/screens/Stock/StockScreen.tsx`)
- Stock state → Stock queries: updates inventory (evidence: `src/store/useStockStore.ts`)
- Stock screen → Catalog import: parses imports (evidence: `src/screens/Stock/StockScreen.tsx`)
- Catalog import → Stock queries: bulk imports
- Pharmacy settings → Settings state: updates profile (evidence: `src/screens/Settings/SettingsScreen.tsx`)
- Pharmacy settings → Backup and restore: manages backup (evidence: `src/screens/Settings/SettingsScreen.tsx`)
- Settings state → Language support: changes language (evidence: `src/store/useSettingsStore.ts`)
- Settings state → Local SQLite: loads settings (evidence: `src/store/useSettingsStore.ts`)
- Backup and restore → Local SQLite: backs up database (evidence: `src/services/backupService.ts`)
- Bill queries → Local SQLite: queries SQLite (evidence: `src/db/billQueries.ts`)
- Stock queries → Local SQLite: queries SQLite (evidence: `src/db/stockQueries.ts`)
