Spec offline sync for notes edited on 2 devices

Vibe codingHard30 minFigma style

Your task

Your notes app works offline. The TypeScript client keeps notes in IndexedDB, queues edits while offline, and syncs with the server API on reconnect. The same note can be edited on a laptop and a phone at the same time. A coding agent will build the sync.

Write the build spec you would hand the agent: how edits are modeled, how conflicts are found and resolved, the sync protocol and the acceptance checks.

What you know:

  • a note has a title, a plain-text body of up to 100 KB, a list of tags and a pinned flag
  • users sometimes delete a note on one device while editing it on another
  • device clocks can be minutes off, and phones drop connections mid-request
  • losing a paragraph a user wrote is the one thing that must never happen

Then, in a few sentences: what does "sync the local changes to the server" miss?