# ekennabiz/estimator-app architecture

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

- Interactive diagram: https://gitdiagram.com/ekennabiz/estimator-app
- Repository: https://github.com/ekennabiz/estimator-app

## Overview

1. This is a client-side React application built with Vite. There is no visible backend, API layer, or database in the repo, so the architecture is primarily a single-page UI that manages estimating and proposal data in memory and renders derived views from that state.

2. The root app composition lives in `src/App.jsx`, with `src/main.jsx` as the entry point. `App` likely owns the top-level state and orchestrates the major regions of the screen: navigation/chrome, the estimate editor, AI assistance, analytics, and proposal preview.

3. The UI is organized into small feature components under `src/components`, which suggests a modular form-based workflow rather than a page-per-route app. The major user-facing sections are:
   - project metadata: `ProjectInfo`
   - estimate inputs: `LaborSection`, `MaterialsSection`, `EquipmentSection`, `DeliverySection`, `ChargesSection`
   - settings and controls: `SettingsSection`, `Tabs`, `Sidebar`, `Topbar`, `ThemeToggle`
   - summary and outputs: `SummarySection`, `StatsBar`, `AnalyticsChart`, `ProposalPreview`, `EstimateHistory`
   - AI features: `AiPanel`, `AiProposal`, `Notification`

4. The estimate itself appears to be structured as several cost domains, each likely capturing line items and totals. Those sections feed a shared calculation layer rather than acting independently. `src/utils/calculations.js` is the central boundary for turning raw user-entered values into totals, margins, subtotals, and other derived financial figures.

5. Presentation formatting is separated from computation. `src/utils/formatters.js` likely standardizes currency, percentages, dates, and similar display concerns so that charts, summary cards, history, and proposal output remain consistent even though they consume the same underlying estimate state.

6. There is a dedicated AI subsystem, but it appears to be local/embedded logic rather than a networked integration. `src/utils/aiEngine.js` and `src/utils/aiSuggestions.js` imply rule-based or heuristic generation of recommendations and proposal text, which the `AiPanel` and `AiProposal` components surface to the user. This makes AI a feature boundary on top of the estimate state, not a separate service.

7. Templates are stored in `src/data/templates.js`, indicating the app can preload or switch between predefined estimate/proposal shapes. That makes templates a seed/input layer for the editor, likely influencing defaults in the project info, section contents, and proposal preview.

8. The output side of the app is more than a simple form summary. `ProposalPreview`, `AnalyticsChart`, `StatsBar`, and `SummarySection` indicate the same estimate data is transformed into multiple views: a human-readable proposal, numeric dashboards, and trend/visual analytics. These are all downstream consumers of the same core state and calculations.

9. The layout and interaction chrome are handled by reusable shell components such as `Header`, `Topbar`, `Sidebar`, `Tabs`, `CollapsibleSection`, and `ThemeToggle`. This suggests the app is designed as a dense workspace with section switching and collapsible panels rather than a linear wizard.

10. `EstimateHistory` indicates the app tracks previous estimates or revisions within the client experience. Since no persistence layer is visible, this is likely local/session state or browser storage, meaning history is a UI concern attached to the same app state rather than a separate service.

11. Styling is centralized in `src/styles.css`, with Vite and ESLint providing the build/dev and code-quality tooling. There are no signs of server rendering, routing infrastructure, or external state-management libraries, so the architecture is intentionally lightweight and front-end only.

12. For an architecture diagram, the key flow is: user edits project and cost sections -> shared estimate state updates -> calculation utilities derive totals and metrics -> formatting utilities prepare display values -> output components render summary, analytics, proposal, and history -> AI utilities generate suggestions/proposal assistance from the same state. The important boundary is between raw editable inputs and derived presentation/AI outputs.

