Overview
All Better Home data is stored in your browser’s localStorage. The backup system collects all stored data, packages it into a downloadable JSON file, and can restore that data to any browser running Better Home.What Gets Backed Up
The following localStorage keys are included in backups:src/lib/backup-utils.ts
better-home-widget-settings
better-home-widget-settings
Widget visibility and layout preferences
better-home-todos
better-home-todos
All task items with completion status and importance flags
better-home-todo-sort
better-home-todo-sort
Current sorting mode (manual, oldest, newest)
better-home-todo-filters
better-home-todo-filters
Active filters (hide completed, important only)
better-home-quick-links
better-home-quick-links
All saved quick links with URLs and titles
mood-calendar-2026-data
mood-calendar-2026-data
All mood, work log, and journal entries for 2026
mood-calendar-show-numbers
mood-calendar-show-numbers
Calendar date number visibility preference
vite-ui-theme
vite-ui-theme
Theme preference (light/dark mode)
Creating Backups
The backup process collects all data from localStorage:src/lib/backup-utils.ts
Backup Processing
- Iterates through all defined storage keys
- Reads each value from localStorage
- Attempts to parse JSON values
- Falls back to raw string if parsing fails
- Returns object with all found data
Only keys that exist in localStorage are included. Empty or missing keys are omitted from the backup file.
Downloading Backups
Backup data is converted to a formatted JSON file and downloaded:src/lib/backup-utils.ts
File Naming Convention
better-home-backup-2026-03-15.json
The ISO date format ensures chronological sorting and makes it easy to identify when backups were created.
Download Process
- Stringify: Convert backup object to formatted JSON (2-space indent)
- Blob Creation: Create a Blob with MIME type
application/json - Object URL: Generate a temporary download URL
- DOM Manipulation: Create hidden anchor element and trigger click
- Cleanup: Remove anchor and revoke object URL to free memory
Restoring Backups
Restore writes backup data back to localStorage:src/lib/backup-utils.ts
Restore Logic
Special Case - Theme: Thevite-ui-theme key stores a raw string value ("light" or "dark"), not JSON.
Parsing Backup Files
Handle file input and JSON parsing:src/lib/backup-utils.ts
Error Handling
The function silently fails on invalid JSON rather than throwing errors. This provides a better user experience:- No error dialogs for corrupted files
- No console spam from failed parses
- Application remains stable
In a production UI, you would likely want to show user-friendly error messages instead of silent failures. The current implementation prioritizes simplicity.
Usage Workflow
Creating and Downloading
Restoring from File
A page reload is typically needed after restore to ensure all components re-read the updated localStorage values.
Backup File Format
Example backup file structure:Best Practices
Regular Backups
Create backups weekly or before major changes to avoid data loss
Version Control
Keep multiple backup files with dates to maintain history
Cloud Storage
Store backup files in cloud storage (Dropbox, Google Drive) for accessibility
Before Reinstall
Always backup before reinstalling the extension or clearing browser data
Migration Use Cases
- New Computer: Backup on old device, restore on new device
- Browser Switch: Move data from Chrome to Edge/Brave/etc.
- Extension Reinstall: Preserve data through extension updates
- Sync Across Devices: Manually sync data between work and personal computers
- Data Recovery: Restore from backup after accidental deletion