This is a submission for Weekend Challenge: Earth Day Edition
What I Built
EcoMind is a Next.js web application powered by the Google Gemini API that helps users understand and reduce their personal carbon footprint. You describe your daily habits — commute, diet, home energy use, shopping patterns — and Gemini analyzes your lifestyle, estimates your CO₂ impact, and returns a personalized action plan with concrete steps ranked by impact.
The goal was to make environmental awareness feel personal and actionable rather than abstract. Most carbon calculators spit out a number and leave you wondering "so what?" EcoMind closes that gap by combining Gemini's reasoning capabilities with structured output parsing to give context-aware recommendations tailored to your actual situation.
Key features:
- Conversational input: Describe your habits in plain language — no rigid forms
-
Gemini-powered analysis: Uses
gemini-1.5-flashto parse lifestyle data, estimate emissions, and generate recommendations - Structured JSON output: Forced JSON schema response from Gemini for reliable rendering
- Actionable breakdown: Each recommendation shows estimated CO₂ savings per year
- Finland-aware context: Recommendations factor in northern European energy mix and public transit infrastructure
Demo
🔗 Live demo: https://ecomind-coral.vercel.app
You can also run it locally — instructions in the README.
Code
mzunain
/
ecomind
AI-powered carbon footprint analyzer using Google Gemini - DEV Weekend Challenge Earth Day Edition
EcoMind 🌍
AI-powered carbon footprint analyzer using Google Gemini
Built for the DEV Weekend Challenge: Earth Day Edition
Live Demo
🔗 https://ecomind-gamma.vercel.app
What It Does
EcoMind lets you describe your daily lifestyle in plain language and returns a personalised carbon footprint analysis powered by the Google Gemini API. No rigid forms — just describe your commute, diet, home heating, and travel habits, and get back:
- Estimated annual CO₂ in kg
- Sustainability score (1–10)
- Top 5 reduction actions ranked by impact with CO₂ savings per year
- Regional context — advice tailored to your location (Finland-aware by default)
Tech Stack
- Next.js 14 (App Router) + TypeScript
-
Google Gemini API (
gemini-1.5-flash) via@google/generative-ai -
Structured JSON output using Gemini's
responseSchemafeature - Tailwind CSS for styling
- Vercel for deployment
Getting Started
# Clone the repo
git clone https://github.com/mzunain/ecomind.git
cd ecomind
# Install dependencies
npm install
# Add your Gemini API key
echo '…How I Built It
Tech Stack:
- Next.js 14 (App Router) + TypeScript
-
Google Gemini API (
gemini-1.5-flash) via@google/generative-aiSDK - Tailwind CSS for styling
- Vercel for deployment
How Gemini is integrated:
The core of EcoMind is a single API route (/api/analyze) that takes a user's lifestyle description and feeds it to Gemini with a carefully engineered system prompt:
const model = genAI.getGenerativeModel({
model: "gemini-1.5-flash",
generationConfig: {
responseMimeType: "application/json",
responseSchema: ecoAnalysisSchema,
},
});
const prompt = `
You are an environmental impact expert. Analyze the following lifestyle description
and return a structured carbon footprint assessment.
Lifestyle: ${userInput}
Provide: estimated annual CO2 in kg, top 5 reduction actions with CO2 savings,
and an overall sustainability score (1-10).
`;
const result = await model.generateContent(prompt);
I used Gemini's structured output / JSON schema enforcement feature to guarantee parseable responses — this was the most interesting technical decision. Instead of prompt-engineering my way to consistent JSON, I defined a Zod-like schema and passed it as responseSchema. This made the frontend rendering completely reliable.
Structured output schema:
const ecoAnalysisSchema = {
type: "object",
properties: {
annualCO2Kg: { type: "number" },
sustainabilityScore: { type: "number" },
topActions: {
type: "array",
items: {
type: "object",
properties: {
action: { type: "string" },
annualSavingKg: { type: "number" },
difficulty: { type: "string", enum: ["easy", "medium", "hard"] },
category: { type: "string" },
},
},
},
summary: { type: "string" },
},
};
Why this matters for Earth Day:
Carbon literacy is one of the biggest blockers to individual climate action. People don't act because the data feels distant. By making it conversational and immediate — type a few sentences about your week and get back a personalized plan — EcoMind lowers that barrier significantly.
I also added a Finland-specific context layer because I'm based in Turku and the sustainability advice for someone in the Nordics (excellent public transit, clean energy grid, cold climate heating costs) is genuinely different from generic global advice.
Prize Categories
Best Use of Google Gemini — Gemini is the core engine of EcoMind. The project uses:
-
gemini-1.5-flashfor fast, cost-effective inference - Structured JSON output with response schema for reliable parsing
- A multi-part system prompt that grounds Gemini in environmental science context
- Dynamic prompt construction based on user input
Top comments (0)