# dari0-cpu/preventivatorepwa architecture

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

- Interactive diagram: https://gitdiagram.com/dari0-cpu/preventivatorepwa
- Repository: https://github.com/dari0-cpu/preventivatorepwa

## Overview

This repository implements a quote-building application: a user enters issuer and client details, edits quote sections and terms, reviews a rendered document, then saves, exports, or prints it. The frontend also supports local drafts and a cloud-backed archive; the backend contains quote models and calculation logic. The README is empty, so product capabilities are inferred from sampled frontend source and the source index; backend routing details and some frontend internals were not sampled.

Main entry points: [`frontend/src/quote/QuoteBuilder.jsx`](https://github.com/dari0-cpu/preventivatorepwa/blob/main/frontend/src/quote/QuoteBuilder.jsx) (Quote builder), [`frontend/src/quote/QuotePreview.jsx`](https://github.com/dari0-cpu/preventivatorepwa/blob/main/frontend/src/quote/QuotePreview.jsx) (Quote preview), [`frontend/src/quote/quoteModel.js`](https://github.com/dari0-cpu/preventivatorepwa/blob/main/frontend/src/quote/quoteModel.js) (Quote model and archive), [`frontend/src/quote/useQuote.js`](https://github.com/dari0-cpu/preventivatorepwa/blob/main/frontend/src/quote/useQuote.js) (Quote state)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_editing["Quote editing"]
  node_app["App shell<br/>[App.jsx]"]
  node_builder["Quote builder<br/>[QuoteBuilder.jsx]"]
  node_quote_state["Quote state<br/>[useQuote.js]"]
  node_issuer["Issuer details<br/>[IssuerPanel.jsx]"]
  node_client["Client details<br/>[ClientPanel.jsx]"]
  node_metadata["Quote metadata<br/>[DocumentMeta.jsx]"]
  node_sections["Section editor<br/>[SectionEditor.jsx]"]
  node_line_editor["Line editor<br/>[LineRow.jsx]"]
  node_terms["Terms and notes<br/>[TermsPanel.jsx]"]
  node_field_controls["Form controls<br/>[Field.jsx]"]
  node_panel_layout["Panel layout<br/>[Panel.jsx]"]
end

subgraph group_document["Document output"]
  node_preview["Quote preview<br/>[QuotePreview.jsx]"]
  node_totals["Quote totals<br/>[totals.js]"]
  node_format["Formatting<br/>[format.js]"]
  node_pdf["PDF export<br/>[QuoteBuilder.jsx]"]
  node_file_export["JSON file export<br/>[quoteModel.js]"]
end

subgraph group_persistence["Quote persistence"]
  node_quote_model["Quote model and archive<br/>[quoteModel.js]"]
  node_browser_store[("Browser storage<br/>[storage.js]")]
end

subgraph group_backend["Backend API"]
  node_backend_entry["Backend entry<br/>[main.py]"]
  node_backend_models["Quote request models<br/>[models.py]"]
  node_backend_calculations["Backend calculations<br/>[calculations.py]"]
end

node_user(("Quote author"))
node_supabase[("Supabase")]

node_user -->|"uses"| node_app
node_app -->|"renders"| node_builder
node_builder -->|"uses state"| node_quote_state
node_builder -->|"renders"| node_issuer
node_builder -->|"renders"| node_client
node_builder -->|"renders"| node_metadata
node_builder -->|"renders"| node_sections
node_builder -->|"renders"| node_terms
node_builder -->|"renders"| node_preview
node_builder -->|"archives quotes"| node_quote_model
node_builder -->|"generates PDF"| node_pdf
node_builder -->|"exports JSON"| node_file_export
node_quote_state -->|"creates data"| node_quote_model
node_quote_state -->|"loads and saves"| node_browser_store
node_client -->|"uses layout"| node_panel_layout
node_client -->|"uses fields"| node_field_controls
node_sections -->|"renders rows"| node_line_editor
node_sections -->|"uses fields"| node_field_controls
node_terms -->|"uses fields"| node_field_controls
node_preview -->|"computes totals"| node_totals
node_preview -->|"formats values"| node_format
node_preview -->|"formats client"| node_quote_model
node_totals -->|"parses amounts"| node_format
node_quote_model -->|"reads and writes archive"| node_supabase
node_backend_entry -->|"uses models"| node_backend_models
node_backend_entry -->|"uses calculations"| node_backend_calculations
node_backend_calculations -->|"uses models"| node_backend_models

click node_app "https://github.com/dari0-cpu/preventivatorepwa/blob/main/frontend/src/App.jsx"
click node_builder "https://github.com/dari0-cpu/preventivatorepwa/blob/main/frontend/src/quote/QuoteBuilder.jsx"
click node_quote_state "https://github.com/dari0-cpu/preventivatorepwa/blob/main/frontend/src/quote/useQuote.js"
click node_quote_model "https://github.com/dari0-cpu/preventivatorepwa/blob/main/frontend/src/quote/quoteModel.js"
click node_issuer "https://github.com/dari0-cpu/preventivatorepwa/blob/main/frontend/src/quote/IssuerPanel.jsx"
click node_client "https://github.com/dari0-cpu/preventivatorepwa/blob/main/frontend/src/quote/ClientPanel.jsx"
click node_metadata "https://github.com/dari0-cpu/preventivatorepwa/blob/main/frontend/src/quote/DocumentMeta.jsx"
click node_sections "https://github.com/dari0-cpu/preventivatorepwa/blob/main/frontend/src/quote/SectionEditor.jsx"
click node_line_editor "https://github.com/dari0-cpu/preventivatorepwa/blob/main/frontend/src/quote/LineRow.jsx"
click node_terms "https://github.com/dari0-cpu/preventivatorepwa/blob/main/frontend/src/quote/TermsPanel.jsx"
click node_field_controls "https://github.com/dari0-cpu/preventivatorepwa/blob/main/frontend/src/components/Field.jsx"
click node_panel_layout "https://github.com/dari0-cpu/preventivatorepwa/blob/main/frontend/src/components/Panel.jsx"
click node_preview "https://github.com/dari0-cpu/preventivatorepwa/blob/main/frontend/src/quote/QuotePreview.jsx"
click node_totals "https://github.com/dari0-cpu/preventivatorepwa/blob/main/frontend/src/lib/totals.js"
click node_format "https://github.com/dari0-cpu/preventivatorepwa/blob/main/frontend/src/lib/format.js"
click node_pdf "https://github.com/dari0-cpu/preventivatorepwa/blob/main/frontend/src/quote/QuoteBuilder.jsx"
click node_file_export "https://github.com/dari0-cpu/preventivatorepwa/blob/main/frontend/src/quote/quoteModel.js"
click node_browser_store "https://github.com/dari0-cpu/preventivatorepwa/blob/main/frontend/src/lib/storage.js"
click node_backend_entry "https://github.com/dari0-cpu/preventivatorepwa/blob/main/backend/main.py"
click node_backend_models "https://github.com/dari0-cpu/preventivatorepwa/blob/main/backend/models.py"
click node_backend_calculations "https://github.com/dari0-cpu/preventivatorepwa/blob/main/backend/calculations.py"

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_builder,node_quote_state,node_issuer,node_client,node_metadata,node_sections,node_line_editor,node_terms,node_field_controls,node_panel_layout toneBlue
class node_preview,node_totals,node_format,node_pdf,node_file_export,node_supabase toneAmber
class node_quote_model,node_browser_store toneMint
class node_backend_entry,node_backend_models,node_backend_calculations toneRose
class node_user toneIndigo
```

## Components

### Quote editing

- [App shell](https://github.com/dari0-cpu/preventivatorepwa/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Quote builder](https://github.com/dari0-cpu/preventivatorepwa/blob/main/frontend/src/quote/QuoteBuilder.jsx): `frontend/src/quote/QuoteBuilder.jsx`
- [Quote state](https://github.com/dari0-cpu/preventivatorepwa/blob/main/frontend/src/quote/useQuote.js): `frontend/src/quote/useQuote.js`
- [Issuer details](https://github.com/dari0-cpu/preventivatorepwa/blob/main/frontend/src/quote/IssuerPanel.jsx): `frontend/src/quote/IssuerPanel.jsx`
- [Client details](https://github.com/dari0-cpu/preventivatorepwa/blob/main/frontend/src/quote/ClientPanel.jsx): `frontend/src/quote/ClientPanel.jsx`
- [Quote metadata](https://github.com/dari0-cpu/preventivatorepwa/blob/main/frontend/src/quote/DocumentMeta.jsx): `frontend/src/quote/DocumentMeta.jsx`
- [Section editor](https://github.com/dari0-cpu/preventivatorepwa/blob/main/frontend/src/quote/SectionEditor.jsx): `frontend/src/quote/SectionEditor.jsx`
- [Line editor](https://github.com/dari0-cpu/preventivatorepwa/blob/main/frontend/src/quote/LineRow.jsx): `frontend/src/quote/LineRow.jsx`
- [Terms and notes](https://github.com/dari0-cpu/preventivatorepwa/blob/main/frontend/src/quote/TermsPanel.jsx): `frontend/src/quote/TermsPanel.jsx`
- [Form controls](https://github.com/dari0-cpu/preventivatorepwa/blob/main/frontend/src/components/Field.jsx): `frontend/src/components/Field.jsx`
- [Panel layout](https://github.com/dari0-cpu/preventivatorepwa/blob/main/frontend/src/components/Panel.jsx): `frontend/src/components/Panel.jsx`

### Document output

- [Quote preview](https://github.com/dari0-cpu/preventivatorepwa/blob/main/frontend/src/quote/QuotePreview.jsx): `frontend/src/quote/QuotePreview.jsx`
- [Quote totals](https://github.com/dari0-cpu/preventivatorepwa/blob/main/frontend/src/lib/totals.js): `frontend/src/lib/totals.js`
- [Formatting](https://github.com/dari0-cpu/preventivatorepwa/blob/main/frontend/src/lib/format.js): `frontend/src/lib/format.js`
- [PDF export](https://github.com/dari0-cpu/preventivatorepwa/blob/main/frontend/src/quote/QuoteBuilder.jsx): `frontend/src/quote/QuoteBuilder.jsx`
- [JSON file export](https://github.com/dari0-cpu/preventivatorepwa/blob/main/frontend/src/quote/quoteModel.js): `frontend/src/quote/quoteModel.js`

### Quote persistence

- [Quote model and archive](https://github.com/dari0-cpu/preventivatorepwa/blob/main/frontend/src/quote/quoteModel.js): `frontend/src/quote/quoteModel.js`
- [Browser storage](https://github.com/dari0-cpu/preventivatorepwa/blob/main/frontend/src/lib/storage.js): `frontend/src/lib/storage.js`

### Backend API

- [Backend entry](https://github.com/dari0-cpu/preventivatorepwa/blob/main/backend/main.py): `backend/main.py`
- [Quote request models](https://github.com/dari0-cpu/preventivatorepwa/blob/main/backend/models.py): `backend/models.py`
- [Backend calculations](https://github.com/dari0-cpu/preventivatorepwa/blob/main/backend/calculations.py): `backend/calculations.py`

### Other components

- **Quote author**
- **Supabase**

## Connections

- Quote author → App shell: uses
- App shell → Quote builder: renders (evidence: `frontend/src/App.jsx`)
- Quote builder → Quote state: uses state (evidence: `frontend/src/quote/QuoteBuilder.jsx`)
- Quote builder → Issuer details: renders (evidence: `frontend/src/quote/QuoteBuilder.jsx`)
- Quote builder → Client details: renders (evidence: `frontend/src/quote/QuoteBuilder.jsx`)
- Quote builder → Quote metadata: renders (evidence: `frontend/src/quote/QuoteBuilder.jsx`)
- Quote builder → Section editor: renders (evidence: `frontend/src/quote/QuoteBuilder.jsx`)
- Quote builder → Terms and notes: renders (evidence: `frontend/src/quote/QuoteBuilder.jsx`)
- Quote builder → Quote preview: renders (evidence: `frontend/src/quote/QuoteBuilder.jsx`)
- Quote builder → Quote model and archive: archives quotes (evidence: `frontend/src/quote/QuoteBuilder.jsx`)
- Quote builder → PDF export: generates PDF (evidence: `frontend/src/quote/QuoteBuilder.jsx`)
- Quote builder → JSON file export: exports JSON (evidence: `frontend/src/quote/QuoteBuilder.jsx`)
- Quote state → Quote model and archive: creates data (evidence: `frontend/src/quote/useQuote.js`)
- Quote state → Browser storage: loads and saves (evidence: `frontend/src/quote/useQuote.js`)
- Client details → Panel layout: uses layout (evidence: `frontend/src/quote/ClientPanel.jsx`)
- Client details → Form controls: uses fields (evidence: `frontend/src/quote/ClientPanel.jsx`)
- Section editor → Line editor: renders rows
- Section editor → Form controls: uses fields (evidence: `frontend/src/quote/SectionEditor.jsx`)
- Terms and notes → Form controls: uses fields (evidence: `frontend/src/quote/TermsPanel.jsx`)
- Quote preview → Quote totals: computes totals (evidence: `frontend/src/quote/QuotePreview.jsx`)
- Quote preview → Formatting: formats values (evidence: `frontend/src/quote/QuotePreview.jsx`)
- Quote preview → Quote model and archive: formats client (evidence: `frontend/src/quote/QuotePreview.jsx`)
- Quote totals → Formatting: parses amounts (evidence: `frontend/src/lib/totals.js`)
- Quote model and archive → Supabase: reads and writes archive (evidence: `frontend/src/quote/quoteModel.js`)
- Backend entry → Quote request models: uses models (evidence: `backend/main.py`)
- Backend entry → Backend calculations: uses calculations (evidence: `backend/main.py`)
- Backend calculations → Quote request models: uses models (evidence: `backend/calculations.py`)
