DEV Community

Cover image for I Built a Carbon Footprint Tracker in 48 Hours โ€” Here's How Copilot Saved Me
HARD IN SOFT OUT
HARD IN SOFT OUT

Posted on

I Built a Carbon Footprint Tracker in 48 Hours โ€” Here's How Copilot Saved Me

DEV Weekend Challenge: Earth Day

This is a submission for the Weekend Challenge: Earth Day Edition


๐ŸŒฑ What I Built

I built EcoTrack Pro โ€” a beautiful, privacy-first carbon footprint calculator that helps individuals understand and reduce their environmental impact.

The problem: Most carbon calculators are either too simplistic (3 questions) or buried in corporate reports. People want to know their actual impact and get actionable steps to reduce it.

The solution: EcoTrack Pro asks 15+ lifestyle questions (transport, energy, food, waste, shopping), calculates annual COโ‚‚e emissions using peerโ€‘reviewed data, and provides personalized, quantified recommendations โ€” not generic tips.

Key features:

  • ๐Ÿ“Š 15+ input categories with sensible defaults
  • โšก Realโ€‘time grid intensity by country (Electricity Maps data)
  • ๐Ÿ“ˆ Interactive pie & bar charts (toggleable)
  • ๐Ÿ’ก Personalized recommendations with estimated COโ‚‚ savings
  • โ˜๏ธ Anonymous cloud sync via Supabase (no login required!)
  • ๐ŸŒ“ Beautiful glassmorphic UI, fully responsive
  • ๐Ÿ”— Share results on X, Facebook, LinkedIn

๐ŸŽฅ Demo

Live Demo: ecotrack-pro.netlify.app

Screenshots:

The apps Calculator
The apps Calculator

๐Ÿ’ป Code

GitHub Repository: github.com/setuju/ecotrack

The entire project is vanilla HTML/CSS/JavaScript โ€” no frameworks, no build steps. Just clone and open index.html.

git clone https://github.com/setuju/ecotrack.git
cd ecotrack
python3 -m http.server 8000
Enter fullscreen mode Exit fullscreen mode

๐Ÿ› ๏ธ How I Built It

Tech Stack

  • Frontend: HTML5, CSS3 (Glassmorphism, CSS Grid/Flexbox), Vanilla JavaScript (ES6+)
  • Charts: Chart.js (both pie and bar views)
  • Backend/Storage: Supabase (PostgreSQL) with anonymous deviceโ€‘ID sync
  • Data Sources: EPA, IPCC, Poore & Nemecek (2018) Science, Electricity Maps
  • Dev Server: Python http.server

The Hardest Parts

1. Balancing accuracy with simplicity

I needed enough inputs to be meaningful, but not so many that users bounce. I grouped 15+ fields into collapsible sections and preโ€‘filled defaults based on global averages.

2. Anonymous cloud sync without login

I didn't want to force signโ€‘up. Solution: generate a persistent device_id in localStorage, and if the user accepts cookies, sync their footprint to Supabase using that ID. Rowโ€‘Level Security ensures they only see their own data.

3. Chart.js "undefined" errors

When toggling between pie and bar charts, I kept getting broken charts. The fix: properly destroy the previous Chart instance before creating a new one, and always use a fresh canvas context.

How GitHub Copilot Helped (Prize Category)

I actively used GitHub Copilot throughout development. Here's exactly where it shined:

Task Copilot's Help
Emission factor lookup Wrote the entire EMISSION_FACTORS object with realistic values after I typed // per km gasoline car
Chart configuration Generated the complete Chart.js options object โ€” I only tweaked colors
Tooltip CSS Created the .tooltip and .tooltiptext classes from a single comment
Share button logic Wrote the shareToX() and shareToFacebook() functions with correct URL encoding
Recommendation messages Suggested realistic tips like "Reducing weekly driving by 20 km saves ~200 kg COโ‚‚/year"

Without Copilot, I would have spent hours on boilerplate and docs. With it, I focused on UX and architecture.

๐Ÿ† Prize Categories

I'm submitting this project for the following prize category:

  • โœ… Best Use of GitHub Copilot

(I used Copilot to accelerate development โ€” generating emission factors, chart configs, share logic, and personalized recommendation text.)


๐Ÿ™ Thank You

Thank you to the DEV Community and the Weekend Challenge judges for organizing this inspiring event. It was a joy to build something meaningful for Earth Day.

If you find this project useful, I'd really appreciate a โญ on GitHub!


This is a submission for the Weekend Challenge: Earth Day Edition

Top comments (2)

Collapse
 
aibughunter profile image
AI Bug Slayer ๐Ÿž

48-hour builds are such a great forcing function for shipping! Copilot accelerating the boilerplate while you focus on the carbon calculation logic is exactly how AI pair programming should work.

Collapse
 
ggle_in profile image
HARD IN SOFT OUT

@aibughunter Exactly! The 48h constraint really strips away the fluff. Copilot handled the repetitive scaffolding so I could keep the core emission logic accurate and the UX clean. Glad that came across!