Built for Earth Day Hackathon 2025 ยท Powered by Google Gemini AI ยท Developed with GitHub Copilot
What I Built
Every day, millions of gardeners spray pesticides on insects they don't recognize โ unknowingly killing the very creatures that keep their gardens alive. Ladybugs, lacewings, ground beetles, and dozens of other beneficial insects die silently because people can't tell the difference between a garden ally and a garden pest.
EarthBug changes that. Point your phone at any insect, tap a button, and within seconds you'll know exactly what it is, what role it plays in your local ecosystem, and whether you should protect it or remove it โ with full ecological context, not just a label.
๐ Earth Day Angle: Pesticide overuse is one of the leading drivers of pollinator collapse and soil degradation. EarthBug gives everyday people the knowledge to make smarter decisions โ reducing chemical runoff and protecting biodiversity one scan at a time.
The Problem I'm Solving
Here's something that surprised me when I started building this: most people โ even experienced gardeners โ cannot reliably identify more than a handful of insects. And when they're unsure, the default reaction is to grab the pesticide spray.
The consequences are real:
40% of insect species are declining globally, many due to pesticide exposure
1 in 3 bites of food depends on pollinators โ most of which are insects
A single beneficial predator insect can consume hundreds of pest insects per week
Most people have no idea which of the bugs in their garden are helping them
The knowledge gap is the problem. EarthBug closes it.
Live Demo
โถ Watch the demo video - https://youtu.be/pLOUmKnfX-Y
Or try it yourself โ no setup needed, no account required:โจโ https://earthbug.vercel.app?demo=true
The demo mode pre-loads a real analysis so you can explore the full experience without needing an API key. Just tap through โ it works exactly like the real thing.
How I Built It
I'll be honest: this app would have taken me three times as long without AI assistance. Here's how Google Gemini and GitHub Copilot each played a distinct, essential role.
Google Gemini AI โ The Brain
Gemini is doing the heavy lifting here. When a user captures or uploads a photo, the image goes through a client-side compression pipeline (to optimize the API payload), then is sent to Gemini's vision model with a carefully engineered prompt that requests a structured JSON response.
What Gemini returns for every scan:
Common name and scientific classification
Ecological role โ what this insect actually does in its habitat
Benefits and harms โ nuanced, not black-and-white
A contextual verdict: Mostly Helpful / Mostly Harmful / Context-Dependent / Neutral Visitor
Eco-actions โ specific things the user can do to help or manage this species
Confidence level โ so users know how certain the identification is
What makes this integration more than a basic API call:
Structured JSON output with schema validation โ Gemini returns a typed object, not free text
Safety filter handling โ graceful degradation when images don't contain insects
Multi-turn conversations โ users can ask follow-up questions like "How do I attract more of these?"
Error recovery with retry logic โ transient API failures don't crash the experience
Image compression pipeline โ canvas-based resize before the API call keeps costs low and latency tight
Gemini doesn't just tell you what the bug is โ it tells you what it means for your garden and what you should do about it. That's the difference between trivia and actionable intelligence.
**GitHub Copilot โ The Development Partner
**GitHub Copilot was present at every stage of development โ not as an autocomplete tool, but as a genuine pair programmer. Here's where it made the biggest difference:
Prompt Engineering: Copilot helped me iterate on the Gemini system prompt, suggesting structured output schemas and edge case handling I hadn't considered
React Architecture: The state machine in App.jsx โ managing the API_KEY โ CAMERA โ ANALYZING โ RESULTS flow โ was co-designed with Copilot suggestions
E2E Test Coverage: The entire Playwright test suite was built with Copilot, including the Gemini route interceptors that let tests run without real API calls
Image Compression: The canvas-based compression pipeline that handles GIF/SVG edge cases came from a Copilot suggestion I wouldn't have reached on my own
Accessibility: Copilot flagged missing alt text and duplicate ARIA roles that I'd overlooked โ the kind of detail that matters but is easy to miss under deadline pressure
The honest reflection: AI-assisted development isn't about writing less code. It's about writing better code faster โ catching blind spots, exploring options you wouldn't have considered, and keeping momentum when you're stuck.
Tech Stack
Frontend: Vite 6 + React 18 + Tailwind CSS
AI: Google Gemini Vision API (@google/generative-ai)
Deployment: Vercel (serverless, zero backend)
Testing: Playwright E2E
Dev Partner: GitHub Copilot
Architecture: Mobile-first SPA, privacy-first (images never stored server-side)
Privacy-First by Design
One thing I was deliberate about: EarthBug never stores your photos. Images live only in memory during the scan session โ they go to Gemini's API and nowhere else. Scan history is kept in-session only. There's no account, no tracking, no database of your garden.
In an era where every app wants your data, I wanted to build something that just works for you.
What's Next
EarthBug is a working app today, but it's pointing at something bigger. The features I'd love to add with more time:
iNaturalist Integration โ one-tap export to contribute sightings to global biodiversity science
Regional Bug Guides โ "Most common in your area this season"
Community Confirmations โ let experienced users verify AI identifications
Offline Mode (PWA) โ scan bugs without connectivity, sync later
Gamification โ seasonal bug collections, biodiversity badges
The core insight is this: AI can turn a smartphone into a field naturalist's notebook. That's a tool with real environmental stakes.
Final Thoughts
I started this project because I genuinely didn't know if the spider living in my garden was a friend or a problem. Now I know it's a garden ally. I hope EarthBug helps a lot of people discover the same thing about the creatures sharing their space.
If you've made it this far โ go outside, find a bug, and scan it. You might be surprised who your neighbors are.
Happy Earth Day. ๐
Prize Categories: Best Use of Google Gemini API ยท Earth Day Impact Mobile Experience
Top comments (0)