Main entry points: [`src/App.jsx`](https://github.com/ekennabiz/estimator-app/blob/main/src/App.jsx) (App), [`src/utils/calculations.js`](https://github.com/ekennabiz/estimator-app/blob/main/src/utils/calculations.js) (Calculations), [`src/utils/aiEngine.js`](https://github.com/ekennabiz/estimator-app/blob/main/src/utils/aiEngine.js) (AI engine), [`src/components/ProjectInfo.jsx`](https://github.com/ekennabiz/estimator-app/blob/main/src/components/ProjectInfo.jsx) (Project info)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_group_app["App shell"]
  node_node_main(("main<br/>entry<br/>[main.jsx]"))
  node_node_app["App<br/>orchestrator<br/>[App.jsx]"]
  node_node_header["Header<br/>chrome<br/>[Header.jsx]"]
  node_node_topbar["Topbar<br/>chrome<br/>[Topbar.jsx]"]
  node_node_sidebar["Sidebar<br/>chrome<br/>[Sidebar.jsx]"]
  node_node_tabs["Tabs<br/>switcher<br/>[Tabs.jsx]"]
  node_node_theme["Theme<br/>ui toggle<br/>[ThemeToggle.jsx]"]
  node_node_collapsible["Collapsible<br/>ui primitive"]
  node_node_notification["Notification<br/>toast<br/>[Notification.jsx]"]
end

subgraph group_group_editor["Estimate editor"]
  node_node_project["Project info<br/>form section<br/>[ProjectInfo.jsx]"]
  node_node_labor["Labor<br/>cost section<br/>[LaborSection.jsx]"]
  node_node_materials["Materials<br/>cost section"]
  node_node_equipment["Equipment<br/>cost section"]
  node_node_delivery["Delivery<br/>cost section"]
  node_node_charges["Charges<br/>cost section<br/>[ChargesSection.jsx]"]
  node_node_settings["Settings<br/>options panel"]
end

subgraph group_group_output["Outputs"]
  node_node_summary["Summary<br/>dashboard<br/>[SummarySection.jsx]"]
  node_node_stats["Stats bar<br/>metrics view<br/>[StatsBar.jsx]"]
  node_node_chart(("Analytics<br/>chart view<br/>[AnalyticsChart.jsx]"))
  node_node_preview["Proposal<br/>rendered output"]
  node_node_history["History<br/>revision view"]
end

subgraph group_group_ai["AI assist"]
  node_node_ai_panel["AI panel<br/>assist panel<br/>[AiPanel.jsx]"]
  node_node_ai_prop["AI proposal<br/>assist output<br/>[AiProposal.jsx]"]
  node_node_ai_engine{{"AI engine<br/>heuristic logic<br/>[aiEngine.js]"}}
  node_node_ai_suggestions["Suggestions<br/>rules data<br/>[aiSuggestions.js]"]
end

subgraph group_group_core["Core logic"]
  node_node_calc{{"Calculations<br/>financial engine<br/>[calculations.js]"}}
  node_node_format["Formatters<br/>display utils<br/>[formatters.js]"]
  node_node_templates[("Templates<br/>seed data<br/>[templates.js]")]
end

node_node_main -->|"mounts"| node_node_app
node_node_app -->|"composes"| node_node_header
node_node_app -->|"composes"| node_node_topbar
node_node_app -->|"composes"| node_node_sidebar
node_node_app -->|"switches"| node_node_tabs
node_node_app -->|"controls"| node_node_theme
node_node_app -->|"hosts"| node_node_project
node_node_app -->|"hosts"| node_node_labor
node_node_app -->|"hosts"| node_node_materials
node_node_app -->|"hosts"| node_node_equipment
node_node_app -->|"hosts"| node_node_delivery
node_node_app -->|"hosts"| node_node_charges
node_node_app -->|"hosts"| node_node_settings
node_node_app -->|"renders"| node_node_summary
node_node_app -->|"renders"| node_node_stats
node_node_app -->|"renders"| node_node_chart
node_node_app -->|"renders"| node_node_preview
node_node_app -->|"renders"| node_node_history
node_node_app -->|"surfaces"| node_node_ai_panel
node_node_app -->|"surfaces"| node_node_ai_prop
node_node_app -->|"notifies"| node_node_notification
node_node_app -->|"uses"| node_node_collapsible
node_node_labor -->|"feeds"| node_node_calc
node_node_materials -->|"feeds"| node_node_calc
node_node_equipment -->|"feeds"| node_node_calc
node_node_delivery -->|"feeds"| node_node_calc
node_node_charges -->|"feeds"| node_node_calc
node_node_project -->|"seeds"| node_node_templates
node_node_settings -->|"selects"| node_node_templates
node_node_calc -->|"uses"| node_node_format
node_node_calc -->|"drives"| node_node_summary
node_node_calc -->|"drives"| node_node_stats
node_node_calc -->|"drives"| node_node_chart
node_node_calc -->|"drives"| node_node_preview
node_node_calc -->|"populates"| node_node_history
node_node_ai_panel -->|"invokes"| node_node_ai_engine
node_node_ai_prop -->|"generates"| node_node_ai_engine
node_node_ai_engine -->|"uses"| node_node_ai_suggestions
node_node_ai_engine -->|"consumes"| node_node_calc
node_node_ai_engine -->|"formats"| node_node_format

click node_node_main "https://github.com/ekennabiz/estimator-app/blob/main/src/main.jsx"
click node_node_app "https://github.com/ekennabiz/estimator-app/blob/main/src/App.jsx"
click node_node_header "https://github.com/ekennabiz/estimator-app/blob/main/src/components/Header.jsx"
click node_node_topbar "https://github.com/ekennabiz/estimator-app/blob/main/src/components/Topbar.jsx"
click node_node_sidebar "https://github.com/ekennabiz/estimator-app/blob/main/src/components/Sidebar.jsx"
click node_node_tabs "https://github.com/ekennabiz/estimator-app/blob/main/src/components/Tabs.jsx"
click node_node_theme "https://github.com/ekennabiz/estimator-app/blob/main/src/components/ThemeToggle.jsx"
click node_node_project "https://github.com/ekennabiz/estimator-app/blob/main/src/components/ProjectInfo.jsx"
click node_node_labor "https://github.com/ekennabiz/estimator-app/blob/main/src/components/LaborSection.jsx"
click node_node_materials "https://github.com/ekennabiz/estimator-app/blob/main/src/components/MaterialsSection.jsx"
click node_node_equipment "https://github.com/ekennabiz/estimator-app/blob/main/src/components/EquipmentSection.jsx"
click node_node_delivery "https://github.com/ekennabiz/estimator-app/blob/main/src/components/DeliverySection.jsx"
click node_node_charges "https://github.com/ekennabiz/estimator-app/blob/main/src/components/ChargesSection.jsx"
click node_node_settings "https://github.com/ekennabiz/estimator-app/blob/main/src/components/SettingsSection.jsx"
click node_node_calc "https://github.com/ekennabiz/estimator-app/blob/main/src/utils/calculations.js"
click node_node_format "https://github.com/ekennabiz/estimator-app/blob/main/src/utils/formatters.js"
click node_node_templates "https://github.com/ekennabiz/estimator-app/blob/main/src/data/templates.js"
click node_node_summary "https://github.com/ekennabiz/estimator-app/blob/main/src/components/SummarySection.jsx"
click node_node_stats "https://github.com/ekennabiz/estimator-app/blob/main/src/components/StatsBar.jsx"
click node_node_chart "https://github.com/ekennabiz/estimator-app/blob/main/src/components/AnalyticsChart.jsx"
click node_node_preview "https://github.com/ekennabiz/estimator-app/blob/main/src/components/ProposalPreview.jsx"
click node_node_history "https://github.com/ekennabiz/estimator-app/blob/main/src/components/EstimateHistory.jsx"
click node_node_ai_panel "https://github.com/ekennabiz/estimator-app/blob/main/src/components/AiPanel.jsx"
click node_node_ai_prop "https://github.com/ekennabiz/estimator-app/blob/main/src/components/AiProposal.jsx"
click node_node_ai_engine "https://github.com/ekennabiz/estimator-app/blob/main/src/utils/aiEngine.js"
click node_node_ai_suggestions "https://github.com/ekennabiz/estimator-app/blob/main/src/utils/aiSuggestions.js"
click node_node_collapsible "https://github.com/ekennabiz/estimator-app/blob/main/src/components/CollapsibleSection.jsx"
click node_node_notification "https://github.com/ekennabiz/estimator-app/blob/main/src/components/Notification.jsx"

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_node_main,node_node_app,node_node_header,node_node_topbar,node_node_sidebar,node_node_tabs,node_node_theme,node_node_collapsible,node_node_notification toneBlue
class node_node_project,node_node_labor,node_node_materials,node_node_equipment,node_node_delivery,node_node_charges,node_node_settings toneAmber
class node_node_summary,node_node_stats,node_node_chart,node_node_preview,node_node_history toneMint
class node_node_ai_panel,node_node_ai_prop,node_node_ai_engine,node_node_ai_suggestions toneRose
class node_node_calc,node_node_format,node_node_templates toneIndigo
```

## Components

### App shell

Entry point and shared chrome for the single-page workspace.

- [main](https://github.com/ekennabiz/estimator-app/blob/main/src/main.jsx): entry · Vite entry that mounts the React app. · `src/main.jsx`
- [App](https://github.com/ekennabiz/estimator-app/blob/main/src/App.jsx): orchestrator · Top-level state and screen composition. · `src/App.jsx`
- [Header](https://github.com/ekennabiz/estimator-app/blob/main/src/components/Header.jsx): chrome · Main workspace header. · `src/components/Header.jsx`
- [Topbar](https://github.com/ekennabiz/estimator-app/blob/main/src/components/Topbar.jsx): chrome · Primary controls and navigation bar. · `src/components/Topbar.jsx`
- [Sidebar](https://github.com/ekennabiz/estimator-app/blob/main/src/components/Sidebar.jsx): chrome · Secondary navigation and workspace controls. · `src/components/Sidebar.jsx`
- [Tabs](https://github.com/ekennabiz/estimator-app/blob/main/src/components/Tabs.jsx): switcher · Section switching for the dense editor. · `src/components/Tabs.jsx`
- [Theme](https://github.com/ekennabiz/estimator-app/blob/main/src/components/ThemeToggle.jsx): ui toggle · Theme switching control. · `src/components/ThemeToggle.jsx`
- [Collapsible](https://github.com/ekennabiz/estimator-app/blob/main/src/components/CollapsibleSection.jsx): ui primitive · Reusable expandable section wrapper. · `src/components/CollapsibleSection.jsx`
- [Notification](https://github.com/ekennabiz/estimator-app/blob/main/src/components/Notification.jsx): toast · Transient user feedback messages. · `src/components/Notification.jsx`

### Estimate editor

User-editable project and cost sections.

- [Project info](https://github.com/ekennabiz/estimator-app/blob/main/src/components/ProjectInfo.jsx): form section · Project metadata inputs. · `src/components/ProjectInfo.jsx`
- [Labor](https://github.com/ekennabiz/estimator-app/blob/main/src/components/LaborSection.jsx): cost section · Labor line items and totals. · `src/components/LaborSection.jsx`
- [Materials](https://github.com/ekennabiz/estimator-app/blob/main/src/components/MaterialsSection.jsx): cost section · Materials line items and totals. · `src/components/MaterialsSection.jsx`
- [Equipment](https://github.com/ekennabiz/estimator-app/blob/main/src/components/EquipmentSection.jsx): cost section · Equipment line items and totals. · `src/components/EquipmentSection.jsx`
- [Delivery](https://github.com/ekennabiz/estimator-app/blob/main/src/components/DeliverySection.jsx): cost section · Delivery and logistics costs. · `src/components/DeliverySection.jsx`
- [Charges](https://github.com/ekennabiz/estimator-app/blob/main/src/components/ChargesSection.jsx): cost section · Fees, charges, and adjustments. · `src/components/ChargesSection.jsx`
- [Settings](https://github.com/ekennabiz/estimator-app/blob/main/src/components/SettingsSection.jsx): options panel · Estimate and proposal configuration. · `src/components/SettingsSection.jsx`

### Outputs

Derived views rendered from the shared estimate state.

- [Summary](https://github.com/ekennabiz/estimator-app/blob/main/src/components/SummarySection.jsx): dashboard · High-level estimate summary. · `src/components/SummarySection.jsx`
- [Stats bar](https://github.com/ekennabiz/estimator-app/blob/main/src/components/StatsBar.jsx): metrics view · Compact KPI display. · `src/components/StatsBar.jsx`
- [Analytics](https://github.com/ekennabiz/estimator-app/blob/main/src/components/AnalyticsChart.jsx): chart view · Visual analytics of the estimate. · `src/components/AnalyticsChart.jsx`
- [Proposal](https://github.com/ekennabiz/estimator-app/blob/main/src/components/ProposalPreview.jsx): rendered output · Human-readable proposal preview. · `src/components/ProposalPreview.jsx`
- [History](https://github.com/ekennabiz/estimator-app/blob/main/src/components/EstimateHistory.jsx): revision view · Past estimates or revisions within the client UI. · `src/components/EstimateHistory.jsx`

### AI assist

Local suggestion and proposal generation features.

- [AI panel](https://github.com/ekennabiz/estimator-app/blob/main/src/components/AiPanel.jsx): assist panel · Surface for generated suggestions and guidance. · `src/components/AiPanel.jsx`
- [AI proposal](https://github.com/ekennabiz/estimator-app/blob/main/src/components/AiProposal.jsx): assist output · Generated proposal text or phrasing assistance. · `src/components/AiProposal.jsx`
- [AI engine](https://github.com/ekennabiz/estimator-app/blob/main/src/utils/aiEngine.js): heuristic logic · Local recommendation and proposal generation logic. · `src/utils/aiEngine.js`
- [Suggestions](https://github.com/ekennabiz/estimator-app/blob/main/src/utils/aiSuggestions.js): rules data · Prompt and suggestion rules for the AI layer. · `src/utils/aiSuggestions.js`

### Core logic

Computation, formatting, and seeded template data.

- [Calculations](https://github.com/ekennabiz/estimator-app/blob/main/src/utils/calculations.js): financial engine · Derives totals, margins, subtotals, and other metrics. · `src/utils/calculations.js`
- [Formatters](https://github.com/ekennabiz/estimator-app/blob/main/src/utils/formatters.js): display utils · Currency, percentage, and date formatting. · `src/utils/formatters.js`
- [Templates](https://github.com/ekennabiz/estimator-app/blob/main/src/data/templates.js): seed data · Predefined estimate and proposal templates. · `src/data/templates.js`

## Connections

- main → App: mounts · Entry point renders the root application.
- App → Header: composes · App includes shared header chrome.
- App → Topbar: composes · App includes the top-level control bar.
- App → Sidebar: composes · App includes sidebar workspace navigation.
- App → Tabs: switches · App coordinates the active editor section.
- App → Theme: controls · Theme is managed from the shell.
- App → Project info: hosts · Project metadata feeds the shared estimate state.
- App → Labor: hosts · Labor inputs are edited in the main workspace.
- App → Materials: hosts · Materials inputs are edited in the main workspace.
- App → Equipment: hosts · Equipment inputs are edited in the main workspace.
- App → Delivery: hosts · Delivery inputs are edited in the main workspace.
- App → Charges: hosts · Charges inputs are edited in the main workspace.
- App → Settings: hosts · Settings influence estimate behavior and outputs.
- App → Summary: renders · App shows summary from derived estimate state.
- App → Stats bar: renders · App shows compact metrics from the estimate.
- App → Analytics: renders · App shows analytics derived from the estimate.
- App → Proposal: renders · App shows proposal output from shared state.
- App → History: renders · App shows prior estimates or revisions.
- App → AI panel: surfaces · App exposes AI assistance controls.
- App → AI proposal: surfaces · App exposes generated proposal text.
- App → Notification: notifies · App displays transient feedback messages.
- App → Collapsible: uses · Workspace sections can collapse and expand.
- Labor → Calculations: feeds · Cost sections contribute raw values into calculations.
- Materials → Calculations: feeds · Cost sections contribute raw values into calculations.
- Equipment → Calculations: feeds · Cost sections contribute raw values into calculations.
- Delivery → Calculations: feeds · Cost sections contribute raw values into calculations.
- Charges → Calculations: feeds · Cost sections contribute raw values into calculations.
- Project info → Templates: seeds · Templates provide starting project and proposal shapes.
- Settings → Templates: selects · Settings can apply predefined templates.
- Calculations → Formatters: uses · Computed values are formatted for display.
- Calculations → Summary: drives · Summary displays derived totals and margins.
- Calculations → Stats bar: drives · Stats bar presents computed KPIs.
- Calculations → Analytics: drives · Analytics chart visualizes calculated data.
- Calculations → Proposal: drives · Proposal content is based on calculated estimate values.
- Calculations → History: populates · History records prior calculated snapshots.
- AI panel → AI engine: invokes · AI panel requests recommendations from local logic.
- AI proposal → AI engine: generates · Proposal assistance is produced by the AI logic.
- AI engine → Suggestions: uses · AI logic relies on rule or prompt suggestions.
- AI engine → Calculations: consumes · AI features read the current estimate state and metrics.
- AI engine → Formatters: formats · AI output is prepared for presentation.
