Skip to content

Margin

One app for deadlines, courses, notes and goals that runs in the browser on my own devices, with no account and no cloud.

Result
In daily use since September 2026, on two runtime dependencies
My role
Everything: design, code, tests, CI
Team
Solo
Links
Code

Highlights

  • In daily use since September 2026: nine views in 131 commits, with React and React DOM as the only runtime dependencies.
  • Locked notes are encrypted in the browser with AES-GCM, under a key derived from the passcode by 600,000 rounds of PBKDF2.
  • Covered by 55 unit test files and 82 Playwright specs, including WCAG 2.2 AA accessibility scans.
Margin's Home view: today's date, one overdue item first, then the coming days with course tags

The problem

A student term has deadlines, courses, notes and goals, and keeping them usually means four apps, or one that wants an account and keeps your data on its servers. I wanted one app that opens with no sign-in, works offline, and keeps my data on my own machines.

Margin has no public deployment. It runs in the browser on my laptop, served by a small Node server bound to the laptop, and on my iPhone over Tailscale, a private network of my own devices. I have used it daily since September 2026.

What I built

I built Margin on my own, starting on 15 September 2026, and it stands at 131 commits.

It is React 18 and TypeScript on Vite, with nine views: Home, Calendar, Goals, Courses, Reflections, Notes, Routine, Trends and Data. The only runtime dependencies are React and React DOM. There is no router (the open view is one piece of state), no state library, no date library and no chart library. The trend charts and icons are inline SVG, and the US holidays on the calendar are worked out from their rules, so nothing is fetched.

How it works

All of the data sits in the browser's localStorage under one key. The page's content security policy limits scripts and requests to its own origin, and a Playwright test drives the busiest flows and fails on any request to another origin. Dates are stored as fixed moments, so a deadline set for 5pm still reads 5pm after a daylight saving change.

A repeating deadline creates its successor only when you finish the current one, so a repeat you ignore stops repeating. Deleting a deadline, a step, a note or a routine line happens at once and offers Undo; deleting a course or a goal asks first. Export calendar writes an .ics file of open deadlines with reminders set by priority, so the phone's own calendar does the reminding.

Locked notes are the only stored data that is encrypted. Setting a passcode, at least eight characters, makes a random 16-byte salt, and the browser's Web Crypto API runs PBKDF2 with SHA-256 and 600,000 iterations over the passcode and salt to derive a 256-bit AES-GCM key that cannot be exported. Each time a locked note is saved, its text is sealed under a fresh random 12-byte IV. The salt, the IV and the ciphertext are stored in the same localStorage record as everything else; the passcode and the key are never stored. A known value is sealed under the key too, and a wrong passcode is caught when GCM's authentication check fails on it.

While a note is unlocked, the key lives only in the page's memory. It is dropped when you leave Notes or after five minutes without typing. Changing the passcode decrypts every locked note in memory, seals each under a new key, and writes them all at once, so no note is left under the old one.

Sync goes only to the laptop that serves the app. Each device keeps its own copy, sends it to the laptop a few seconds after an edit and once a minute, and the two are merged record by record, the newer change winning. The server answers only localhost or its own Tailscale name, so any other host name gets a 403.

Results

Margin has 55 Vitest files of unit and component tests, written with React Testing Library, and 82 Playwright spec files run in Chromium, including axe scans for WCAG 2.2 AA in both colour schemes. GitHub Actions runs typecheck, lint, a format check, the unit tests, the end-to-end tests and the build on every pull request and every push to main. An updater on the laptop deploys a commit from main only after that CI run has passed.

Limits and next steps

The lock protects a note's body and nothing else. Its first line stays readable as the title, and every other record, deadlines included, is plain text in localStorage, readable by anyone at the unlocked laptop and by any browser extension. I chose that, judging that full-disk encryption covers the realistic threat.

  • Anyone with a copy of the data can guess passcodes offline. The 600,000 iterations make each guess cost about a tenth of a second, which slows a short passcode down without making it safe.
  • While a note is open, its text and key are in page memory, where a malicious extension could read them.
  • A backup or export taken before a note was locked still holds that note in plain text.
  • A forgotten passcode cannot be recovered, and the locked notes are lost with it.
  • Sync keeps the newer change per record, so an edit made to the same record on both devices loses one of the two.
  • Clearing site data deletes everything not backed up, automatic backups to a folder work only in Edge and Chrome, and there are no push notifications.

Stack

  • React 18 and TypeScript on Vite
  • Web Crypto API (PBKDF2, AES-GCM) for locked notes
  • localStorage, plus IndexedDB for the backup folder handle
  • A small Node server on the laptop, reached over Tailscale
  • Vitest, React Testing Library, Playwright and axe-core
  • GitHub Actions, CodeQL and Dependabot

Published , updated