DEV Community

Divya Bairavarasu
Divya Bairavarasu

Posted on

๐ŸŒฟ EarthBug โ€” Snap a Bug. Protect Your Ecosystem.

DEV Weekend Challenge: Earth Day

This is a submission for Weekend Challenge: Earth Day Edition

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.

Demo

Watch the demo - https://youtu.be/pLOUmKnfX-Y
try it - https://earthbug.vercel.app/?demo=true

Code

Review the code here - https://github.com/divyabairavarasu/earthbug.git

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.

Prize Categories

Best Use of Google Gemini API ยท Earth Day Impact ยท Open Source ยท Mobile Experience

Team-members:@divya_bairavarasu_93ffe55

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.Thank you for the opportunity.

Top comments (0)