Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

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 generation)

Project Structure

Flutter Setup

Install Flutter dependencies:

flutter pub get

Run with environment values:

flutter run \
  --dart-define=AUTH0_DOMAIN=your-tenant.auth0.com \
  --dart-define=AUTH0_CLIENT_ID=your-auth0-client-id \
  --dart-define=AUTH0_AUDIENCE=https://api.energy \
  --dart-define=BACKEND_BASE_URL=http://localhost:8000

Android emulator note:

  • Use http://10.0.2.2:8000 for BACKEND_BASE_URL.

Auth0 Requirements

Create these in Auth0:

  1. Application type: Native (and/or SPA for web testing).
  2. API Identifier: https://api.energy.
  3. Callback and logout URLs for your platform(s) (for example local web URL).
  4. Keep domain/client ID/audience consistent across Flutter and backend.

Backend Setup (Node.js)

From the backend folder:

cd backend
npm install

This creates backend/node_modules locally. Do not commit this folder.

Create local environment file:

# Windows PowerShell
Copy-Item .env.example .env

# macOS/Linux
# cp .env.example .env

Then edit .env with your values:

  • PORT (default: 8000)
  • AUTH0_DOMAIN (example: your-tenant.auth0.com)
  • AUTH0_AUDIENCE (example: https://api.energy)
  • COHERE_API_KEY
  • COHERE_MODEL (default: command-r-08-2024)

Start backend:

npm run dev

Health check:

curl http://localhost:8000/health

If COHERE_API_KEY is missing or Cohere fails, backend automatically returns a local fallback explanation and tips so the app still works.

Notes on .env and node_modules

  • backend/.env is machine-local and should stay out of version control.
  • node_modules is generated by npm install and should not be committed.
  • Keep backend/.env.example committed so teammates know required variables.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages