Inspiration

We care a lot about the planet, and Rudra is in his school's sustainability CCA. Through Rudra, we kept hearing about the same problem again and again: people want to live greener, but small eco-habits are easy to forget and give no instant reward. Turning off a light or reusing a jar feels like it doesn't count. Games, on the other hand, are great at making small daily actions stick.

So we asked ourselves: what if our green habits kept a little creature alive? That became Sustain-a-Pet. It's a virtual pet that grows when we do small, real things for the planet, and the garden around it grows with our habits.

What it does

  • Pick a companion and look after it in a 3D garden with islands, a river and a footbridge.
  • Complete daily green habits and a daily sustainability quiz to keep your pet healthy and earn XP, coins and leaves.
  • Use GreenLens: snap a photo or describe something around you, and AI suggests one small, safe real-world action. For example, it might suggest reusing a jar or recycling something properly, with curated recycling sources.
  • Use it with no account: progress stays in your browser, and the app works offline as a PWA.

How we built it

  • Frontend: React 19 and Vite, with the 3D garden in http://three.js through react-three-fiber. We modelled the pets, islands, river and footbridge in Blender and exported them into the scene.
  • GreenLens backend: a single Node server serves the app and one endpoint, POST /api/eco-quest. That endpoint calls vision models through OpenRouter: NVIDIA Nemotron first, then Google Gemma as fallbacks. Each model has to answer in a strict JSON schema.
  • Keeping the AI honest: the AI only suggests actions. Rewards come from a fixed table in code, sources come from a curated list, and completions use HMAC-signed quest tokens. The server also enforces a daily cap, so the AI can never hand out points or invent links.
  • Production hardening: We added rate limiting, request timeouts and retries with backoff. If no model answers, the app shows a labelled pre-written tip. The server also has health checks and a Docker image.
  • Testing: about 310 Vitest unit tests, Playwright end-to-end tests on desktop and on emulated phone screen sizes, and an eval set for the AI's answers.

deployXA: our own coding harness

We built the project with deployXA, a coding harness we created ourselves. It runs layered tasks on Claude Code (CC): it splits work into tiers so cheaper, faster models handle the broad work and stronger models handle the hard parts.

One example from this project was a bug hunt. deployXA launched 10 parallel bug-hunter sessions on a fast model, each one scanning a different part of the codebase. They reported only severe bugs. deployXA then sent each bug to its own fixer session on a stronger model, which fixed exactly one bug and added a test. That one pass found and fixed 10 real bugs:

  • a way to bypass the rate limit by faking an IP header
  • a file-handle leak in the server
  • rewards being lost when a network response dropped
  • the pet freezing in place after being patted
  • the app freezing when the device clock was set backwards

Challenges we faced

  • Making AI trustworthy for a game. Models sometimes return broken JSON, time out, or suggest unsafe things. We added schema validation, a denylist, a model fallback chain and pre-written tips, so GreenLens always gives a safe answer.
  • Getting timeouts in the right order. The client, server and AI-provider timeouts must nest correctly, or users see confusing errors. The server now refuses to start if they are configured in the wrong order.
  • 3D on phones. A full 3D garden has to stay smooth on mid-range phones and still work when WebGL isn't available.
  • Edge cases in real life. Timezones, clocks set backwards, lost network responses and offline reloads all broke things in ways we didn't expect. Each one now has a test.

What we learned

  • How to put AI in a product safely: let it suggest, and let code decide.
  • How to take an app from "works on our laptop" to production-ready, with health checks, rate limits, graceful failure and Docker.
  • How to direct many AI coding agents at once, which is why we built deployXA. Layered tasks let us move fast without losing quality.
  • That sustainability sticks better when it's fun. In Rudra's CCA they talk a lot about changing habits, and building this showed us how game design can actually help with that.

What's next

  • Deploy it publicly and share it with Rudra's sustainability CCA.
  • Add CCA or class gardens, where a whole group grows a shared habitat together.
  • Add more GreenLens quests tied to real local recycling programs.

Built With

Share this project:

Updates

Submission history