← Back

PROJECT 003 · 2026 · JS · LOCALSTORAGE

Astra

Live ↗Code ↗

Summary

A focus timer: create activities, set daily goals, start, pause and watch live progress.

Why I built it

To understand application state: what you store, what you calculate and what you show.

How it works

Astra: state modelStored: todaySeconds, isRunning, startedAt. Derived: live = todaySeconds + floor((Date.now() − startedAt) / 1000). Rendered: home view and detail view, from the same state.stored{ todaySeconds, isRunning,startedAt }derivedlive = todaySeconds+ ⌊(Date.now() − startedAt) / 1000⌋renderedhome viewdetail viewfrom the same state
FIG. 1 — stored → derived → renderedNTS

Hard parts

  • Time from timestamps, not seconds++. Start, pause and resume calculate time from Date.now(), so the result stays correct even when the browser slows down timers.
  • Two views, one truth. The home view and the detail view update live from the same state.
  • Daily reset without breaking saved data.

What I learned

Design the state before the UI. Separate stored data from calculated values. Plan the architecture before adding features.