# supernovasunrise/relational-database architecture

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

- Interactive diagram: https://gitdiagram.com/supernovasunrise/relational-database
- Repository: https://github.com/supernovasunrise/relational-database

## Overview

Mendure DME is an offline Electron desktop application for managing durable-medical-equipment customers, inventory, checkouts and reporting. An operator uses the renderer to sign in, maintain customer and equipment records, check equipment out under a 120-day agreement, and later record returns or review reports. The main process exposes those capabilities through a restricted preload IPC bridge and persists application data in per-user SQLite. The feature list and IPC contract document several areas whose implementation excerpts were not supplied; those branches are represented at their documented module paths without inferring internal call sequences.

Main entry points: [`src/main/ipc.js`](https://github.com/supernovasunrise/relational-database/blob/main/src/main/ipc.js) (IPC handlers), [`src/main/db.js`](https://github.com/supernovasunrise/relational-database/blob/main/src/main/db.js) (SQLite database), [`src/main/features/import-export.js`](https://github.com/supernovasunrise/relational-database/blob/main/src/main/features/import-export.js) (Import and export), [`src/main/main.js`](https://github.com/supernovasunrise/relational-database/blob/main/src/main/main.js) (Electron window)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_desktop["Desktop runtime"]
  node_electron["Electron window<br/>[main.js]"]
  node_renderer["App navigation<br/>[app.js]"]
  node_views["Workflow views"]
  node_preload["DME bridge<br/>[index.js]"]
  node_ipc["IPC handlers<br/>[ipc.js]"]
  node_contract["IPC contract<br/>[ipc-contract.js]"]
end

subgraph group_workflow["Checkout workflow"]
  node_logic["Business rules<br/>[business-logic.js]"]
  node_loans["Loans and returns<br/>[loans.js]"]
  node_agreements["Checkout agreements<br/>[agreements.js]"]
  node_printing["Printing<br/>[print.js]"]
end

subgraph group_operations["Records and reporting"]
  node_customers["Customer records<br/>[customers.js]"]
  node_equipment["Equipment inventory<br/>[equipment.js]"]
  node_reports["Reports and analytics<br/>[reports.js]"]
  node_importexport["Import and export<br/>[import-export.js]"]
end

subgraph group_security["Access and storage"]
  node_authview["Login view<br/>[auth.js]"]
  node_auth["Authentication<br/>[auth.js]"]
  node_database[("SQLite database<br/>[db.js]")]
end

node_operator(("Program operator"))
node_filedialog["Local file dialog"]
node_workbook["Excel workbook support"]

node_operator -->|"uses"| node_renderer
node_electron -->|"initializes"| node_database
node_electron -->|"registers handlers"| node_ipc
node_electron -->|"loads window"| node_renderer
node_renderer -->|"routes to"| node_views
node_renderer -->|"requests status"| node_preload
node_views -->|"invokes bridge"| node_preload
node_preload -->|"sends IPC"| node_ipc
node_ipc -->|"checks channels"| node_contract
node_ipc -->|"dispatches auth"| node_auth
node_ipc -->|"dispatches customer"| node_customers
node_ipc -->|"dispatches equipment"| node_equipment
node_ipc -->|"dispatches loans"| node_loans
node_ipc -->|"dispatches agreements"| node_agreements
node_ipc -->|"dispatches reports"| node_reports
node_ipc -->|"dispatches transfers"| node_importexport
node_ipc -->|"dispatches print"| node_printing
node_authview -->|"submits credentials"| node_preload
node_auth -->|"reads and writes users"| node_database
node_customers -->|"reads and writes"| node_database
node_equipment -->|"reads and writes"| node_database
node_loans -->|"reads and writes"| node_database
node_agreements -->|"reads and writes"| node_database
node_reports -->|"queries records"| node_database
node_importexport -->|"transfers records"| node_database
node_equipment -->|"uses validation"| node_logic
node_loans -->|"uses date rules"| node_logic
node_importexport -->|"uses normalization"| node_logic
node_importexport -->|"chooses files"| node_filedialog
node_importexport -->|"reads and writes"| node_workbook
node_printing -->|"prints document"| node_electron

click node_electron "https://github.com/supernovasunrise/relational-database/blob/main/src/main/main.js"
click node_renderer "https://github.com/supernovasunrise/relational-database/blob/main/src/renderer/js/app.js"
click node_views "https://github.com/supernovasunrise/relational-database/tree/main/src/renderer/js/views"
click node_preload "https://github.com/supernovasunrise/relational-database/blob/main/src/preload/index.js"
click node_ipc "https://github.com/supernovasunrise/relational-database/blob/main/src/main/ipc.js"
click node_contract "https://github.com/supernovasunrise/relational-database/blob/main/src/shared/ipc-contract.js"
click node_authview "https://github.com/supernovasunrise/relational-database/blob/main/src/renderer/js/views/auth.js"
click node_auth "https://github.com/supernovasunrise/relational-database/blob/main/src/main/auth.js"
click node_database "https://github.com/supernovasunrise/relational-database/blob/main/src/main/db.js"
click node_logic "https://github.com/supernovasunrise/relational-database/blob/main/src/shared/business-logic.js"
click node_customers "https://github.com/supernovasunrise/relational-database/blob/main/src/main/features/customers.js"
click node_equipment "https://github.com/supernovasunrise/relational-database/blob/main/src/main/features/equipment.js"
click node_loans "https://github.com/supernovasunrise/relational-database/blob/main/src/main/features/loans.js"
click node_agreements "https://github.com/supernovasunrise/relational-database/blob/main/src/main/features/agreements.js"
click node_reports "https://github.com/supernovasunrise/relational-database/blob/main/src/main/features/reports.js"
click node_importexport "https://github.com/supernovasunrise/relational-database/blob/main/src/main/features/import-export.js"
click node_printing "https://github.com/supernovasunrise/relational-database/blob/main/src/main/features/print.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_electron,node_renderer,node_views,node_preload,node_ipc,node_contract toneBlue
class node_logic,node_loans,node_agreements,node_printing toneAmber
class node_customers,node_equipment,node_reports,node_importexport toneMint
class node_authview,node_auth,node_database toneRose
class node_operator,node_filedialog,node_workbook toneIndigo
```

## Components

### Desktop runtime

- [Electron window](https://github.com/supernovasunrise/relational-database/blob/main/src/main/main.js): `src/main/main.js`
- [App navigation](https://github.com/supernovasunrise/relational-database/blob/main/src/renderer/js/app.js): `src/renderer/js/app.js`
- [Workflow views](https://github.com/supernovasunrise/relational-database/tree/main/src/renderer/js/views): `src/renderer/js/views`
- [DME bridge](https://github.com/supernovasunrise/relational-database/blob/main/src/preload/index.js): `src/preload/index.js`
- [IPC handlers](https://github.com/supernovasunrise/relational-database/blob/main/src/main/ipc.js): `src/main/ipc.js`
- [IPC contract](https://github.com/supernovasunrise/relational-database/blob/main/src/shared/ipc-contract.js): `src/shared/ipc-contract.js`

### Checkout workflow

- [Business rules](https://github.com/supernovasunrise/relational-database/blob/main/src/shared/business-logic.js): `src/shared/business-logic.js`
- [Loans and returns](https://github.com/supernovasunrise/relational-database/blob/main/src/main/features/loans.js): `src/main/features/loans.js`
- [Checkout agreements](https://github.com/supernovasunrise/relational-database/blob/main/src/main/features/agreements.js): `src/main/features/agreements.js`
- [Printing](https://github.com/supernovasunrise/relational-database/blob/main/src/main/features/print.js): `src/main/features/print.js`

### Records and reporting

- [Customer records](https://github.com/supernovasunrise/relational-database/blob/main/src/main/features/customers.js): `src/main/features/customers.js`
- [Equipment inventory](https://github.com/supernovasunrise/relational-database/blob/main/src/main/features/equipment.js): `src/main/features/equipment.js`
- [Reports and analytics](https://github.com/supernovasunrise/relational-database/blob/main/src/main/features/reports.js): `src/main/features/reports.js`
- [Import and export](https://github.com/supernovasunrise/relational-database/blob/main/src/main/features/import-export.js): `src/main/features/import-export.js`

### Access and storage

- [Login view](https://github.com/supernovasunrise/relational-database/blob/main/src/renderer/js/views/auth.js): `src/renderer/js/views/auth.js`
- [Authentication](https://github.com/supernovasunrise/relational-database/blob/main/src/main/auth.js): `src/main/auth.js`
- [SQLite database](https://github.com/supernovasunrise/relational-database/blob/main/src/main/db.js): `src/main/db.js`

### Other components

- **Program operator**
- **Local file dialog**
- **Excel workbook support**

## Connections

- Program operator → App navigation: uses
- Electron window → SQLite database: initializes
- Electron window → IPC handlers: registers handlers
- Electron window → App navigation: loads window
- App navigation → Workflow views: routes to
- App navigation → DME bridge: requests status
- Workflow views → DME bridge: invokes bridge
- DME bridge → IPC handlers: sends IPC
- IPC handlers → IPC contract: checks channels
- IPC handlers → Authentication: dispatches auth
- IPC handlers → Customer records: dispatches customer
- IPC handlers → Equipment inventory: dispatches equipment
- IPC handlers → Loans and returns: dispatches loans
- IPC handlers → Checkout agreements: dispatches agreements
- IPC handlers → Reports and analytics: dispatches reports
- IPC handlers → Import and export: dispatches transfers
- IPC handlers → Printing: dispatches print
- Login view → DME bridge: submits credentials
- Authentication → SQLite database: reads and writes users
- Customer records → SQLite database: reads and writes
- Equipment inventory → SQLite database: reads and writes
- Loans and returns → SQLite database: reads and writes
- Checkout agreements → SQLite database: reads and writes
- Reports and analytics → SQLite database: queries records
- Import and export → SQLite database: transfers records
- Equipment inventory → Business rules: uses validation
- Loans and returns → Business rules: uses date rules
- Import and export → Business rules: uses normalization
- Import and export → Local file dialog: chooses files
- Import and export → Excel workbook support: reads and writes
- Printing → Electron window: prints document
