{"slug": "leafpace-touch-grass", "title": "LeafPace - Touch grass", "summary": "A developer built LeafPace, a zero-backend progressive web app that generates running, walking, and hiking routes in under 30 seconds while keeping GPS coordinates entirely on-device. The app races three Overpass mirrors in parallel and hedges to Nominatim if none responds within 2.5 seconds, and runs the open-weight SmolLM2-360M-Instruct model natively on the phone's GPU via WebLLM and WebGPU, with no closed LLM API used at any point.", "body_md": "*This is a submission for the [Hacktoberfest Open-Source AI Challenge Week 1: Touch Grass](https://dev.to/challenges/hacktoberfest-week1-2026-10-05)*\n\n**The screen must be the shortest part of the experience.** 30 seconds on your phone → 45 minutes on the trail.\n\n**LeafPace** is a zero-backend progressive web app that gets runners, walkers, and hikers off the screen and into the wild — in under 30 seconds:\n\n**Who it's for:** anyone who wants their run or hike to happen *outside* the algorithm — and whose home address shouldn't be uploaded to a fitness social network to do it.\n\n**Privacy by architecture:** there is no backend. Your GPS coordinates never leave your device — every network call LeafPace makes (OSM Overpass, Nominatim, OSRM/Valhalla) is a *location-independent* public API query, and the AI runs 100% on-device.\n\n🔗 **Live app: [https://big0boy.github.io/LeafPace/](https://big0boy.github.io/LeafPace/)** (GitHub Pages, zero hosting cost)\n\nTry it on your phone: open the link, tap **🍃 Synthesize Trail**, then **📱 Lock Phone & Touch Grass**.\n\n📦 **Repo: [https://github.com/Big0boy/LeafPace](https://github.com/Big0boy/LeafPace)** — every dependency is open source, every data source is an open commons.\n\nStack: **React 18 + TypeScript + Vite + Tailwind**, **Leaflet**, **@mlc-ai/web-llm** (lazy-loaded), **SunCalc**, **Vitest**, plus a dependency-free **CDP smoke-test harness** (`scripts/smoke.mjs`) that drives the real app in headless Chromium — fake GPS lock, route synthesis, GPX download and XML validation included.\n\nThe part I'm proudest of is the green-space lookup, because public open infrastructure is *flaky* and the app must never fail — it races three Overpass mirrors in parallel, hedges to Nominatim (a completely separate OSM service) if none answers in 2.5 s, retries, and only then falls back to synthetic parks:\n\n```\n// First usable answer wins; a broken mirror can never stall route generation.\nconst winner = await firstSuccess<GreenSpaceLookup>([overpassWave, nominatimWave]);\nif (winner) {\n  console.info(`${winner.source === 'overpass' ? 'Overpass' : 'Nominatim'} green-space lookup succeeded (${winner.spaces.length} results)`);\n  return winner.spaces;\n}\n```\n\nThe AI core is **open-weight models running natively on the phone's GPU** via [WebLLM](https://webllm.mlc.ai/) (WebGPU):\n\n`SmolLM2-360M-Instruct` (quantized, ~250 MB cached in the browser) — swappable to `Qwen2.5-0.5B/1.5B-Instruct` by changing one constant in `src/services/webgpu-llm.ts`.\nAround the model sits the open geospatial pipeline: **Overpass API + Nominatim** (green-space discovery), **OSRM foot + Valhalla** (pedestrian snapping), **SunCalc** (solar geometry), and a hand-rolled **GPX 1.1 serializer**. All of it is a static PWA with a service worker — deployable anywhere, free forever.\n\nTesting: 29 vitest unit tests (loop geometry, polyline decoding, GPX, mirror-race fallbacks) plus the headless-browser smoke test, both run in CI on every push.\n\nBecause **both halves of LeafPace only exist because of open infrastructure**, and each has a closed-API twin that would be *worse for the user*:\n\nEntering every category this touches — please verify final category names against the [challenge page](https://dev.to/challenges/hacktoberfest-week1-2026-10-05):\n\nAI was used to create this project. The on-device briefing model (`SmolLM2-360M-Instruct`) is an open-weight model distributed by its creators — no closed or proprietary LLM API was used at any point, since the app's premise is that location data must never leave the device.", "url": "https://wpnews.pro/news/leafpace-touch-grass", "canonical_source": "https://dev.to/big0boy/leafpace-touch-grass-516l", "published_at": "2026-10-09 21:20:25+00:00", "updated_at": "2026-10-09 21:23:57.609703+00:00", "lang": "en", "topics": ["ai-tools", "generative-ai", "large-language-models", "ai-products", "developer-tools"], "entities": ["LeafPace", "WebLLM", "SmolLM2-360M-Instruct", "Overpass API", "Nominatim", "OSRM", "Valhalla", "SunCalc"], "also_reported_by": [], "alternates": {"html": "https://wpnews.pro/news/leafpace-touch-grass", "markdown": "https://wpnews.pro/news/leafpace-touch-grass.md", "text": "https://wpnews.pro/news/leafpace-touch-grass.txt", "jsonld": "https://wpnews.pro/news/leafpace-touch-grass.jsonld"}}