How nidhishshanmuganathan-cmd/electricity-proj works
WattWatcher is an energy-monitoring product: users authenticate, register or select a meter, and view readings, usage summaries, forecasts, estimated bills, history, and alerts. The frontend presents these workflows and calls a FastAPI backend; the backend authenticates requests, stores meter and usage data, aggregates readings, predicts usage, and sends notifications. The graph includes documented UI, API, and service relationships; unsampled integrations and components are not assigned speculative call paths.
Main entry points: App.jsx App routing · readings.py Reading endpoints · api.js API client · users.py User endpoints
Components 32
Web application
- App routing
frontend/src/App.jsx - Client auth state
frontend/src/AuthContext.jsx - API client
frontend/src/api.js - Sign-in and signup
frontend/src/components/SignIn.jsx - Account creation
frontend/src/components/CreateAccount.jsx - Usage dashboard
frontend/src/components/HomeDashboard.jsx - Usage analysis
frontend/src/components/Analysis.jsx - Bill estimation
frontend/src/components/BillEstimation.jsx - Usage history
frontend/src/components/History.jsx - Profile settings
frontend/src/components/Profile.jsx - UPI payment
frontend/src/components/UpiPayment.jsx - Language and units
frontend/src/utils/translate.js - Push client
frontend/src/notifications.js
Backend API
- User endpoints
backend/app/routes/users.py - Device endpoints
backend/app/routes/devices.py - Reading endpoints
backend/app/routes/readings.py - Simulation endpoints
backend/app/routes/simulation.py
Energy services
- Usage aggregation
backend/app/services/aggregation.py - Usage prediction
backend/app/services/prediction.py - Usage alerts
backend/app/services/alerts.py - Notification service
backend/app/services/notifications.py - FCM delivery
backend/app/services/fcm.py
Identity and storage
- Token verification
backend/app/auth.py - User records
backend/app/models/user.py - Device records
backend/app/models/device.py - Meter readings
backend/app/models/reading.py - Usage records
backend/app/models/usage.py - SQL database
backend/app/database.py
Other components
- Energy user
- Energy meter
- Firebase Admin
backend/app/firebase.py - Firebase services
Connections 48
- Energy user → App routing: uses
frontend/src/App.jsx - App routing → Client auth state: provides auth
frontend/src/App.jsx - App routing → Sign-in and signup: routes to
frontend/src/App.jsx - App routing → Account creation: routes to
frontend/src/App.jsx - App routing → Usage dashboard: routes to
frontend/src/App.jsx - App routing → Usage analysis: routes to
frontend/src/App.jsx - App routing → Bill estimation: routes to
frontend/src/App.jsx - App routing → Usage history: routes to
frontend/src/App.jsx - App routing → Profile settings: routes to
frontend/src/App.jsx - App routing → UPI payment: routes to
frontend/src/App.jsx - Client auth state → API client: syncs user
frontend/src/AuthContext.jsx - Client auth state → Firebase services: observes sign-in
frontend/src/AuthContext.jsx - Sign-in and signup → Firebase services: authenticates with
- Account creation → API client: calls
frontend/src/components/CreateAccount.jsx - Usage dashboard → API client: loads usage
frontend/src/components/HomeDashboard.jsx - Usage dashboard → Language and units: localizes
frontend/src/components/HomeDashboard.jsx - Usage analysis → API client: loads analysis
frontend/src/components/Analysis.jsx - Usage analysis → Language and units: localizes
frontend/src/components/Analysis.jsx - Usage history → API client: loads history
frontend/src/components/History.jsx - Profile settings → API client: updates profile
frontend/src/components/Profile.jsx - Profile settings → Push client: configures push
frontend/src/components/Profile.jsx - API client → User endpoints: requests user data
frontend/src/api.js - API client → Device endpoints: requests devices
frontend/src/api.js - API client → Reading endpoints: requests readings
frontend/src/api.js - Energy meter → Reading endpoints: posts readings
backend/app/routes/readings.py - Reading endpoints → Token verification: verifies user
backend/app/routes/readings.py - User endpoints → Token verification: verifies user
backend/app/routes/users.py - Device endpoints → Token verification: verifies user
backend/app/routes/devices.py - Simulation endpoints → Token verification: verifies user
backend/app/routes/simulation.py - Token verification → Firebase Admin: verifies token
backend/app/auth.py - User endpoints → User records: reads and writes
backend/app/routes/users.py - Device endpoints → Device records: reads and writes
backend/app/routes/devices.py - Reading endpoints → Device records: checks ownership
backend/app/routes/readings.py - Reading endpoints → Meter readings: reads and writes
backend/app/routes/readings.py - Reading endpoints → Usage records: reads usage
backend/app/routes/readings.py - Reading endpoints → Usage aggregation: aggregates data
backend/app/routes/readings.py - Reading endpoints → Usage prediction: predicts usage
backend/app/routes/readings.py - Reading endpoints → Notification service: checks alerts
backend/app/routes/readings.py - User endpoints → Usage alerts: gets alert status
backend/app/routes/users.py - User endpoints → Notification service: requests notification
backend/app/routes/users.py - Simulation endpoints → Notification service: checks usage
backend/app/routes/simulation.py - Usage aggregation → Usage records: updates aggregates
backend/app/services/aggregation.py - Usage aggregation → Meter readings: reads readings
backend/app/services/aggregation.py - Usage alerts → Usage prediction: uses forecasts
backend/app/services/alerts.py - Notification service → Usage alerts: checks alert state
backend/app/services/notifications.py - Notification service → FCM delivery: sends push
backend/app/services/notifications.py - Push client → Firebase services: uses messaging
frontend/src/notifications.js - User records → SQL database: persists in
backend/app/models/user.py