cd /news/artificial-intelligence/ecosphere-ai-why-i-separated-logic-f… Β· home β€Ί topics β€Ί artificial-intelligence β€Ί article
[ARTICLE Β· art-35354] src=dev.to β†— pub= topic=artificial-intelligence verified=true sentiment=↑ positive

"EcoSphere AI: Why I separated 'logic' from 'AI' when building a carbon footprint assistant"

EcoSphere AI separates its carbon footprint calculation logic from its AI layer, using a deterministic TypeScript engine for consistent, auditable emissions numbers and Google Gemini AI only for natural language explanations. The approach ensures reliable tracking and enables thorough unit testing, with deployment on Vercel and Google Cloud Run.

read2 min views1 publishedJun 21, 2026

When you say "build a carbon footprint app," the obvious move is: collect some inputs,

ask an LLM "how much CO2 does this produce," and display whatever it says.

That's a trap. LLMs are not reliable calculators. Ask the same model the same emissions

question twice and you'll get two different numbers. For a "track your carbon footprint"

tool, that's disqualifying β€” the entire premise of tracking requires consistent,

auditable numbers.

EcoSphere AI splits the problem in two:

1. A deterministic carbon engine β€” pure TypeScript functions using documented

emission factors (diet type, transport mode, energy use, shopping habits). Same input,

same output, every time. Fully unit tested. This is what computes your actual footprint,

your Carbon DNA archetype, your Risk Score, and your ranked recommendations.

2. Google Gemini AI β€” used only for what LLMs are actually good at: natural language

explanation, contextual conversation, and pattern narration. The AI coach receives the

engine's real computed numbers as context and explains them β€” it never invents the

math itself.

This split mattered more than any single feature. It's the difference between a project

that looks AI-powered and one that is genuinely intelligent.

Gemini API powers the conversational coach and weekly AI-generated summaries β€” always

fed real context, never guessing.

Firebase Firestore stores monthly profile snapshots, enabling a deterministic

habit-change detector that flags "+17% this month, likely from increased food delivery"

β€” again, computed, not hallucinated.

Deployment: Initially deployed on Vercel for rapid iteration, with a Dockerized Google Cloud Run architecture staging for final production.

Because the carbon engine is pure functions, it was trivial to write 20+ meaningful

unit tests β€” ordering checks (vegan footprint < high-meat footprint), boundary checks

(risk score clamped 0-100), and invariant checks (Carbon Twin always projects lower

than current). This is testing that actually validates logic, not just "does it render."

Six structured master prompts: scaffold + security β†’ deterministic engine β†’ Firebase/AI

layer β†’ core UI β†’ coach/gamification UI β†’ tests/Docker/README. Each prompt built on

the last, intent-driven the whole way.

πŸ”— Live: [https://ecosphere-ai-tan.vercel.app/](https://ecosphere-ai-tan.vercel.app/)

πŸ’» GitHub: [https://github.com/ajx1tech/ecosphere-ai](https://github.com/ajx1tech/ecosphere-ai)
── more in #artificial-intelligence 4 stories Β· sorted by recency
── more on @ecosphere ai 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain β€” perfect for shipping the agent you just read about.

$git push zahid main
β†’ Live at https://your-agent.zahid.host βœ“
Get free account β†’ Pricing
from €0/mo Β· no card required
LIVE [news/ecosphere-ai-why-i-s…] indexed:0 read:2min 2026-06-21 Β· β€”