Tagline: Your friendly climate coach for understanding, tracking, and reducing your daily carbon footprint.
- Vertical: Sustainability / Climate Tech
- Problem Statement: Most carbon footprint calculators are either overly complex, require extensive user input, or feel judgmental. This creates friction, causing users to abandon the assessment before taking any actionable steps.
- Solution Overview: Carbon Companion AI is a lightweight, interactive web app that functions as an AI-style sustainability coach. It calculates daily-life carbon footprints (Home Energy, Transport, Food, Flights, Waste, and Shopping) through a friendly 5-minute assessment, identifies the user's primary emission contributor, generates personalized recommendations, tracks weekly progress, and features Terra, a rule-based AI companion to guide users on their journey.
- Interactive Assessment: Grouped, highly accessible questionnaire focusing on lifestyle inputs.
- Results Dashboard: Custom visual representations of emissions via an SVG Donut Eco Score and CSS breakdown bars.
- AI Companion (Terra): A rule-based companion with built-in intent detection (using natural keywords) to answer lifestyle questions and provide support without external server calls.
- Personalized Recommendations: Custom suggestions sorted dynamically based on the user's highest emission category, budget preferences, and effort level.
- Action Tracker: A checklist allowing users to mark tasks complete and track their weekly progress. Saved to browser
localStorage. - What-if Simulator: Sliders and toggles to instantly visualize the impact of lifestyle modifications on monthly and yearly footprints.
- Methodology Transparency: Displays all emission factors and calculation parameters in a structured table.
- Core Technologies: HTML5 (semantic elements), CSS3 (custom properties/variables, responsive flexbox/grid), Vanilla JavaScript (deferred browser scripts).
- Asset Strategy: Strictly inline SVG vectors. No external icon libraries or image assets.
- Libraries/APIs: None. Built entirely with raw vanilla components (no React, Chart.js, Tailwind, or external LLM API).
- Storage: Browser
localStorage(runs completely locally). - Security/Privacy: Fully client-side. No logins, no analytics tracking, no personal information sent to servers.
The app uses a simplified activity × emission factor model.
Important
Demo Assumptions Notice: The factors listed below are educational averages and simplified for demo purposes. A production application would utilize region-specific, verified databases (like those from DEFRA, EPA, or IPCC).
| Category | Activity Metric | Factor (kg CO2e) | Assumption Detail |
|---|---|---|---|
| Electricity | Per kWh (monthly) | 0.7 kg / kWh | Divided by household size to find individual share |
| Transport | Car (per km) | 0.18 kg / km | Average passenger car emissions |
| Transport | Bike / Scooter | 0.08 kg / km | Medium-sized motorbike |
| Transport | Bus | 0.06 kg / km | Transit bus passenger average |
| Transport | Train | 0.04 kg / km | Electric/diesel commuter rail average |
| Transport | Walk / Cycle | 0.00 kg / km | Zero emissions |
| Food | Vegan (monthly) | 80 kg | Plant-based lifestyle baseline |
| Food | Vegetarian (monthly) | 100 kg | Dairy and eggs included |
| Food | Mixed Diet (monthly) | 150 kg | Average meat and vegetable consumption |
| Food | High Meat (monthly) | 220 kg | Daily meat consumption heavy baseline |
| Waste | Low recycling (monthly) | 30 kg | Mostly landfill waste |
| Waste | Medium recycling (monthly) | 18 kg | Some sorting and composting |
| Waste | High recycling (monthly) | 10 kg | Advanced composting and recycling |
| Shopping | Low (monthly) | 20 kg | Minimal consumer goods and clothes |
| Shopping | Medium (monthly) | 45 kg | Regular purchases |
| Shopping | High (monthly) | 90 kg | Frequent new clothes, gadgets, and deliveries |
| Flights | Flights taken (yearly) | 250 kg / flight | Short/medium haul flight average per passenger |
- Clone or download this repository.
- Open
index.htmldirectly in any web browser (no local server or compiler needed). - Alternatively, host the root folder using a simple HTTP server (e.g.
npx serveor Python'spython -m http.server 8000).
The project includes a no-dependency Node.js test suite so evaluators can verify the core logic without installing a framework.
npm testThe test runner validates:
- Calculator math for the demo profile, yearly/monthly totals, highest category, and Eco Score.
- Edge cases such as invalid numeric input, unknown commute modes, zero totals, and high emissions.
- Terra assistant intent detection across common user prompts and context-aware replies.
- Personalized recommendation ordering by highest category, budget, and effort preference.
localStoragesave/load/clear behavior, including corrupt JSON fallback.- Static accessibility checks for labels, heading order, and accessible-name alignment.
The code is intentionally split by responsibility:
js/namespace.jscreates the singlewindow.CarbonCompanionnamespace.js/data.jskeeps emission factors, actions, and assistant copy.js/calculator.jscontains pure footprint calculations.js/assistant.jscontains rule-based intent and reply logic.js/storage.jsisolates browser storage.js/dashboard.js,js/actions.js, andjs/chat.jssplit rendering by feature.js/simulator.jscontains pure simulator math plus simulator rendering.js/utils.jscentralizes formatting, numeric coercion, and DOM helpers.
- Public GitHub Repository: Intended for public submission at
https://github.com/PranshuBasak/carbon_footprint. - Single Branch: Work is kept on
main. - Repository Size: Source files are lightweight static assets and no large media files are included.
- No Dependencies: No runtime or dev dependencies are required;
package.jsononly defines the test command. - No External APIs: Terra is rule-based and does not call an LLM or third-party service.
- Privacy: No login, analytics, cookies, backend, or network data collection. User inputs remain in browser
localStorage.
- Contrast: Adheres to WCAG AAA/AA requirements using high-contrast dark green (
#146c39) and slate charcoal (#1e293b) text against off-white surfaces. - Forms: Fully accessible using explicit
<label for="...">linking and validation guidelines. - Keyboard Friendly: Clean
:focus-visiblestyling for form controls, navigation tabs, and buttons. - Load Speed: Extremely high performance due to pure static design with zero external network requests.