# parama-2004/smart-billing-solution architecture

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

- Interactive diagram: https://gitdiagram.com/parama-2004/smart-billing-solution
- Repository: https://github.com/parama-2004/smart-billing-solution

## Overview

Billing Suite is a desktop billing application with a React operational UI, a .NET Minimal API, and a MySQL-backed data layer. Users authenticate, operate sales and purchasing workflows, manage master data and payments, then review reports and tally records; the API also supports maintenance tasks. The graph preserves documented product capabilities, while sampled source confirms selected route-to-service and service-to-data relationships. Several UI-to-API and desktop-host links are documented only at product level, so those are marked unverified.

Main entry points: [`billing-ui/src/App.tsx`](https://github.com/parama-2004/smart-billing-solution/blob/main/billing-ui/src/App.tsx) (UI routes), [`Billing.Api/Program.cs`](https://github.com/parama-2004/smart-billing-solution/blob/main/Billing.Api/Program.cs) (API startup), [`Billing.Api/Data/BillingDbContext.cs`](https://github.com/parama-2004/smart-billing-solution/blob/main/Billing.Api/Data/BillingDbContext.cs) (EF data context), [`Billing.Api/Services/PurchaseService.cs`](https://github.com/parama-2004/smart-billing-solution/blob/main/Billing.Api/Services/PurchaseService.cs) (Purchase processing)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_desktop["Desktop runtime"]
  node_electron["Electron host<br/>[main.js]"]
end

subgraph group_ui["Operations UI"]
  node_uiapp["UI routes<br/>[App.tsx]"]
  node_authui["Login and session<br/>[Login.tsx]"]
  node_salesui["Sales screens<br/>[CreateInvoice.tsx]"]
  node_purchaseui["Purchase screens<br/>[PurchaseEntry.tsx]"]
  node_mastersui["Master screens<br/>[ProductMaster.tsx]"]
  node_reportsui["Reports and tally<br/>[SalesReport.tsx]"]
  node_receipt["Receipt rendering<br/>[Receipt80mm.tsx]"]
end

subgraph group_transactions["Billing workflows"]
  node_invoice_routes["Invoice endpoints<br/>[InvoiceRoutes.cs]"]
  node_invoice_service["Invoice processing<br/>[InvoiceService.cs]"]
  node_purchase_routes["Purchase endpoints<br/>[PurchaseRoutes.cs]"]
  node_purchase_service["Purchase processing<br/>[PurchaseService.cs]"]
  node_payments["Payments and refunds<br/>[PaymentRoutes.cs]"]
end

subgraph group_backend["API and domain"]
  node_auth_routes["Authentication endpoints<br/>[AuthRoutes.cs]"]
  node_jwt["JWT generation<br/>[JwtService.cs]"]
  node_customer_service["Customer ledger<br/>[CustomerService.cs]"]
  node_sales_reports["Sales and VAT reports"]
  node_api_host["API startup<br/>[Program.cs]"]
  node_maintenance["Backup and reset"]
  node_masters_api["Product and master APIs<br/>[MasterRoutes.cs]"]
  node_daily_tally["Daily tally and cheques"]
end

subgraph group_data["Persistence"]
  node_dbcontext["EF data context"]
  node_mysql[("MySQL database")]
end

node_staff(("Staff user"))

node_staff -->|"uses"| node_uiapp
node_uiapp -->|"routes to"| node_authui
node_uiapp -->|"routes to"| node_salesui
node_uiapp -->|"routes to"| node_purchaseui
node_uiapp -->|"routes to"| node_mastersui
node_uiapp -->|"routes to"| node_reportsui
node_salesui -->|"previews bill"| node_receipt
node_electron -.->|"hosts"| node_uiapp
node_electron -.->|"starts packaged API"| node_api_host
node_uiapp -.->|"uses API"| node_api_host
node_api_host -->|"configures"| node_dbcontext
node_api_host -->|"configures MySQL"| node_mysql
node_invoice_routes -->|"calls"| node_invoice_service
node_invoice_service -->|"reads and writes"| node_dbcontext
node_purchase_routes -->|"calls"| node_purchase_service
node_purchase_service -->|"reads and writes"| node_dbcontext
node_purchase_service -->|"updates product stock"| node_purchase_service
node_customer_service -->|"queries ledger data"| node_dbcontext
node_sales_reports -->|"queries"| node_dbcontext
node_auth_routes -->|"generates token"| node_jwt
node_jwt -.->|"validates via configured auth"| node_api_host
node_mastersui -.->|"uses master services"| node_masters_api
node_salesui -.->|"uses transaction endpoints"| node_payments
node_reportsui -.->|"uses tally endpoints"| node_daily_tally
node_api_host -.->|"hosts maintenance routes"| node_maintenance

click node_electron "https://github.com/parama-2004/smart-billing-solution/blob/main/electron/main.js"
click node_uiapp "https://github.com/parama-2004/smart-billing-solution/blob/main/billing-ui/src/App.tsx"
click node_authui "https://github.com/parama-2004/smart-billing-solution/blob/main/billing-ui/src/pages/Login.tsx"
click node_salesui "https://github.com/parama-2004/smart-billing-solution/blob/main/billing-ui/src/pages/invoices/CreateInvoice.tsx"
click node_purchaseui "https://github.com/parama-2004/smart-billing-solution/blob/main/billing-ui/src/pages/Purchase/PurchaseEntry.tsx"
click node_mastersui "https://github.com/parama-2004/smart-billing-solution/blob/main/billing-ui/src/pages/products/ProductMaster.tsx"
click node_reportsui "https://github.com/parama-2004/smart-billing-solution/blob/main/billing-ui/src/pages/Reports/SalesReport.tsx"
click node_receipt "https://github.com/parama-2004/smart-billing-solution/blob/main/billing-ui/src/components/Receipt80mm.tsx"
click node_invoice_routes "https://github.com/parama-2004/smart-billing-solution/blob/main/Billing.Api/Routes/InvoiceRoutes.cs"
click node_invoice_service "https://github.com/parama-2004/smart-billing-solution/blob/main/Billing.Api/Services/InvoiceService.cs"
click node_purchase_routes "https://github.com/parama-2004/smart-billing-solution/blob/main/Billing.Api/Routes/PurchaseRoutes.cs"
click node_purchase_service "https://github.com/parama-2004/smart-billing-solution/blob/main/Billing.Api/Services/PurchaseService.cs"
click node_auth_routes "https://github.com/parama-2004/smart-billing-solution/blob/main/Billing.Api/Routes/AuthRoutes.cs"
click node_jwt "https://github.com/parama-2004/smart-billing-solution/blob/main/Billing.Api/Security/JwtService.cs"
click node_customer_service "https://github.com/parama-2004/smart-billing-solution/blob/main/Billing.Api/Services/CustomerService.cs"
click node_sales_reports "https://github.com/parama-2004/smart-billing-solution/blob/main/Billing.Api/Services/SalesReportService.cs"
click node_api_host "https://github.com/parama-2004/smart-billing-solution/blob/main/Billing.Api/Program.cs"
click node_dbcontext "https://github.com/parama-2004/smart-billing-solution/blob/main/Billing.Api/Data/BillingDbContext.cs"
click node_maintenance "https://github.com/parama-2004/smart-billing-solution/blob/main/Billing.Api/Routes/MaintenanceRoutes.cs"
click node_payments "https://github.com/parama-2004/smart-billing-solution/blob/main/Billing.Api/Routes/PaymentRoutes.cs"
click node_masters_api "https://github.com/parama-2004/smart-billing-solution/blob/main/Billing.Api/Routes/MasterRoutes.cs"
click node_daily_tally "https://github.com/parama-2004/smart-billing-solution/blob/main/Billing.Api/Routes/DailyTallyRoutes.cs"

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_electron,node_staff toneBlue
class node_uiapp,node_authui,node_salesui,node_purchaseui,node_mastersui,node_reportsui,node_receipt toneAmber
class node_invoice_routes,node_invoice_service,node_purchase_routes,node_purchase_service,node_payments toneMint
class node_auth_routes,node_jwt,node_customer_service,node_sales_reports,node_api_host,node_maintenance,node_masters_api,node_daily_tally toneRose
class node_dbcontext,node_mysql toneIndigo
```

## Components

### Desktop runtime

- [Electron host](https://github.com/parama-2004/smart-billing-solution/blob/main/electron/main.js): `electron/main.js`

### Operations UI

- [UI routes](https://github.com/parama-2004/smart-billing-solution/blob/main/billing-ui/src/App.tsx): `billing-ui/src/App.tsx`
- [Login and session](https://github.com/parama-2004/smart-billing-solution/blob/main/billing-ui/src/pages/Login.tsx): `billing-ui/src/pages/Login.tsx`
- [Sales screens](https://github.com/parama-2004/smart-billing-solution/blob/main/billing-ui/src/pages/invoices/CreateInvoice.tsx): `billing-ui/src/pages/invoices/CreateInvoice.tsx`
- [Purchase screens](https://github.com/parama-2004/smart-billing-solution/blob/main/billing-ui/src/pages/Purchase/PurchaseEntry.tsx): `billing-ui/src/pages/Purchase/PurchaseEntry.tsx`
- [Master screens](https://github.com/parama-2004/smart-billing-solution/blob/main/billing-ui/src/pages/products/ProductMaster.tsx): `billing-ui/src/pages/products/ProductMaster.tsx`
- [Reports and tally](https://github.com/parama-2004/smart-billing-solution/blob/main/billing-ui/src/pages/Reports/SalesReport.tsx): `billing-ui/src/pages/Reports/SalesReport.tsx`
- [Receipt rendering](https://github.com/parama-2004/smart-billing-solution/blob/main/billing-ui/src/components/Receipt80mm.tsx): `billing-ui/src/components/Receipt80mm.tsx`

### Billing workflows

- [Invoice endpoints](https://github.com/parama-2004/smart-billing-solution/blob/main/Billing.Api/Routes/InvoiceRoutes.cs): `Billing.Api/Routes/InvoiceRoutes.cs`
- [Invoice processing](https://github.com/parama-2004/smart-billing-solution/blob/main/Billing.Api/Services/InvoiceService.cs): `Billing.Api/Services/InvoiceService.cs`
- [Purchase endpoints](https://github.com/parama-2004/smart-billing-solution/blob/main/Billing.Api/Routes/PurchaseRoutes.cs): `Billing.Api/Routes/PurchaseRoutes.cs`
- [Purchase processing](https://github.com/parama-2004/smart-billing-solution/blob/main/Billing.Api/Services/PurchaseService.cs): `Billing.Api/Services/PurchaseService.cs`
- [Payments and refunds](https://github.com/parama-2004/smart-billing-solution/blob/main/Billing.Api/Routes/PaymentRoutes.cs): `Billing.Api/Routes/PaymentRoutes.cs`

### API and domain

- [Authentication endpoints](https://github.com/parama-2004/smart-billing-solution/blob/main/Billing.Api/Routes/AuthRoutes.cs): `Billing.Api/Routes/AuthRoutes.cs`
- [JWT generation](https://github.com/parama-2004/smart-billing-solution/blob/main/Billing.Api/Security/JwtService.cs): `Billing.Api/Security/JwtService.cs`
- [Customer ledger](https://github.com/parama-2004/smart-billing-solution/blob/main/Billing.Api/Services/CustomerService.cs): `Billing.Api/Services/CustomerService.cs`
- [Sales and VAT reports](https://github.com/parama-2004/smart-billing-solution/blob/main/Billing.Api/Services/SalesReportService.cs): `Billing.Api/Services/SalesReportService.cs`
- [API startup](https://github.com/parama-2004/smart-billing-solution/blob/main/Billing.Api/Program.cs): `Billing.Api/Program.cs`
- [Backup and reset](https://github.com/parama-2004/smart-billing-solution/blob/main/Billing.Api/Routes/MaintenanceRoutes.cs): `Billing.Api/Routes/MaintenanceRoutes.cs`
- [Product and master APIs](https://github.com/parama-2004/smart-billing-solution/blob/main/Billing.Api/Routes/MasterRoutes.cs): `Billing.Api/Routes/MasterRoutes.cs`
- [Daily tally and cheques](https://github.com/parama-2004/smart-billing-solution/blob/main/Billing.Api/Routes/DailyTallyRoutes.cs): `Billing.Api/Routes/DailyTallyRoutes.cs`

### Persistence

- [EF data context](https://github.com/parama-2004/smart-billing-solution/blob/main/Billing.Api/Data/BillingDbContext.cs): `Billing.Api/Data/BillingDbContext.cs`
- **MySQL database**

### Other components

- **Staff user**

## Connections

- Staff user → UI routes: uses
- UI routes → Login and session: routes to (evidence: `billing-ui/src/App.tsx`)
- UI routes → Sales screens: routes to (evidence: `billing-ui/src/App.tsx`)
- UI routes → Purchase screens: routes to (evidence: `billing-ui/src/App.tsx`)
- UI routes → Master screens: routes to (evidence: `billing-ui/src/App.tsx`)
- UI routes → Reports and tally: routes to (evidence: `billing-ui/src/App.tsx`)
- Sales screens → Receipt rendering: previews bill
- Electron host → UI routes: hosts
- Electron host → API startup: starts packaged API
- UI routes → API startup: uses API
- API startup → EF data context: configures (evidence: `Billing.Api/Program.cs`)
- API startup → MySQL database: configures MySQL (evidence: `Billing.Api/Program.cs`)
- Invoice endpoints → Invoice processing: calls (evidence: `Billing.Api/Routes/InvoiceRoutes.cs`)
- Invoice processing → EF data context: reads and writes (evidence: `Billing.Api/Services/InvoiceService.cs`)
- Purchase endpoints → Purchase processing: calls (evidence: `Billing.Api/Routes/PurchaseRoutes.cs`)
- Purchase processing → EF data context: reads and writes (evidence: `Billing.Api/Services/PurchaseService.cs`)
- Purchase processing → Purchase processing: updates product stock (evidence: `Billing.Api/Services/PurchaseService.cs`)
- Customer ledger → EF data context: queries ledger data (evidence: `Billing.Api/Services/CustomerService.cs`)
- Sales and VAT reports → EF data context: queries (evidence: `Billing.Api/Services/SalesReportService.cs`)
- Authentication endpoints → JWT generation: generates token (evidence: `Billing.Api/Routes/AuthRoutes.cs`)
- JWT generation → API startup: validates via configured auth
- Master screens → Product and master APIs: uses master services
- Sales screens → Payments and refunds: uses transaction endpoints
- Reports and tally → Daily tally and cheques: uses tally endpoints
- API startup → Backup and reset: hosts maintenance routes
