Skip to content

Case study · 2026

Pocket: a local ledger with optional sync

A native Mac menu bar money tracker built with Swift, SwiftUI, and AppKit, with recurring payments, balance forecasting, local storage, and optional self-hosted sync.

A money entry must remain visible when the connection drops. A timed-out request also needs a clear outcome before it is retried.

SwiftSwiftUIAppKitSupabase
Pocket: a local ledger with optional sync screenshot

What I am building

Pocket shows how much money is left in the Mac menu bar. People record income and spending, schedule recurring payments, and use a forecast to see how upcoming entries affect their balance. The product site is pocketleft.app.

My work covers the native interface, ledger logic, persistence, and optional sync. The Mac application uses Swift, SwiftUI, and AppKit. Its money logic lives in a separate module so it can be exercised without the interface or storage.

The decision: make sync optional

The app can run with a local JSON ledger and daily backups, without an account. Someone who wants access from another device can connect a Pocket server, including a self-hosted Supabase project.

Connecting changes the source of truth: the server becomes authoritative, while the Mac keeps a local copy and a journal of pending changes. The access key is stored in the macOS Keychain.

The difficult case: a request with an uncertain outcome

A request can time out after the server has already applied it. Sending it again without knowing what happened could create a second entry.

Pocket records pending operations in an outbox. The sync journal includes a review state for uncertain requests, so those operations can wait for a decision rather than being sent again automatically. Offline changes remain visible locally while confirmed operations are reconciled with the server.

That choice trades some manual review for a clearer boundary around money entries. A pending change should have an explicit state, even when the connection cannot tell the app whether the request arrived.

Verification and scope

The repository contains tests for the money logic and account sync against a mock server. They cover the application's rules and request handling; they do not replace a check against a live server or the installed Mac app.

Pocket is available as a Mac download. The native app, optional sync, and the download website are separate parts of the same project.