DEV Community

Dickson Kanyingi
Dickson Kanyingi

Posted on

EcoOS Intelligence: Reimagining Sustainability with AI

DEV Weekend Challenge: Earth Day

This is a submission for Weekend Challenge: Earth Day Edition

What I Built

What if every daily decision showed its carbon cost before you made it?

Built for the DEV Earth Day Challenge, EcoOS Intelligence is a real-time, AI-powered system that transforms sustainability from abstract awareness into clear, measurable action.

Instead of static calculators, EcoOS acts as a behavioral operating system for climate actionβ€”helping users understand, simulate, and improve their impact across everyday life.

⚑ What Makes This Different?

Most climate tools tell you what happened.

EcoOS shows you what will happen before you act.

  • 🧠 AI reasoning engine β†’ breaks down lifestyle into real COβ‚‚ impact
  • 🎯 What-if simulator β†’ test decisions before committing
  • πŸ’¬ Personal AI coach β†’ adapts to your behavior over time
  • ♻️ Image-based waste analysis β†’ classify real-world waste instantly
  • πŸ† Gamified system β†’ turns sustainability into daily action

πŸ‘‰ This is not a tracker. It's a decision-making system.


🧩 The Problem

People care about sustainabilityβ€”but don't act consistently.

Why?

  • Data is complex and hard to interpret
  • Tools are passive (no feedback loop)
  • Advice is generic and not personalized
  • Impact is invisible in daily decisions

πŸ‘‰ The gap isn't awarenessβ€”it's actionability.


πŸ’‘ The Solution: EcoOS Intelligence

EcoOS is a modular ecosystem focused on turning intention into action across the most impactful areas of personal sustainability:

🌱 Carbon Mirror β€” The Intelligence Engine

Describe your lifestyle in plain English. Gemini performs multi-step reasoning:

  1. Decomposition β€” Parse activities into discrete categories
  2. Category Scoring β€” Estimate COβ‚‚ using established emission factors
  3. Synthesis β€” Compute confidence-weighted totals
  4. Recommendations β€” Generate prioritized, quantified action plans
  5. JSON Schema Validation β€” 6 custom validators ensure structured, type-safe responses
  6. Multi-Platform Sharing β€” Share results to X/Twitter, Facebook, LinkedIn, or copy for Instagram & TikTok

🎯 What-If Simulator β€” The "Wow" Feature

Ask "What if I stop using Uber for a month?" and get:

  • Timeline projections (1 month, 6 months, 1 year)
  • Money saved alongside COβ‚‚ saved
  • Tangible equivalences (trees, flights, driving distance)
  • Community scale β€” "If 10,000 people did this..."

πŸ’¬ Carbon Coach β€” Your AI Advisor

A conversational AI that remembers your history:

  • Knows your eco-score, past analyses, completed quests
  • Gives realistic, specific advice β€” not generic platitudes
  • Persists conversations across sessions
  • Adjusts your eco-score based on engagement

πŸ† Eco-Quest β€” The Behavior Engine

AI-generated daily challenges that adapt to what you've already done:

  • Never repeats previously completed quests
  • Every mission includes quantified impact metrics
  • Points system feeds into your overall sustainability grade

♻️ WasteWise Vision (The "WOW" Multi-Modal Feature)

Image-based waste classification powered by Gemini 2.0 Flash's visual reasoning.

  • Upload or drag-and-drop a photo of your waste.
  • Gemini visually decomposes the materials, checks for contamination, and provides the exact disposal category.

πŸš— EcoRoute

Transport optimization comparing 9 modes (Car, EV, Motorcycle, Bus, Train, Bike, Walk, Plane, Boat) with annual projections and community scale impact.


Demo

πŸ“Έ Visual Walkthrough

Feature Screenshot
🌱 Carbon Mirror β€” AI analyzes your lifestyle Carbon Mirror
🎯 What-If Simulator β€” See impact before you act What-If
♻️ WasteWise β€” Image-based classification WasteWise
πŸš— EcoRoute β€” 9-mode transport comparison EcoRoute
πŸ’¬ Carbon Coach β€” Personalized AI advisor Carbon Coach
πŸ“Š Dashboard β€” Your sustainability command center Dashboard

πŸŽ₯ Quick Demo Flow (2 minutes)

  1. Carbon Mirror β†’ Describe your lifestyle β†’ watch real-time breakdown
  2. What-If Simulator β†’ "What if I stop using Uber for a month?" β†’ see yearly impact
  3. Carbon Coach β†’ Ask anything β†’ get personalized advice
  4. WasteWise β†’ Upload an image β†’ get disposal guidance
  5. Dashboard β†’ See your eco-score evolve

πŸ‘‰ Full flow takes under 2 minutes.


Code


How I Built It

🧠 Best Use of Google Gemini: Built for Reliability

For a tool like EcoOS, speed and reliability are everything. We built a production-grade AI reasoning engine with multi-layered resilience β€” not just a chat wrapper.

1. Structured JSON Mode

