# piyush0108maurya/ecosense architecture

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

- Interactive diagram: https://gitdiagram.com/piyush0108maurya/ecosense
- Repository: https://github.com/piyush0108maurya/ecosense

## Overview

EcoSense is an environmental-awareness and community-action web app. Users enter through the landing page, authenticate, then navigate air-quality monitoring, waste guidance, community waste reporting, and a dashboard; activity can earn points and streaks. The graph includes documented AI chat and gamification capabilities. Source excerpts are partial, so unsampled module details and relationships are omitted unless supported by the SOURCE INDEX.

Main entry points: [`src/App.jsx`](https://github.com/piyush0108maurya/ecosense/blob/main/src/App.jsx) (App shell), [`src/services/firebase.js`](https://github.com/piyush0108maurya/ecosense/blob/main/src/services/firebase.js) (Firebase services), [`src/services/gamification.js`](https://github.com/piyush0108maurya/ecosense/blob/main/src/services/gamification.js) (Rewards engine), [`src/components/Landing/Landing.jsx`](https://github.com/piyush0108maurya/ecosense/blob/main/src/components/Landing/Landing.jsx) (Landing page)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["App experience"]
  node_app["App shell<br/>[App.jsx]"]
  node_landing["Landing page<br/>[Landing.jsx]"]
  node_navigation["Side navigation<br/>[SideNav.jsx]"]
  node_dashboard["Impact dashboard<br/>[DashboardTab.jsx]"]
  node_logo["Brand mark<br/>[Logo.jsx]"]
end

subgraph group_environment["Environmental tools"]
  node_aqi["Air quality monitor<br/>[AQI.jsx]"]
  node_wasteguide["Waste guide<br/>[WasteGuide.jsx]"]
  node_collectors["Collector registry<br/>[collectors.js]"]
end

subgraph group_community["Community action"]
  node_neighbour["Community waste map<br/>[NeighbourWaste.jsx]"]
end

subgraph group_identity["Identity and state"]
  node_authscreen["Sign-in screen<br/>[AuthScreen.jsx]"]
  node_firebase["Firebase services<br/>[firebase.js]"]
  node_localdb[("Local user cache<br/>[db.js]")]
end

subgraph group_intelligence["AI and rewards"]
  node_api["AQI and Gemini API<br/>[api.js]"]
  node_chat["Lumi chat<br/>[LumiChat.jsx]"]
  node_spirit["Lumi spirit<br/>[LumiSpirit.jsx]"]
  node_gamification["Rewards engine<br/>[gamification.js]"]
  node_achievement["Achievement display<br/>[Achievement.jsx]"]
  node_points["Points progress<br/>[PointsProgress.jsx]"]
end

node_visitor(("Visitor"))
node_firestore[("Firestore")]

node_visitor -->|"opens"| node_landing
node_landing -->|"starts"| node_app
node_app -->|"renders"| node_authscreen
node_authscreen -->|"authenticates"| node_firebase
node_app -->|"loads account"| node_firebase
node_firebase -->|"reads and writes"| node_firestore
node_app -->|"caches user"| node_localdb
node_app -->|"renders"| node_navigation
node_app -->|"routes to"| node_aqi
node_aqi -->|"fetches AQI"| node_api
node_app -->|"routes to"| node_wasteguide
node_wasteguide -->|"finds collectors"| node_collectors
node_wasteguide -->|"uses cache"| node_localdb
node_app -->|"routes to"| node_neighbour
node_neighbour -->|"loads and adds pins"| node_firebase
node_app -->|"routes to"| node_dashboard
node_dashboard -->|"reads reward logic"| node_gamification
node_chat -->|"requests responses"| node_api
node_spirit -->|"requests responses"| node_api
node_localdb -->|"calculates activity"| node_gamification
node_firebase -->|"calculates rewards"| node_gamification
node_points -->|"shows progress"| node_gamification
node_landing -->|"renders"| node_logo
node_navigation -->|"renders"| node_logo

click node_app "https://github.com/piyush0108maurya/ecosense/blob/main/src/App.jsx"
click node_landing "https://github.com/piyush0108maurya/ecosense/blob/main/src/components/Landing/Landing.jsx"
click node_navigation "https://github.com/piyush0108maurya/ecosense/blob/main/src/components/common/SideNav.jsx"
click node_authscreen "https://github.com/piyush0108maurya/ecosense/blob/main/src/components/UI/AuthScreen.jsx"
click node_firebase "https://github.com/piyush0108maurya/ecosense/blob/main/src/services/firebase.js"
click node_localdb "https://github.com/piyush0108maurya/ecosense/blob/main/src/services/db.js"
click node_aqi "https://github.com/piyush0108maurya/ecosense/blob/main/src/components/Tabs/AQI.jsx"
click node_api "https://github.com/piyush0108maurya/ecosense/blob/main/src/services/api.js"
click node_wasteguide "https://github.com/piyush0108maurya/ecosense/blob/main/src/components/Tabs/WasteGuide.jsx"
click node_collectors "https://github.com/piyush0108maurya/ecosense/blob/main/src/services/collectors.js"
click node_neighbour "https://github.com/piyush0108maurya/ecosense/blob/main/src/components/Tabs/NeighbourWaste.jsx"
click node_dashboard "https://github.com/piyush0108maurya/ecosense/blob/main/src/components/Tabs/DashboardTab.jsx"
click node_chat "https://github.com/piyush0108maurya/ecosense/blob/main/src/components/Tabs/LumiChat.jsx"
click node_spirit "https://github.com/piyush0108maurya/ecosense/blob/main/src/components/common/LumiSpirit.jsx"
click node_gamification "https://github.com/piyush0108maurya/ecosense/blob/main/src/services/gamification.js"
click node_achievement "https://github.com/piyush0108maurya/ecosense/blob/main/src/components/UI/Achievement.jsx"
click node_points "https://github.com/piyush0108maurya/ecosense/blob/main/src/components/common/PointsProgress.jsx"
click node_logo "https://github.com/piyush0108maurya/ecosense/blob/main/src/components/common/Logo.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_app,node_landing,node_navigation,node_dashboard,node_logo toneBlue
class node_aqi,node_wasteguide,node_collectors,node_firestore toneAmber
class node_neighbour toneMint
class node_authscreen,node_firebase,node_localdb toneRose
class node_api,node_chat,node_spirit,node_gamification,node_achievement,node_points,node_visitor toneIndigo
```

## Components

### App experience

- [App shell](https://github.com/piyush0108maurya/ecosense/blob/main/src/App.jsx): `src/App.jsx`
- [Landing page](https://github.com/piyush0108maurya/ecosense/blob/main/src/components/Landing/Landing.jsx): `src/components/Landing/Landing.jsx`
- [Side navigation](https://github.com/piyush0108maurya/ecosense/blob/main/src/components/common/SideNav.jsx): `src/components/common/SideNav.jsx`
- [Impact dashboard](https://github.com/piyush0108maurya/ecosense/blob/main/src/components/Tabs/DashboardTab.jsx): `src/components/Tabs/DashboardTab.jsx`
- [Brand mark](https://github.com/piyush0108maurya/ecosense/blob/main/src/components/common/Logo.jsx): `src/components/common/Logo.jsx`

### Environmental tools

- [Air quality monitor](https://github.com/piyush0108maurya/ecosense/blob/main/src/components/Tabs/AQI.jsx): `src/components/Tabs/AQI.jsx`
- [Waste guide](https://github.com/piyush0108maurya/ecosense/blob/main/src/components/Tabs/WasteGuide.jsx): `src/components/Tabs/WasteGuide.jsx`
- [Collector registry](https://github.com/piyush0108maurya/ecosense/blob/main/src/services/collectors.js): `src/services/collectors.js`

### Community action

- [Community waste map](https://github.com/piyush0108maurya/ecosense/blob/main/src/components/Tabs/NeighbourWaste.jsx): `src/components/Tabs/NeighbourWaste.jsx`

### Identity and state

- [Sign-in screen](https://github.com/piyush0108maurya/ecosense/blob/main/src/components/UI/AuthScreen.jsx): `src/components/UI/AuthScreen.jsx`
- [Firebase services](https://github.com/piyush0108maurya/ecosense/blob/main/src/services/firebase.js): `src/services/firebase.js`
- [Local user cache](https://github.com/piyush0108maurya/ecosense/blob/main/src/services/db.js): `src/services/db.js`

### AI and rewards

- [AQI and Gemini API](https://github.com/piyush0108maurya/ecosense/blob/main/src/services/api.js): `src/services/api.js`
- [Lumi chat](https://github.com/piyush0108maurya/ecosense/blob/main/src/components/Tabs/LumiChat.jsx): `src/components/Tabs/LumiChat.jsx`
- [Lumi spirit](https://github.com/piyush0108maurya/ecosense/blob/main/src/components/common/LumiSpirit.jsx): `src/components/common/LumiSpirit.jsx`
- [Rewards engine](https://github.com/piyush0108maurya/ecosense/blob/main/src/services/gamification.js): `src/services/gamification.js`
- [Achievement display](https://github.com/piyush0108maurya/ecosense/blob/main/src/components/UI/Achievement.jsx): `src/components/UI/Achievement.jsx`
- [Points progress](https://github.com/piyush0108maurya/ecosense/blob/main/src/components/common/PointsProgress.jsx): `src/components/common/PointsProgress.jsx`

### Other components

- **Visitor**
- **Firestore**

## Connections

- Visitor → Landing page: opens (evidence: `src/components/Landing/Landing.jsx`)
- Landing page → App shell: starts (evidence: `src/components/Landing/Landing.jsx`)
- App shell → Sign-in screen: renders (evidence: `src/App.jsx`)
- Sign-in screen → Firebase services: authenticates (evidence: `src/components/UI/AuthScreen.jsx`)
- App shell → Firebase services: loads account (evidence: `src/App.jsx`)
- Firebase services → Firestore: reads and writes (evidence: `src/services/firebase.js`)
- App shell → Local user cache: caches user (evidence: `src/App.jsx`)
- App shell → Side navigation: renders (evidence: `src/App.jsx`)
- App shell → Air quality monitor: routes to (evidence: `src/App.jsx`)
- Air quality monitor → AQI and Gemini API: fetches AQI (evidence: `src/components/Tabs/AQI.jsx`)
- App shell → Waste guide: routes to (evidence: `src/App.jsx`)
- Waste guide → Collector registry: finds collectors (evidence: `src/components/Tabs/WasteGuide.jsx`)
- Waste guide → Local user cache: uses cache (evidence: `src/components/Tabs/WasteGuide.jsx`)
- App shell → Community waste map: routes to (evidence: `src/App.jsx`)
- Community waste map → Firebase services: loads and adds pins (evidence: `src/components/Tabs/NeighbourWaste.jsx`)
- App shell → Impact dashboard: routes to (evidence: `src/App.jsx`)
- Impact dashboard → Rewards engine: reads reward logic (evidence: `src/components/Tabs/DashboardTab.jsx`)
- Lumi chat → AQI and Gemini API: requests responses (evidence: `src/components/Tabs/LumiChat.jsx`)
- Lumi spirit → AQI and Gemini API: requests responses (evidence: `src/components/common/LumiSpirit.jsx`)
- Local user cache → Rewards engine: calculates activity (evidence: `src/services/db.js`)
- Firebase services → Rewards engine: calculates rewards (evidence: `src/services/firebase.js`)
- Points progress → Rewards engine: shows progress (evidence: `src/components/common/PointsProgress.jsx`)
- Landing page → Brand mark: renders (evidence: `src/components/Landing/Landing.jsx`)
- Side navigation → Brand mark: renders (evidence: `src/components/common/SideNav.jsx`)
