This is a submission for the Hacktoberfest Open-Source AI Challenge Week 1: Touch Grass Submission 🌿

What I Built

Four billion people live in dense metropolitan cities. When hackathons announce themes like "Touch Grass", the tacit assumption is that you live a short drive from pristine mountain trails or manicured suburban nature reserves.

For those of us living in megacities like Dhaka, that is not reality. Our outdoors is an unforgiving landscape of sun-baked concrete, flyovers, gridlocked traffic, and isolated municipal parks like Ramna Park, Suhrawardy Udyan, or Dhanmondi Lake.

Stepping outside in dense tropical cities comes with genuine environmental hazards:

  1. Severe Air Pollution: US AQI frequently spikes above 150 (Unhealthy) or 200 (Very Unhealthy), turning strenuous cardiovascular exercise into a pulmonary health risk.
  2. Urban Heat Islands: Apparent temperatures routinely exceed 38°C midday, elevating heat-stroke risks.
  3. Monsoon Humidity & Vector Risks: Warm stagnant water and post-rain humidity (>70%) create high-risk environments for dengue and mosquito-borne illnesses.

Worse yet, existing outdoor navigation and fitness apps create a glaring paradox: to navigate nature, they demand that you stay glued to a glowing glass screen.

I built Sobuj Ghonta (সবুজ ঘণ্টা — "The Green Hour") to solve this. It is an ambient, mobile-first, bilingual (Bangla + English) Progressive Web App designed with a singular architectural mandate: find your safe green window, get you outside safely, and then get out of your way.

Key Capabilities

  • Deterministic Green Window Scoring (0–100): Evaluates real-time Open-Meteo hourly telemetry across US AQI, PM2.5, heat index, UV radiation, precipitation probability, and sunset times to pinpoint the safest outdoor window.
  • Hyper-Local Green Space Discovery: Identifies parks, gardens, and lakesides within ~3 km using OpenStreetMap Overpass with Haversine walking time estimates.
  • Immutable Code Guardrails: Hard mathematical checks that Google's open-weight Gemma model cannot override. If AQI > 150, effort is locked to gentle; if AQI > 200, outdoor cardio is barred, and N95 mask / postpone guidance is enforced.
  • Spoken Audio Walk in Your Pocket: A zero-cost, multi-tier TTS chain (Gemini 3.8 Flash TTS reusing the same key as Gemma, open-weight Meta MMS-TTS, and client Web Speech API) delivering mindful walk segments. Pair with lock-screen Media Session API controls and an OLED pitch-black Pocket Mode.
  • Zero-Signal Trail Resilience: "Download Walk for Trail" pre-caches audio clips into Cache Storage and IndexedDB so your guided walk plays flawlessly with zero cellular signal inside deep park groves.
  • Screen-vs-Outside Meter: Uses the Page Visibility API to track foreground screen seconds against total walk duration, proving mathematically that looking at the screen was the shortest part of your outdoor experience.
  • On-Device Nature Journal: Photo and note observations stored locally in browser IndexedDB; photos are never uploaded or retained on remote servers.

Field Test: Taking Sobuj Ghonta Outside

I took Sobuj Ghonta out for a late-afternoon field run at Ramna Park to test whether the audio cues and the ScreenMeter metric could keep my phone in my pocket. At 4:30 PM, Shahbagh traffic was at peak gridlock, but the app identified an environmental window between 4:45 PM and 5:20 PM where the canopy temperature dropped to 29°C before the typical Dhaka post-sunset particulate spike trapped dust and exhaust at ground level. I plugged in my earphones, started the session, and walked the inner loop.

  • Where I went: Ramna Park, Dhaka (starting from the Arunodoy gate, looping clockwise past the central lake, and cutting toward the tennis complex).

  • AQI that day: US AQI 162 (Unhealthy), with high PM2.5 readings across the city, though the afternoon wind cleared a short dip before evening stagnation set in.

  • What the plan got right: It routed me away from the perimeter paved road toward the dirt path under the rain tree canopy, where radiant heat was noticeably lower. It also accurately flagged a mosquito warning for the lake perimeter starting at 5:10 PM, which hit almost right on cue as twilight settled.

  • What it got wrong: The Overpass query routed me through a footpath near the park nursery that was padlocked for ground maintenance. The voice prompt repeatedly told me to turn left into a closed iron gate until I walked far enough past the boundary for the waypoint to clear.

  • How long I looked at the screen: ScreenMeter logged 52 seconds of active screen time across a 34-minute walk (a 2.5% screen-to-walk ratio). I only took the phone out twice: once to check the detour around the locked gate, and once at the end to save an entry in the Nature Journal.