Every response uses responseMimeType: "application/json" for 100% reliable UI rendering:

{
  "estimate": 245,
  "confidence": "medium",
  "breakdown": [
    { "category": "Transport", "value": 120, "detail": "Daily 20km commute" },
    { "category": "Food", "value": 75, "detail": "Occasional meat consumption" }
  ],
  "suggestions": [
    "Switch to public transit 3 days/week β€” saves ~48kg CO2/month",
    "Adopt plant-based meals on weekdays β€” saves ~35kg CO2/month"
  ]
}
Enter fullscreen mode Exit fullscreen mode

2. Multi-Step Reasoning (Chain-of-Thought)

Every prompt follows a structured pipeline, not a simple "input β†’ output":

STEP 1 β€” DECOMPOSITION: Parse input into categories
STEP 2 β€” SCORING: Estimate using emission factors
STEP 3 β€” SYNTHESIS: Confidence-weighted totals
STEP 4 β€” RECOMMENDATIONS: Prioritized by impact
Enter fullscreen mode Exit fullscreen mode

3. Response Validation & Reliability

  • 6 custom validators ensure every response has correct structure
  • Numeric sanitization prevents NaN/undefined from reaching the UI
  • Retry with exponential backoff before graceful mock fallback
  • 12-second timeout prevents UI hangs on slow networks

4. Personalization Engine

The system adapts over time:

  • Stores carbon history, waste scans, quest completions, coach topics
  • Injects user context into every AI prompt
  • Quest generator explicitly avoids repeating past challenges
  • Coach references your previous analyses in conversation

5. Model Cascade with Automatic Failover

Production resilience through tiered fallback when quotas are hit:

Gemini 2.5-flash (primary) β†’ Gemini 2.0-flash (fallback) β†’ Intelligent Mock (offline)
Enter fullscreen mode Exit fullscreen mode

6. Request Optimization

Performance optimizations for scale and cost-efficiency:

  • In-memory caching: 5-minute TTL eliminates redundant API calls for identical inputs
  • Token usage logging: Cost monitoring for every API call

7. Circuit Breaker Pattern

Quota protection prevents cascade failures:

  • Automatic detection of rate limit (429) errors
  • 5-minute cooldown after 2+ quota errors
  • Graceful degradation to intelligent mock responses without user interruption

8. Mock Fallback System

Even without an API key, the entire app remains functional with intelligent mock data that matches the exact JSON schema β€” perfect for offline demos and development.


πŸ§ͺ Built for Real-World Constraints

EcoOS is designed to work even under API limits:

  • Works without an API key (intelligent fallback system)
  • Handles rate limits gracefully (circuit breaker)
  • Prevents UI failures with strict JSON validation
  • Optimized for low-cost, high-efficiency AI usage

πŸ‘‰ This ensures reliability in real-world conditionsβ€”not just ideal demos.


πŸ§ͺ Testing & Quality Assurance

  • 10 test files with 51+ tests covering validators, sanitization, and UI components
  • Response validation tests ensure Gemini JSON schema compliance
  • Mock fallback tests verify 100% offline functionality
  • Vitest + React Testing Library for fast, reliable test execution

🎨 Design Strategy: Premium Sustainability

We avoided the "clinical" look of traditional carbon tools. Instead, we built a high-end, dark-mode experience:

  • Animated SVG Ring Score β€” real-time eco-grade with glow effects
  • Glassmorphism β€” translucent cards with backdrop blur
  • Framer Motion β€” spring animations, staggered reveals, page transitions
  • Custom Slider β€” gradient thumb with glow shadow
  • Micro-Interactions β€” points popup, toast notifications, pulsing badges
  • Outfit + Inter fonts β€” modern, premium typography

πŸŽ₯ Demo Flow

  1. Dashboard β†’ See the animated ring score and live community feed
  2. Carbon Mirror β†’ Describe your lifestyle β†’ Watch the breakdown animate
  3. What-If β†’ Try "What if I go vegetarian?" β†’ See yearly projections
  4. Coach β†’ Notice it says "I already know your history" β†’ Get personalized advice
  5. Dashboard β†’ Your eco-score has increased ✨

🌍 Impact

Metric Per User At Scale (10K users)
COβ‚‚ Awareness Instant footprint visibility 245,000 kg COβ‚‚ analyzed/month
Behavior Change Personalized action plans 10,000+ daily eco-quests
Decision Support What-if before you commit Collective behavior shift

πŸš€ Future Vision

  • City-level integrations β€” aggregate neighborhood sustainability data
  • Carbon credit marketplace β€” earn real credits from verified behavior changes
  • Smart home integration β€” automated energy tracking via IoT
  • Corporate partnerships β€” employee sustainability programs

Built with πŸ’š for the planet.

Prize Categories

  • Best use of Google Gemini
    • Why Gemini 2.5 Flash? It's fast, cost-effective, and perfect for real-time interactions. The AI Magic behind the scenes makes it feel alive and responsive.

#devchallenge #earthday #gemini #sustainability #nextjs #ai

Top comments (0)