# miladraza123/accounting-system architecture

> Architecture diagram of the GitHub repository miladraza123/accounting-system, 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/miladraza123/accounting-system
- Repository: https://github.com/miladraza123/accounting-system

## Overview

OHT is a browser-based accounting application with billing, daily-ledger, and master-data pages, backed by Supabase. Its separate scheduled backup job fetches accounting data, produces Excel and restore-file attachments, and emails them. The service worker caches static application files while leaving API requests on the network. The README is empty and most page and SQL sources were not sampled, so UI-to-database wiring and quotation behavior are shown only where supported by the tree or excerpts.

Main entry points: [`backup-job/backup.js`](https://github.com/miladraza123/accounting-system/blob/main/backup-job/backup.js) (Backup runner), [`sw.js`](https://github.com/miladraza123/accounting-system/blob/main/sw.js) (Service worker), [`index.html`](https://github.com/miladraza123/accounting-system/blob/main/index.html) (App entry), [`.github/workflows/daily-backup.yml`](https://github.com/miladraza123/accounting-system/blob/main/.github/workflows/daily-backup.yml) (Scheduled workflow)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Accounting app"]
  node_index["App entry<br/>[index.html]"]
  node_masters["Master data<br/>[masters.html]"]
  node_billing["Billing<br/>[billing.html]"]
  node_ledger["Daily ledger<br/>[daily-ledger.html]"]
  node_quotations["Service quotations"]
end

subgraph group_offline["Offline shell"]
  node_sw["Service worker<br/>[sw.js]"]
  node_shell["Static shell files"]
  node_browsercache[("Browser cache")]
end

subgraph group_backup["Daily backup"]
  node_schedule["Scheduled workflow<br/>[daily-backup.yml]"]
  node_backupjob["Backup runner<br/>[backup.js]"]
  node_tables[("Accounting tables")]
  node_excel["Excel workbook"]
  node_restore["Restore package"]
end

subgraph group_integrations["External services"]
  node_supabase[("Supabase")]
  node_mailer["Email delivery"]
end

node_user(("Accounting user"))
node_recipient(("Backup recipient"))

node_user -->|"opens app"| node_index
node_user -->|"manages data"| node_masters
node_user -->|"creates bills"| node_billing
node_user -->|"views ledger"| node_ledger
node_index -->|"registers worker"| node_sw
node_sw -->|"caches static files"| node_shell
node_sw -->|"reads and writes"| node_browsercache
node_sw -->|"leaves API uncached"| node_supabase
node_schedule -->|"runs daily"| node_backupjob
node_backupjob -->|"signs in and fetches"| node_supabase
node_supabase -->|"returns table data"| node_tables
node_backupjob -->|"builds workbook"| node_excel
node_backupjob -->|"builds restore data"| node_restore
node_backupjob -->|"sends attachments"| node_mailer
node_mailer -->|"delivers email"| node_recipient

click node_index "https://github.com/miladraza123/accounting-system/blob/main/index.html"
click node_masters "https://github.com/miladraza123/accounting-system/blob/main/masters.html"
click node_billing "https://github.com/miladraza123/accounting-system/blob/main/billing.html"
click node_ledger "https://github.com/miladraza123/accounting-system/blob/main/daily-ledger.html"
click node_quotations "https://github.com/miladraza123/accounting-system/blob/main/service-quotations.sql"
click node_sw "https://github.com/miladraza123/accounting-system/blob/main/sw.js"
click node_schedule "https://github.com/miladraza123/accounting-system/blob/main/.github/workflows/daily-backup.yml"
click node_backupjob "https://github.com/miladraza123/accounting-system/blob/main/backup-job/backup.js"

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_index,node_masters,node_billing,node_ledger,node_quotations,node_user toneBlue
class node_sw,node_shell,node_browsercache toneAmber
class node_schedule,node_backupjob,node_tables,node_excel,node_restore toneMint
class node_supabase,node_mailer toneRose
class node_recipient toneIndigo
```

## Components

### Accounting app

- [App entry](https://github.com/miladraza123/accounting-system/blob/main/index.html): `index.html`
- [Master data](https://github.com/miladraza123/accounting-system/blob/main/masters.html): `masters.html`
- [Billing](https://github.com/miladraza123/accounting-system/blob/main/billing.html): `billing.html`
- [Daily ledger](https://github.com/miladraza123/accounting-system/blob/main/daily-ledger.html): `daily-ledger.html`
- [Service quotations](https://github.com/miladraza123/accounting-system/blob/main/service-quotations.sql): `service-quotations.sql`

### Offline shell

- [Service worker](https://github.com/miladraza123/accounting-system/blob/main/sw.js): `sw.js`
- **Static shell files**
- **Browser cache**

### Daily backup

- [Scheduled workflow](https://github.com/miladraza123/accounting-system/blob/main/.github/workflows/daily-backup.yml): `.github/workflows/daily-backup.yml`
- [Backup runner](https://github.com/miladraza123/accounting-system/blob/main/backup-job/backup.js): `backup-job/backup.js`
- **Accounting tables**
- **Excel workbook**
- **Restore package**

### External services

- **Supabase**
- **Email delivery**

### Other components

- **Accounting user**
- **Backup recipient**

## Connections

- Accounting user → App entry: opens app
- Accounting user → Master data: manages data
- Accounting user → Billing: creates bills
- Accounting user → Daily ledger: views ledger
- App entry → Service worker: registers worker
- Service worker → Static shell files: caches static files
- Service worker → Browser cache: reads and writes
- Service worker → Supabase: leaves API uncached
- Scheduled workflow → Backup runner: runs daily
- Backup runner → Supabase: signs in and fetches
- Supabase → Accounting tables: returns table data
- Backup runner → Excel workbook: builds workbook
- Backup runner → Restore package: builds restore data
- Backup runner → Email delivery: sends attachments
- Email delivery → Backup recipient: delivers email