Demo

  • Live Deployment on Render: https://sobujghonta.onrender.com/ (or connect your own instance via the included Blueprint)
  • Zero-Key Instant Dhaka Demo: Tap "Demo: Dhaka (Offline)" in the top navigation bar. It runs entirely on bundled, authentic Dhaka telemetry and pre-generated audio clips with 0 ms external network latency and zero API keys required, allowing judges to test every feature instantly.

Sobuj Ghonta Mobile Interface

Code

Sobuj Ghonta (সবুজ ঘণ্টা) — The Green Hour

Ambient, screen-minimizing outdoor companion for safe urban green discovery.
Built for the DEV Hacktoberfest Open-Source AI Challenge Week 1: Touch Grass.

Sobuj Ghonta Cover

What is Sobuj Ghonta?

For over four billion people living in dense urban centers, "touching grass" isn't a 10-minute drive to an alpine hiking trail. In high-density cities like Dhaka, Kolkata, or Bangkok, nature is found in fragmented municipal parks, lakeside promenades, and pocket gardens—tucked behind concrete flyovers and heavy traffic.

To make matters harder, urban nature outings require navigating environmental realities: air quality spikes (US AQI > 150), tropical heat waves, intense midday UV radiation, sudden monsoon thunderstorms, and vector-borne mosquito seasons. Worse yet, conventional fitness and navigation apps do the opposite of helping you disconnect—bombarding you with screens, alerts, and map tapping.

Sobuj Ghonta (সবুজ ঘণ্টা — "The Green Hour") flips the script:

  1. Discovers Safe Urban Green…
  • License: Permissive MIT License (Open Source)
  • Repository Structure: Single clean repository with an Express production server and a Vite React PWA client.
  • Automated Tests: 27 unit tests across 4 test suites (npm test), 16 production integration checks (scripts/fullQaRunner.mjs), and 8 deployment smoke tests (scripts/smoke.mjs).

How I Built It

1. Deterministic Green Window Scoring Engine

Rather than delegating environmental safety decisions to probabilistic LLM hallucinations, Sobuj Ghonta calculates an objective 0–100 hourly score in deterministic JavaScript (server/services/scoring.js):

// Heuristic scoring: base 100 with environmental penalties and golden-hour bonus if (aqi > 200) aqiPenalty = 60 + (aqi - 200) * 0.25; if (apparentTemp > 38) heatPenalty = 35 + (apparentTemp - 38) * 5; if (isThunder) rainPenalty = 55; if (!isDaylight) darknessPenalty = 25; if (isGoldenHour && aqi <= 150 && rainPenalty <= 10) goldenHourBonus = +12; 

2. Immutable Code Guardrails That Gemma Cannot Override

Public health recommendations cannot tolerate hallucinations. In server/services/guardrails.js, strict rules validate and sanitize Gemma's structured JSON output:

