DEV Community

Cover image for SunRhythm: A Privacy-First Daylight Coach That Runs on Your Own Machine
PARTH BIDARI
PARTH BIDARI

Posted on

SunRhythm: A Privacy-First Daylight Coach That Runs on Your Own Machine

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

What I Built

SunRhythm is a local-first circadian health app that gets desk workers off their screens and into real daylight at the right times of day.

If you're a developer or remote worker who spends 10+ hours under LED light, you know the pattern: afternoon crashes, late bedtimes, and habit trackers that die because they want constant manual input. SunRhythm needs zero data entry.

Open it and it:

  • Finds the sun for you: it uses your browser location and computes today's dawn, sunrise, solar noon, sunset and dusk on-device.
  • Plans three daylight micro-breaks: a morning light anchor, a midday reset and a sunset wind-down, timed to today's sun.
  • Gets you to actually step outside: a "Step outside" button turns the whole screen into one giant countdown clock. A gentle chime and a vibration remind you when a break opens, and one tap on the banner starts the timer.
  • Tracks your progress automatically: finishing a break logs it and the minutes outside. No typing.
  • Shows what's next at a glance: the next break with a live countdown, a sun-position bar, and a timeline that ticks off finished breaks.

A small Settings panel (wake and sleep times, manual location) is optional. Defaults work on first launch.

Who it's for: SDEs, remote workers and anyone whose daylight exposure is a commute from the couch to the desk.

Demo

SunRhythm runs entirely in your browser and talks to a local Ollama on your own machine, so there is no hosted version. Nothing about your location or sleep schedule ever leaves your device. Here is the app in action:

Dashboard: next break, sun position, today's progress

AI plan from a local Gemma 3 model (note the "AI plan" label)

Step Outside mode: one giant countdown

Reminder banner, and the "Today" card after finishing a break

Settings: wake and sleep times, optional location override

Want to try it? It takes about a minute. See the run steps in the Code section below.

Code

GitHub logo Parth-G27 / SunRhythm

Privacy-first daylight break scheduler for desk workers. Local sun math + optional local Ollama AI plan. React + Vite + Tailwind.

☀️ SunRhythm

A privacy-first daylight coach for people who live on their screens. SunRhythm works out when the sun is up where you are, schedules three short outdoor breaks around it, and turns your screen into one big countdown when it's time to go outside.

Everything runs in your browser. The only network call the app can ever make is to an Ollama instance on your own machine.

SunRhythm dashboard Step Outside countdown AI plan from a local model

Why

Ten hours under LED light means afternoon crashes and late bedtimes. Habit trackers don't fix that because they demand constant manual input. SunRhythm asks for nothing: open it, and it already knows where the sun is and what to do next.

Features

  • Automatic solar times. Uses your browser location to compute dawn, sunrise, solar noon, sunset and dusk on-device with suncalc.
  • Three daylight breaks a day. A morning light anchor, a midday reset and a sunset wind-down, timed to today's…

Run it yourself:

git clone https://github.com/Parth-G27/SunRhythm
cd SunRhythm
npm install
npm run dev     # app
npm test        # 44 unit tests
Enter fullscreen mode Exit fullscreen mode

Optional AI plan (any small Ollama model works):

ollama pull gemma3:1b
ollama serve
Enter fullscreen mode Exit fullscreen mode

How I Built It

The open-source AI: local inference with Ollama, running an open-weight Gemma 3 model (gemma3:1b verified; the app also prefers gemma3:4b and phi3 if installed). The browser talks straight to localhost:11434. There is no backend, no API key and no cloud.

How the AI is wired in:

  • The app asks Ollama which models are installed and uses a preferred one, otherwise the first installed chat model.
  • The prompt contains only wake and sleep times and today's sunrise and sunset. Coordinates and place names are never sent, not even to the local model.
  • Small models are messy, so replies are strictly validated: exactly 3 breaks, valid times inside waking hours, non-empty text. The parser tolerates time ranges like 07:00-07:30 and nested arrays, and retries once.
  • Graceful degradation: the UI shows a computed static schedule instantly and upgrades to the AI plan only if it validates. If Ollama is off, slow (20 s limit), or returns garbage, the user never sees an error. The AI is an enhancement, never a dependency.
  • A good plan is cached for the day in localStorage, so reloads don't re-run the model.

Stack: React + Vite + Tailwind CSS v4, lucide-react icons, suncalc for solar math, Web Audio (a synthesized chime, no audio files) and the Vibration API for alerts, and Vitest (44 tests). Persistence is localStorage only. There is no state library; each concern is a small service plus a hook.

How I built it: spec-driven development with GitHub Spec Kit and Claude Code. I wrote a short constitution first (local-first, localStorage-only, graceful fallback, minimal friction, keep it simple). Each of the 9 features then went through spec → plan → tasks → implementation, with a Constitution Check at each plan. Testing the real model against the real app also caught a bug a stubbed test would have missed: my hard-coded model name wasn't installed on the machine, so the AI path silently never ran. It now auto-detects an installed model.

Why Does Open Innovation Matter?

SunRhythm needs your location and your sleep schedule, which is some of the most personal data there is. With a closed cloud API, the honest design would be "send your coordinates and bedtime to someone else's server." With an open-weight model running locally through Ollama, the privacy promise is a fact you can verify in the Network tab: the only requests go to localhost.

Open models also made these things possible:

  • No keys, no bills, no rate limits: it works offline, on a plane, and for anyone who can run a 1B-parameter model on a laptop.
  • You choose the model: swap gemma3:1b for phi3 or a bigger model with no code change, and the app adapts to whatever is installed.
  • Reliability becomes your job, and that's a good thing: a small local model is imperfect, so I built validation, retries and a static fallback. The result is an app that is useful with or without the AI.

Top comments (2)

Collapse
 
parth_bidari profile image
PARTH BIDARI •

Open to feedback and reviews :)

Collapse
 
mandy_mor_e8a349d501010ea profile image
mandy mor •

Intresting.