Skip to content
All work

Bonfire Focus

A collaborative Pomodoro app for studying together in real time.

Solo, shippedrepodemo
Screenshot of Bonfire Focus

Overview

A realtime collaborative Pomodoro timer: join a room, and everyone sees the same countdown, the same ambient sound, and the same streak, synced to the second, with no visible server round-trip.

Why I built it

Solo focus timers are easy; a focus timer several people trust enough to actually sit through together is a distributed-systems problem wearing a UI. Wanted to see how far a naive shared timer could be pushed toward "feels instant and never drifts."

Architecture

Next.js 14 on Vercel, Supabase Realtime for presence and state sync, PostgreSQL for room/session/streak data, Motion for the animated UI and character customizer, and the Web Audio API for all sound, so no audio files ship with the app.

Clientnextjs, react, motion (animations)
Realtimesupabase realtime
Datapostgresql, security definer functions
Audioweb audio api (procedural, no files)

Challenges

A naive shared timer that decrements a counter on each tick drifts visibly once a client's main thread stalls. Instead, each write stores time_left alongside an updated_at timestamp; any client joining mid-session (or recovering from jank) derives the exact current second from the wall-clock delta against that timestamp, not from counting ticks, covered by unit tests for the running/paused/idle/finished state transitions. Ambient audio is synthesized procedurally (Brownian motion plus Paul Kellett's pink-noise algorithm) rather than shipped as files. Stats ingestion is protected by a SECURITY DEFINER Postgres function enforcing server-side validation and row-level locking, so concurrent writes can't corrupt a streak.

Outcome

Live and used for real study sessions. 3 stars on GitHub, 32 merged PRs of iterative feature work: solo mode, guest UX, room privacy, PWA support, and a full settings/theming pass.

Tech used

nextjstypescriptsupabase-realtimepostgresqlmotionweb-audio-api