# chinu21123/energyiq--decentralized-smart-energy-optimization-platform architecture

> Architecture diagram of the GitHub repository chinu21123/energyiq--decentralized-smart-energy-optimization-platform, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-02). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/chinu21123/energyiq--decentralized-smart-energy-optimization-platform
- Repository: https://github.com/chinu21123/energyiq--decentralized-smart-energy-optimization-platform

## Overview

EnergyFlow is an energy-community dashboard with account entry, on-chain energy listings, and monitoring/optimization views. The dashboard page dispatches to the trading, anomaly, optimization, self-healing, and profile features; trading uses the Web3 and energy-market helpers, while anomaly-related UI and federated API modules have separate detection paths. The excerpts show local demo state and blockchain-facing helpers, but not how the standalone backend connects to the frontend or chain contracts. Several federated modules and the backend are only partially evidenced, so their unverified links are omitted.

Main entry points: [`app/dashboard/page.tsx`](https://github.com/chinu21123/energyiq--decentralized-smart-energy-optimization-platform/blob/main/app/dashboard/page.tsx) (Dashboard router), [`components/dashboard/energy-trading.tsx`](https://github.com/chinu21123/energyiq--decentralized-smart-energy-optimization-platform/blob/main/components/dashboard/energy-trading.tsx) (Energy trading), [`lib/web3.ts`](https://github.com/chinu21123/energyiq--decentralized-smart-energy-optimization-platform/blob/main/lib/web3.ts) (Web3 wallet), [`app/page.tsx`](https://github.com/chinu21123/energyiq--decentralized-smart-energy-optimization-platform/blob/main/app/page.tsx) (Login)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Account and dashboard"]
  node_login["Login<br/>[page.tsx]"]
  node_signup["Signup<br/>[page.tsx]"]
  node_dashboard["Dashboard router<br/>[page.tsx]"]
  node_profile["Profile<br/>[profile.tsx]"]
end

subgraph group_energy["Energy marketplace"]
  node_trading["Energy trading<br/>[energy-trading.tsx]"]
  node_market["Marketplace helpers<br/>[energy-market.ts]"]
  node_web3["Web3 wallet<br/>[web3.ts]"]
  node_currency["Currency conversion<br/>[currency.ts]"]
end

subgraph group_operations["Grid intelligence"]
  node_anomaly_ui["Anomaly dashboard"]
  node_anomaly_alert["Anomaly alerts<br/>[anomaly-alert.tsx]"]
  node_optimization["Quantum optimization"]
  node_healing["Self-healing<br/>[self-healing.tsx]"]
  node_federated_api["Federated API<br/>[api_server.py]"]
  node_federated_detection["Federated detection"]
  node_federated_client["Federated client<br/>[client.py]"]
  node_data_generator["Data generator<br/>[data_generator.py]"]
  node_federated_server["Federated server<br/>[server.py]"]
end

subgraph group_runtime["Services and state"]
  node_demo_state["Demo state and schemas<br/>[store.ts]"]
  node_backend["Backend API<br/>[main.py]"]
end

node_resident(("Resident"))
node_wallet_service{{"MetaMask"}}

node_resident -->|"signs in"| node_login
node_resident -->|"creates account"| node_signup
node_login -->|"connects wallet"| node_web3
node_login -.->|"routes after login"| node_dashboard
node_web3 -.->|"requests connection"| node_wallet_service
node_dashboard -->|"renders"| node_trading
node_dashboard -->|"renders"| node_anomaly_ui
node_dashboard -->|"renders"| node_optimization
node_dashboard -->|"renders"| node_healing
node_dashboard -->|"renders"| node_profile
node_trading -->|"loads and trades"| node_market
node_trading -->|"connects wallet"| node_web3
node_trading -->|"converts prices"| node_currency
node_market -->|"uses chain utilities"| node_web3
node_anomaly_ui -->|"renders alerts"| node_anomaly_alert
node_anomaly_ui -->|"reads demo data"| node_demo_state
node_optimization -->|"uses demo data"| node_demo_state
node_healing -->|"uses demo data"| node_demo_state
node_federated_api -->|"calls detection"| node_federated_detection
node_federated_client -->|"uses generated data"| node_data_generator

click node_login "https://github.com/chinu21123/energyiq--decentralized-smart-energy-optimization-platform/blob/main/app/page.tsx"
click node_signup "https://github.com/chinu21123/energyiq--decentralized-smart-energy-optimization-platform/blob/main/app/signup/page.tsx"
click node_dashboard "https://github.com/chinu21123/energyiq--decentralized-smart-energy-optimization-platform/blob/main/app/dashboard/page.tsx"
click node_profile "https://github.com/chinu21123/energyiq--decentralized-smart-energy-optimization-platform/blob/main/components/dashboard/profile.tsx"
click node_trading "https://github.com/chinu21123/energyiq--decentralized-smart-energy-optimization-platform/blob/main/components/dashboard/energy-trading.tsx"
click node_market "https://github.com/chinu21123/energyiq--decentralized-smart-energy-optimization-platform/blob/main/lib/energy-market.ts"
click node_web3 "https://github.com/chinu21123/energyiq--decentralized-smart-energy-optimization-platform/blob/main/lib/web3.ts"
click node_currency "https://github.com/chinu21123/energyiq--decentralized-smart-energy-optimization-platform/blob/main/lib/currency.ts"
click node_anomaly_ui "https://github.com/chinu21123/energyiq--decentralized-smart-energy-optimization-platform/blob/main/components/dashboard/anomaly-detection.tsx"
click node_anomaly_alert "https://github.com/chinu21123/energyiq--decentralized-smart-energy-optimization-platform/blob/main/components/dashboard/anomaly-alert.tsx"
click node_optimization "https://github.com/chinu21123/energyiq--decentralized-smart-energy-optimization-platform/blob/main/components/dashboard/quantum-optimization.tsx"
click node_healing "https://github.com/chinu21123/energyiq--decentralized-smart-energy-optimization-platform/blob/main/components/dashboard/self-healing.tsx"
click node_federated_api "https://github.com/chinu21123/energyiq--decentralized-smart-energy-optimization-platform/blob/main/federated/api_server.py"
click node_federated_detection "https://github.com/chinu21123/energyiq--decentralized-smart-energy-optimization-platform/blob/main/federated/anomaly_detection.py"
click node_federated_client "https://github.com/chinu21123/energyiq--decentralized-smart-energy-optimization-platform/blob/main/federated/client.py"
click node_data_generator "https://github.com/chinu21123/energyiq--decentralized-smart-energy-optimization-platform/blob/main/federated/data_generator.py"
click node_federated_server "https://github.com/chinu21123/energyiq--decentralized-smart-energy-optimization-platform/blob/main/federated/server.py"
click node_demo_state "https://github.com/chinu21123/energyiq--decentralized-smart-energy-optimization-platform/blob/main/lib/store.ts"
click node_backend "https://github.com/chinu21123/energyiq--decentralized-smart-energy-optimization-platform/blob/main/backend/main.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_login,node_signup,node_dashboard,node_profile toneBlue
class node_trading,node_market,node_web3,node_currency toneAmber
class node_anomaly_ui,node_anomaly_alert,node_optimization,node_healing,node_federated_api,node_federated_detection,node_federated_client,node_data_generator,node_federated_server toneMint
class node_demo_state,node_backend toneRose
class node_resident,node_wallet_service toneIndigo
```

## Components

### Account and dashboard

- [Login](https://github.com/chinu21123/energyiq--decentralized-smart-energy-optimization-platform/blob/main/app/page.tsx): `app/page.tsx`
- [Signup](https://github.com/chinu21123/energyiq--decentralized-smart-energy-optimization-platform/blob/main/app/signup/page.tsx): `app/signup/page.tsx`
- [Dashboard router](https://github.com/chinu21123/energyiq--decentralized-smart-energy-optimization-platform/blob/main/app/dashboard/page.tsx): `app/dashboard/page.tsx`
- [Profile](https://github.com/chinu21123/energyiq--decentralized-smart-energy-optimization-platform/blob/main/components/dashboard/profile.tsx): `components/dashboard/profile.tsx`

### Energy marketplace

- [Energy trading](https://github.com/chinu21123/energyiq--decentralized-smart-energy-optimization-platform/blob/main/components/dashboard/energy-trading.tsx): `components/dashboard/energy-trading.tsx`
- [Marketplace helpers](https://github.com/chinu21123/energyiq--decentralized-smart-energy-optimization-platform/blob/main/lib/energy-market.ts): `lib/energy-market.ts`
- [Web3 wallet](https://github.com/chinu21123/energyiq--decentralized-smart-energy-optimization-platform/blob/main/lib/web3.ts): `lib/web3.ts`
- [Currency conversion](https://github.com/chinu21123/energyiq--decentralized-smart-energy-optimization-platform/blob/main/lib/currency.ts): `lib/currency.ts`

### Grid intelligence

- [Anomaly dashboard](https://github.com/chinu21123/energyiq--decentralized-smart-energy-optimization-platform/blob/main/components/dashboard/anomaly-detection.tsx): `components/dashboard/anomaly-detection.tsx`
- [Anomaly alerts](https://github.com/chinu21123/energyiq--decentralized-smart-energy-optimization-platform/blob/main/components/dashboard/anomaly-alert.tsx): `components/dashboard/anomaly-alert.tsx`
- [Quantum optimization](https://github.com/chinu21123/energyiq--decentralized-smart-energy-optimization-platform/blob/main/components/dashboard/quantum-optimization.tsx): `components/dashboard/quantum-optimization.tsx`
- [Self-healing](https://github.com/chinu21123/energyiq--decentralized-smart-energy-optimization-platform/blob/main/components/dashboard/self-healing.tsx): `components/dashboard/self-healing.tsx`
- [Federated API](https://github.com/chinu21123/energyiq--decentralized-smart-energy-optimization-platform/blob/main/federated/api_server.py): `federated/api_server.py`
- [Federated detection](https://github.com/chinu21123/energyiq--decentralized-smart-energy-optimization-platform/blob/main/federated/anomaly_detection.py): `federated/anomaly_detection.py`
- [Federated client](https://github.com/chinu21123/energyiq--decentralized-smart-energy-optimization-platform/blob/main/federated/client.py): `federated/client.py`
- [Data generator](https://github.com/chinu21123/energyiq--decentralized-smart-energy-optimization-platform/blob/main/federated/data_generator.py): `federated/data_generator.py`
- [Federated server](https://github.com/chinu21123/energyiq--decentralized-smart-energy-optimization-platform/blob/main/federated/server.py): `federated/server.py`

### Services and state

- [Demo state and schemas](https://github.com/chinu21123/energyiq--decentralized-smart-energy-optimization-platform/blob/main/lib/store.ts): `lib/store.ts`
- [Backend API](https://github.com/chinu21123/energyiq--decentralized-smart-energy-optimization-platform/blob/main/backend/main.py): `backend/main.py`

### Other components

- **Resident**
- **MetaMask**

## Connections

- Resident → Login: signs in (evidence: `app/page.tsx`)
- Resident → Signup: creates account (evidence: `app/signup/page.tsx`)
- Login → Web3 wallet: connects wallet (evidence: `app/page.tsx`)
- Login → Dashboard router: routes after login
- Web3 wallet → MetaMask: requests connection
- Dashboard router → Energy trading: renders (evidence: `app/dashboard/page.tsx`)
- Dashboard router → Anomaly dashboard: renders (evidence: `app/dashboard/page.tsx`)
- Dashboard router → Quantum optimization: renders (evidence: `app/dashboard/page.tsx`)
- Dashboard router → Self-healing: renders (evidence: `app/dashboard/page.tsx`)
- Dashboard router → Profile: renders (evidence: `app/dashboard/page.tsx`)
- Energy trading → Marketplace helpers: loads and trades (evidence: `components/dashboard/energy-trading.tsx`)
- Energy trading → Web3 wallet: connects wallet (evidence: `components/dashboard/energy-trading.tsx`)
- Energy trading → Currency conversion: converts prices (evidence: `components/dashboard/energy-trading.tsx`)
- Marketplace helpers → Web3 wallet: uses chain utilities (evidence: `lib/energy-market.ts`)
- Anomaly dashboard → Anomaly alerts: renders alerts (evidence: `components/dashboard/anomaly-detection.tsx`)
- Anomaly dashboard → Demo state and schemas: reads demo data (evidence: `components/dashboard/anomaly-detection.tsx`)
- Quantum optimization → Demo state and schemas: uses demo data (evidence: `components/dashboard/quantum-optimization.tsx`)
- Self-healing → Demo state and schemas: uses demo data (evidence: `components/dashboard/self-healing.tsx`)
- Federated API → Federated detection: calls detection (evidence: `federated/api_server.py`)
- Federated client → Data generator: uses generated data (evidence: `federated/client.py`)
