# dhirajminde09/ecosmartx architecture

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

- Interactive diagram: https://gitdiagram.com/dhirajminde09/ecosmartx
- Repository: https://github.com/dhirajminde09/ecosmartx

## Overview

EcoSmartX is an energy-management platform for organizing facility and appliance data, analyzing consumption and anomalies, and exploring savings, carbon impacts, forecasts, and conservation recommendations. The primary React workflow is user navigation through a shared energy context into specialized intelligence views; that context derives metrics from the deterministic energy engine. The tree and excerpts also show a substantial vanilla-JavaScript application path with its own state, renderers, calendar, and calculation engine. Server-side implementation details were not sampled, so backend relationships are not mapped.

Main entry points: [`src/App.tsx`](https://github.com/dhirajminde09/ecosmartx/blob/main/src/App.tsx) (React app shell), [`src/context/EnergyContext.tsx`](https://github.com/dhirajminde09/ecosmartx/blob/main/src/context/EnergyContext.tsx) (Energy state), [`src/views/views.js`](https://github.com/dhirajminde09/ecosmartx/blob/main/src/views/views.js) (Vanilla view renderers), [`src/main.js`](https://github.com/dhirajminde09/ecosmartx/blob/main/src/main.js) (Vanilla app driver)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_react["React application"]
  node_app["React app shell<br/>[App.tsx]"]
  node_nav["Navigation<br/>[Sidebar.tsx]"]
  node_facility["Facility setup"]
  node_appliances["Appliance intelligence"]
  node_dashboard["Energy dashboard<br/>[CommandCenter.tsx]"]
  node_analytics["Energy analytics"]
  node_simulation["Savings simulation<br/>[SimulationLab.tsx]"]
  node_twin["Digital twin"]
  node_reports["Reports and audit"]
  node_copilot["AI copilot<br/>[GeminiCopilot.tsx]"]
  node_conservation["Conservation advice"]
  node_other_intelligence["Other intelligence views"]
end

subgraph group_analysis["Energy intelligence"]
  node_context["Energy state<br/>[EnergyContext.tsx]"]
  node_engine_ts["Energy calculations<br/>[energyEngine.ts]"]
  node_seed["Sample facilities<br/>[seedData.ts]"]
end

subgraph group_vanilla["Vanilla application"]
  node_vanilla_driver["Vanilla app driver<br/>[main.js]"]
  node_vanilla_state["Vanilla app state<br/>[state.js]"]
  node_vanilla_views["Vanilla view renderers<br/>[views.js]"]
  node_calendar_view["Calendar view<br/>[calendarView.js]"]
  node_calendar_service["Calendar service<br/>[calendar.js]"]
  node_engine_js["Vanilla calculations<br/>[energyEngine.js]"]
  node_icons["SVG icon helper<br/>[icons.js]"]
end

subgraph group_integrations["External services"]
  node_firebase["Firebase auth and data<br/>[firebase.js]"]
  node_firebase_service[("Firebase")]
  node_google_calendar["Google Calendar"]
end

node_user(("Energy manager"))

node_user -->|"uses"| node_app
node_app -->|"renders"| node_nav
node_app -->|"provides state"| node_context
node_app -->|"routes to"| node_dashboard
node_app -->|"routes to"| node_facility
node_app -->|"routes to"| node_appliances
node_app -->|"routes to"| node_analytics
node_app -->|"routes to"| node_simulation
node_app -->|"routes to"| node_twin
node_app -->|"routes to"| node_reports
node_app -->|"routes to"| node_copilot
node_app -->|"routes to"| node_conservation
node_context -->|"calculates metrics"| node_engine_ts
node_context -->|"loads initial data"| node_seed
node_appliances -->|"reads energy state"| node_context
node_dashboard -->|"reads energy state"| node_context
node_facility -->|"reads energy state"| node_context
node_simulation -->|"reads energy state"| node_context
node_twin -->|"reads energy state"| node_context
node_reports -->|"reads energy state"| node_context
node_conservation -->|"reads energy state"| node_context
node_copilot -->|"reads energy state"| node_context
node_vanilla_driver -->|"uses state"| node_vanilla_state
node_vanilla_driver -->|"renders views"| node_vanilla_views
node_vanilla_driver -->|"renders calendar"| node_calendar_view
node_vanilla_state -->|"calculates metrics"| node_engine_js
node_vanilla_state -->|"uses calendar"| node_calendar_service
node_vanilla_views -->|"uses calculations"| node_engine_js
node_vanilla_views -->|"renders icons"| node_icons
node_calendar_view -->|"uses renderers"| node_vanilla_views
node_calendar_view -->|"renders icons"| node_icons
node_calendar_service -->|"uses"| node_firebase
node_firebase -->|"initializes"| node_firebase_service
node_calendar_service -.->|"integrates"| node_google_calendar
node_other_intelligence -.->|"uses shared state"| node_context

click node_app "https://github.com/dhirajminde09/ecosmartx/blob/main/src/App.tsx"
click node_nav "https://github.com/dhirajminde09/ecosmartx/blob/main/src/components/Sidebar.tsx"
click node_facility "https://github.com/dhirajminde09/ecosmartx/blob/main/src/components/views/FacilitiesAndRooms.tsx"
click node_appliances "https://github.com/dhirajminde09/ecosmartx/blob/main/src/components/views/ApplianceIntelligence.tsx"
click node_dashboard "https://github.com/dhirajminde09/ecosmartx/blob/main/src/components/views/CommandCenter.tsx"
click node_analytics "https://github.com/dhirajminde09/ecosmartx/blob/main/src/components/views/EnergyAnalytics.tsx"
click node_simulation "https://github.com/dhirajminde09/ecosmartx/blob/main/src/components/views/SimulationLab.tsx"
click node_twin "https://github.com/dhirajminde09/ecosmartx/blob/main/src/components/views/DigitalTwinStudio.tsx"
click node_reports "https://github.com/dhirajminde09/ecosmartx/blob/main/src/components/views/ReportsAndAudit.tsx"
click node_copilot "https://github.com/dhirajminde09/ecosmartx/blob/main/src/components/views/GeminiCopilot.tsx"
click node_conservation "https://github.com/dhirajminde09/ecosmartx/blob/main/src/components/views/ConservationAdvisor.tsx"
click node_other_intelligence "https://github.com/dhirajminde09/ecosmartx/tree/main/src/components/views"
click node_context "https://github.com/dhirajminde09/ecosmartx/blob/main/src/context/EnergyContext.tsx"
click node_engine_ts "https://github.com/dhirajminde09/ecosmartx/blob/main/src/utils/energyEngine.ts"
click node_seed "https://github.com/dhirajminde09/ecosmartx/blob/main/src/data/seedData.ts"
click node_vanilla_driver "https://github.com/dhirajminde09/ecosmartx/blob/main/src/main.js"
click node_vanilla_state "https://github.com/dhirajminde09/ecosmartx/blob/main/src/state.js"
click node_vanilla_views "https://github.com/dhirajminde09/ecosmartx/blob/main/src/views/views.js"
click node_calendar_view "https://github.com/dhirajminde09/ecosmartx/blob/main/src/views/calendarView.js"
click node_calendar_service "https://github.com/dhirajminde09/ecosmartx/blob/main/src/services/calendar.js"
click node_engine_js "https://github.com/dhirajminde09/ecosmartx/blob/main/src/utils/energyEngine.js"
click node_icons "https://github.com/dhirajminde09/ecosmartx/blob/main/src/utils/icons.js"
click node_firebase "https://github.com/dhirajminde09/ecosmartx/blob/main/src/services/firebase.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_app,node_nav,node_facility,node_appliances,node_dashboard,node_analytics,node_simulation,node_twin,node_reports,node_copilot,node_conservation,node_other_intelligence toneBlue
class node_context,node_engine_ts,node_seed toneAmber
class node_vanilla_driver,node_vanilla_state,node_vanilla_views,node_calendar_view,node_calendar_service,node_engine_js,node_icons toneMint
class node_firebase,node_firebase_service,node_google_calendar toneRose
class node_user toneIndigo
```

## Components

### React application

- [React app shell](https://github.com/dhirajminde09/ecosmartx/blob/main/src/App.tsx): `src/App.tsx`
- [Navigation](https://github.com/dhirajminde09/ecosmartx/blob/main/src/components/Sidebar.tsx): `src/components/Sidebar.tsx`
- [Facility setup](https://github.com/dhirajminde09/ecosmartx/blob/main/src/components/views/FacilitiesAndRooms.tsx): `src/components/views/FacilitiesAndRooms.tsx`
- [Appliance intelligence](https://github.com/dhirajminde09/ecosmartx/blob/main/src/components/views/ApplianceIntelligence.tsx): `src/components/views/ApplianceIntelligence.tsx`
- [Energy dashboard](https://github.com/dhirajminde09/ecosmartx/blob/main/src/components/views/CommandCenter.tsx): `src/components/views/CommandCenter.tsx`
- [Energy analytics](https://github.com/dhirajminde09/ecosmartx/blob/main/src/components/views/EnergyAnalytics.tsx): `src/components/views/EnergyAnalytics.tsx`
- [Savings simulation](https://github.com/dhirajminde09/ecosmartx/blob/main/src/components/views/SimulationLab.tsx): `src/components/views/SimulationLab.tsx`
- [Digital twin](https://github.com/dhirajminde09/ecosmartx/blob/main/src/components/views/DigitalTwinStudio.tsx): `src/components/views/DigitalTwinStudio.tsx`
- [Reports and audit](https://github.com/dhirajminde09/ecosmartx/blob/main/src/components/views/ReportsAndAudit.tsx): `src/components/views/ReportsAndAudit.tsx`
- [AI copilot](https://github.com/dhirajminde09/ecosmartx/blob/main/src/components/views/GeminiCopilot.tsx): `src/components/views/GeminiCopilot.tsx`
- [Conservation advice](https://github.com/dhirajminde09/ecosmartx/blob/main/src/components/views/ConservationAdvisor.tsx): `src/components/views/ConservationAdvisor.tsx`
- [Other intelligence views](https://github.com/dhirajminde09/ecosmartx/tree/main/src/components/views): `src/components/views`

### Energy intelligence

- [Energy state](https://github.com/dhirajminde09/ecosmartx/blob/main/src/context/EnergyContext.tsx): `src/context/EnergyContext.tsx`
- [Energy calculations](https://github.com/dhirajminde09/ecosmartx/blob/main/src/utils/energyEngine.ts): `src/utils/energyEngine.ts`
- [Sample facilities](https://github.com/dhirajminde09/ecosmartx/blob/main/src/data/seedData.ts): `src/data/seedData.ts`

### Vanilla application

- [Vanilla app driver](https://github.com/dhirajminde09/ecosmartx/blob/main/src/main.js): `src/main.js`
- [Vanilla app state](https://github.com/dhirajminde09/ecosmartx/blob/main/src/state.js): `src/state.js`
- [Vanilla view renderers](https://github.com/dhirajminde09/ecosmartx/blob/main/src/views/views.js): `src/views/views.js`
- [Calendar view](https://github.com/dhirajminde09/ecosmartx/blob/main/src/views/calendarView.js): `src/views/calendarView.js`
- [Calendar service](https://github.com/dhirajminde09/ecosmartx/blob/main/src/services/calendar.js): `src/services/calendar.js`
- [Vanilla calculations](https://github.com/dhirajminde09/ecosmartx/blob/main/src/utils/energyEngine.js): `src/utils/energyEngine.js`
- [SVG icon helper](https://github.com/dhirajminde09/ecosmartx/blob/main/src/utils/icons.js): `src/utils/icons.js`

### External services

- [Firebase auth and data](https://github.com/dhirajminde09/ecosmartx/blob/main/src/services/firebase.js): `src/services/firebase.js`
- **Firebase**
- **Google Calendar**

### Other components

- **Energy manager**

## Connections

- Energy manager → React app shell: uses (evidence: `src/App.tsx`)
- React app shell → Navigation: renders (evidence: `src/App.tsx`)
- React app shell → Energy state: provides state (evidence: `src/App.tsx`)
- React app shell → Energy dashboard: routes to (evidence: `src/App.tsx`)
- React app shell → Facility setup: routes to (evidence: `src/App.tsx`)
- React app shell → Appliance intelligence: routes to (evidence: `src/App.tsx`)
- React app shell → Energy analytics: routes to (evidence: `src/App.tsx`)
- React app shell → Savings simulation: routes to (evidence: `src/App.tsx`)
- React app shell → Digital twin: routes to (evidence: `src/App.tsx`)
- React app shell → Reports and audit: routes to (evidence: `src/App.tsx`)
- React app shell → AI copilot: routes to (evidence: `src/App.tsx`)
- React app shell → Conservation advice: routes to (evidence: `src/App.tsx`)
- Energy state → Energy calculations: calculates metrics (evidence: `src/context/EnergyContext.tsx`)
- Energy state → Sample facilities: loads initial data (evidence: `src/context/EnergyContext.tsx`)
- Appliance intelligence → Energy state: reads energy state (evidence: `src/components/views/ApplianceIntelligence.tsx`)
- Energy dashboard → Energy state: reads energy state (evidence: `src/components/views/CommandCenter.tsx`)
- Facility setup → Energy state: reads energy state (evidence: `src/components/views/FacilitiesAndRooms.tsx`)
- Savings simulation → Energy state: reads energy state (evidence: `src/components/views/SimulationLab.tsx`)
- Digital twin → Energy state: reads energy state (evidence: `src/components/views/DigitalTwinStudio.tsx`)
- Reports and audit → Energy state: reads energy state (evidence: `src/components/views/ReportsAndAudit.tsx`)
- Conservation advice → Energy state: reads energy state (evidence: `src/components/views/ConservationAdvisor.tsx`)
- AI copilot → Energy state: reads energy state (evidence: `src/components/views/GeminiCopilot.tsx`)
- Vanilla app driver → Vanilla app state: uses state (evidence: `src/main.js`)
- Vanilla app driver → Vanilla view renderers: renders views (evidence: `src/main.js`)
- Vanilla app driver → Calendar view: renders calendar (evidence: `src/main.js`)
- Vanilla app state → Vanilla calculations: calculates metrics (evidence: `src/state.js`)
- Vanilla app state → Calendar service: uses calendar (evidence: `src/state.js`)
- Vanilla view renderers → Vanilla calculations: uses calculations (evidence: `src/views/views.js`)
- Vanilla view renderers → SVG icon helper: renders icons (evidence: `src/views/views.js`)
- Calendar view → Vanilla view renderers: uses renderers (evidence: `src/views/calendarView.js`)
- Calendar view → SVG icon helper: renders icons (evidence: `src/views/calendarView.js`)
- Calendar service → Firebase auth and data: uses (evidence: `src/services/calendar.js`)
- Firebase auth and data → Firebase: initializes (evidence: `src/services/firebase.js`)
- Calendar service → Google Calendar: integrates
- Other intelligence views → Energy state: uses shared state (evidence: `src/components/views/OptimizationEngine.tsx`)