export function validateAndCorrectPlan(plan, guardrails, language = 'en') { const corrected = { ...plan }; // If AQI exceeds hazardous thresholds, override effort level if (guardrails.flags.hazardousAqi) { corrected.effort_level = 'rest'; } else if (guardrails.flags.unhealthyAqi && corrected.effort_level === 'strenuous') { corrected.effort_level = 'gentle'; } // Guarantee mandatory medical disclaimer and mosquito alerts ... return corrected; } 

3. Open-Source LLM Adapter Pattern (gemma_api ↔ ollama)

In server/services/llm/adapter.js, an adapter pattern supports both cloud inference via Google AI Studio (gemma-4-26b-a4b-it) and 100% offline edge execution via local Ollama (gemma2:9b). System constraints are injected directly into the user turn to honor Gemma's prompt contract, and outputs are sanitized defensively with automated markdown fence stripping and regex fallbacks.

4. Zero-Cost Free TTS Provider Chain

When building audio walk narration, commercial paid TTS services created an unnecessary cost barrier. We designed an automated fallback chain in server/services/tts/index.js:

  1. Gemini 3.8 Flash TTS (gemini-3.8-flash-tts): Reuses the user's existing Google AI Studio key (GEMMA_API_KEY). Generates 24 kHz studio-quality audio in English and Bengali (bn-BD). When encountering Google's free-tier 3 RPM quota limit, it handles backoff automatically.
  2. Meta MMS-TTS (facebook/mms-tts-ben & eng): Open-weight multilingual speech models running on Hugging Face Serverless Inference behind an optional HF_TOKEN.
  3. Client Web Speech API: Client-side zero-cloud fallback with automated Bengali voice detection.
  4. Bundled Dhaka Audio: 8 pre-generated audio clips committed into the repository and pre-cached by Service Worker v2, guaranteeing that judges and users can experience high-fidelity voice guidance with zero latency and zero keys.

5. Production Hardening on Render

The application is deployed to Render using a declarative Blueprint (render.yaml):

  • Reverse proxy trust configured (app.set('trust proxy', 1)) so sliding-window rate limiting works accurately.
  • HTTP security headers enforced via Helmet with a tailored Content Security Policy allowing OSM map tiles and audio streams.
  • HTTP compression (gzip/brotli) enabled.
  • Node version pinned to 20.18.0 in .node-version and package.json.
  • Health check route /health verified without external API dependencies.

Why Does Open Innovation Matter?

Building Sobuj Ghonta around open-weight models, open data, and open web standards demonstrated four clear advantages over closed proprietary ecosystems:

  1. Model Swappability & Offline Sovereignty:
    A closed AI application is forever tethered to remote billing, latency, and vendor terms. Sobuj Ghonta's open architecture allows anyone to run LLM_PROVIDER=ollama with gemma2:9b on a consumer laptop. The entire loop — weather scoring, green space navigation, and AI walk generation — runs 100% offline with zero API toll.

  2. Data Sovereignty & Location Privacy:
    Personal location coordinates, walking routines, and photos of nature are deeply private. By relying on public open data (Open-Meteo and OpenStreetMap) and storing journal entries exclusively in on-device IndexedDB, the user's physical presence is never tracked, monetized, or sold into advertising profiles.

  3. Where Open Beat Closed (Heuristic Guardrails):
    Commercial closed chat APIs tend to produce verbose, conversational essays that encourage prolonged screen interaction. By constraining open-weight Gemma with deterministic heuristic code guardrails, we produced terse, safety-verified walk scripts under 60 words that tell the user to put their phone away.

  4. Cultural & Linguistic Inclusion:
    Open-weight models and open web standards allowed us to deliver first-class Bengali localization with native typography (Hind Siliguri), serving communities in South Asia that are routinely overlooked by Western-centric wellness applications.

My Agent Session

This project was architected, implemented, and verified using Google Antigravity (gemini_cli). Real agent session transcripts were curated, sanitized of secrets, and saved through DevRelay:

Sobuj Ghonta — Architecture, Free TTS Chain, Full QA & Render Deployment with Antigravity
You

You are continuing work on 'Sobuj Ghonta (সবুজ ঘণ্টা) — The Green Hour' for the DEV Hacktoberfest Open-Source AI Challenge, Week 1 'Touch Grass'. Three jobs this session: (1) replace ElevenLabs with free alternatives because I could not get an ElevenLabs key, (2) QA the WHOLE website, (3) make it fully deploy-ready on Render. Never fabricate results, quotes or test outcomes. Do not claim anything works unless you ran it.

Agent

Starting Phase 0 preflight. Running git status, remote check, and verifying push access. Inspecting DevRelay gateway and fetching Week 1 'Touch Grass' challenge requirements to map every rule and judging criterion into docs/SUBMISSION_CHECKLIST.md. Omitted ElevenLabs from prize tracks and focused on Best Use of Gemma and Best Use of Render.

You

Proceed with Phase 1 audit and Phase 2 replacing ElevenLabs with free alternatives.

Agent

Phase 1 complete: produced docs/AUDIT.md cataloging current architecture, scoring engine, guardrails, and missing pieces.

Phase 2: Built a free multi-tier TTS provider chain in server/services/tts/:
1. Gemini 3.8 Flash TTS (gemini-3.8-flash-tts) reusing GEMMA_API_KEY with voice Kore, returning studio-quality 24 kHz WAV for both English and Bengali (bn-BD). Discovered and handled 3 RPM free-tier limit with automated 25.5s backoff.
2. Meta MMS-TTS (facebook/mms-tts-ben & eng) via Hugging Face Serverless Inference with optional HF_TOKEN.
3. Client browser Web Speech API fallback with Bengali voice detection.
4. Pre-generated 8 bundled demo audio clips for Dhaka (Ramna Park) in client/public/demo-audio/ and server/cache/audio/ for instant zero-latency evaluation.
All 27 unit tests pass across 4 suites.

Show more
You

Proceed with Phase 3 full QA and Phase 4 Render deployment.

Agent

Phase 3 QA & Hardening:
- Configured Helmet CSP for OSM tiles, audio blobs, Google Fonts.
- Added per-IP rate limiting (120 req / 15 min on API, 30 req / 5 min on TTS).
- Input validation and sanitization on all endpoints.
- Nature Journal delete entry capability added to IndexedDB.
- Executed scripts/fullQaRunner.mjs: 16/16 production checks passed. Documented in docs/QA_REPORT.md.

Phase 4 Render Deploy-Ready:
- Created render.yaml Blueprint (free plan, Node 20, autoDeploy, healthCheckPath /health).
- Pinned Node version to 20.18.0 in .node-version and package.json engines.
- Built scripts/smoke.mjs with 8/8 automated checks against live server.
- Verified clean clone test in isolated directory (git clone -> npm ci -> npm run build -> npm run smoke). All passed.
- Documented click-by-click in docs/DEPLOY.md.

Show more
You

Finalize submission preparation and DEV post draft via DevRelay.

Agent

Phase 5 Submission:
- Updated docs/BUILD_LOG.md with real verified metrics (27 unit tests, 16 integration checks, 8 smoke checks, 5,476 LOC, 215 kB bundle).
- Updated docs/POST.md following exact required headings: What I Built, Demo, Code, How I Built It, Why Does Open Innovation Matter?, My Agent Session, Prize Categories.
- Embedded DevRelay agent session.
- Staged draft on DEV via DevRelay MCP (published: false, Article ID: 4808936).
- Preserved user field-test block verbatim for Sayem's authentic outdoor experience.

(Direct Session Link: https://dev.to/agent_sessions/sobuj-ghonta-architecture-free-tts-chain-full-qa-render-deployment-with-antigravity-d7vlbw)

Prize Categories

Featured Categories

  • Best Use of Gemma ($200): Google's open-weight Gemma model serves as the core reasoning engine, generating mindful walking scripts, sensory missions, and multimodal photo observations strictly constrained by deterministic safety rules. Supports both Google AI Studio API (gemma-4-26b-a4b-it) and fully offline local Ollama runtimes (gemma2:9b).
  • Best Use of Render ($200): Configured and deploy-ready on Render using a declarative Blueprint (render.yaml) that provisions a unified Node.js web service serving the Express API, static PWA client, /health monitoring, and compression.

Overall Prize

  • Hacktoberfest Week 1: Touch Grass ($250): A comprehensive, culturally resonant outdoor companion tailored for high-density cities, built entirely on open-source AI and open data, mathematically proven to keep screen time minimal.