Designing Safe Auto-Cleanup and Trash for a Local-First Notes App
Designing Safe Auto-Cleanup and Trash for a Local-First Notes App Local-first software earns trust by keeping user data on the device. That promise, however, makes deletion design more important—not less. If a cloud service deletes the wrong record, a server backup may exist. If a browser extension permanently removes a note from chrome.storage.local , there may be no second copy. This article explains the design behind Auto-clean and Trash in Simple Side Note. The implementation uses three safety layers: cleanup is opt-in, important notes are excluded, and expired notes move to a recoverable trash area before permanent deletion. Start with explicit product invariants Before writing cleanup code, define rules that must always remain true. These are more useful than a list of UI controls because they can become test cases. For this note app, the invariants are: Auto-clean is off by default. Only unpinned notes can expire. The note currently being edited cannot be cleaned. C...