DEV Community

Afreen Hossain
Afreen Hossain

Posted on

Energy Leak Scout: Find the Waste. Cut the Bill.

DEV Weekend Challenge: Earth Day

This is a submission for Weekend Challenge: Earth Day Edition

What I Built

Energy Leak Scout: Track Every Watt, Save Every Month.
Energy Leak Scout is a Flutter + Node.js app that helps users understand daily home energy usage and reduce waste.
Users enter appliance runtime (hours/day), view estimated electricity usage and trends, and get AI-generated explanations for high consumption with practical tips.

My goal was to make Earth Day impact personal and measurable by converting behavior into clear energy, cost, and carbon insights.

Demo

Code

Energy Leak Scout

Energy Leak Scout is an Earth Day themed full-stack app that helps users understand and reduce household electricity use.

The app lets users log in, enter daily appliance usage (hours/day), and instantly see estimated energy impact in kWh, cost, and CO2. It also provides AI-assisted explanations for high consumption and practical savings recommendations.

What This App Means

This project is about turning abstract energy data into everyday action.

  • Awareness: makes hidden energy waste visible.
  • Action: gives clear recommendations users can follow immediately.
  • Impact: links personal behavior to cost savings and lower emissions.

Core Flow

  1. User logs in with Auth0.
  2. User enters appliance usage (hours/day).
  3. App calculates estimated usage and insights.
  4. User taps Why high?
  5. Backend verifies Auth0 token, then asks Cohere for a concise explanation.
  6. App displays explanation plus practical tips.

Tech Stack

  • Flutter (frontend)
  • Node.js + Express (backend)
  • Auth0 (authentication and API protection)
  • Cohere (AI explanation…

How I Built It

I designed Energy Leak Scout as a practical user journey, not just a dashboard. The goal was to help a user move from "I think my bill is high" to "I know exactly what to reduce this week."

Was fun building this, learned about Auth0 and how to integrate/implement it in the project! Though didn't integrate Backboard, did check out its docs and understood how to use it!

User Walkthrough

  • Open app and authenticate

    • The user starts in Flutter and signs in with Auth0.
    • A secure access token is issued after login.
    • That token is stored in app state and attached to backend API calls.
  • Add appliance usage in simple language

    • The user enters daily runtime in hours for common appliances like AC, Fan, Fridge, and TV.
    • The UI also supports adding custom appliances, so the app works for real homes with different devices.
  • View instant energy impact

    • As soon as usage is entered, the app converts hours/day into kWh/day.
    • The user sees total consumption, top contributors, and chart-based trends.
    • Additional insights include estimated monthly energy use, CO2 impact, and cost signals.
  • Ask for explanation when usage feels high

    • The user taps "Why high?" to get a plain-language explanation.
    • This triggers a secure backend call (token-protected) that prepares a concise appliance summary and sends it to Cohere.
  • Receive practical savings actions

    • The response returns short, actionable tips (for example reducing AC runtime or adjusting setpoint behavior).
    • Recommendations are designed to be easy to apply immediately, not generic sustainability advice.
  • Continue tracking progress

    • The user can update inputs daily and monitor trend changes.
    • This creates a small behavior loop: measure, understand, act, and improve.

Technical Build Details

  • Flutter frontend for interactive UI, charts, and appliance usage input.

    • Built the client in Flutter for one codebase across platforms.
    • Added chart visualizations and summary cards so users can quickly identify which devices drive most consumption.
  • Node.js + Express backend for secure API routes.

    • Implemented a lightweight Express API with clear endpoints for health, usage, insights, and "why-high" reasoning.
    • Added reusable calculation helpers for totals, rankings, category splits, trends, recommendations, and eco score outputs.
  • Auth0 JWT protection for usage and insights endpoints.

    • Protected key routes with Auth0 JWT validation via JWKS (express-jwt + jwks-rsa).
    • Enforced expected audience and issuer so only valid tokens from the configured Auth0 tenant are accepted.
  • Cohere integration for concise energy explanations.

    • Added Cohere chat generation on the backend so prompts and API keys stay server-side.
    • Constructed prompts from actual appliance usage totals and top contributors to keep responses grounded in user data.
    • Tuned response style for short, practical guidance instead of long-form AI output.
  • Local fallback logic to keep the app useful even when AI credentials are unavailable.

    • If COHERE_API_KEY is missing or the upstream call fails, backend automatically returns a local explanation plus tips.
    • Fallback logic is rule-based from appliance usage patterns, so the user still receives meaningful guidance.
    • This improves reliability for demos, first-time setup, and offline/dev scenarios.

Prize Categories

Best Use of Auth0 for Agents, Best Use of Google Gemini, Best Use of GitHub Copilot

Top comments (0)