Sync preferences
When you sign in to PlanningSup, your settings and preferences automatically sync across all your devices. This is powered by a local-first sync system that uses last-write-wins conflict resolution.What gets synced
The following preferences sync across devices when you’re signed in:Selected plannings
Selected plannings
- Your currently selected planning(s)
- Custom planning groups (name + associated plannings)
Event filters
Event filters
- Blocklist (hidden event titles)
- Highlight teacher preference (dim events without teacher)
Display settings
Display settings
- Event colors (lecture, lab, tutorial, other)
- Show weekends in week view
- Merge duplicate events
UI preferences
UI preferences
- Theme (light / dark / auto)
- Target timezone (if set)
View history (current date, selected view) is not synced — each device maintains its own navigation state.
How sync works
Local-first architecture
PlanningSup uses a local-first approach where:- Local changes are immediate: When you update a setting, it’s saved to
localStorageinstantly - Background sync to server: The change is debounced and pushed to the server in the background
- Conflict resolution on login: When you sign in on a new device, PlanningSup compares local and server timestamps using last-write-wins
apps/web/src/composables/useUserPrefsSync.ts:181-224 for the full implementation.
Timestamp-based conflict resolution
Each preference has a local timestamp (stored inlocalStorage) and a server timestamp (stored in the database). When conflicts occur:
- Newer timestamp wins: The most recently modified value is kept
- Local changes while offline: If you modify settings while offline, they’re pushed to the server when you reconnect
- Server changes while offline: If another device updates the same setting, your device adopts the server value when you come online
__STAMP__ with an authoritative timestamp in prefsMeta:
Debounced sync
To avoid excessive API calls, PlanningSup debounces sync requests:highlightTeacher: 10ms (instant)showWeekends: 10ms (instant)blocklist: 250ms (typing delay)colors: 400ms (color picker delay)customGroups: 50ms (fast updates)
Signing in for sync
To enable cross-device sync, you need to sign in with a supported provider:- Discord
- GitHub
- Passkey (WebAuthn)
Viewing synced data
You can inspect your synced preferences in the browser console:user table as JSON fields:
Disabling sync
If you want to use PlanningSup without syncing:Local changes made while signed out are not lost. When you sign in again, they’re synced to the server if they’re newer than the server values.
Multi-device workflow example
Scenario: Laptop and phone
-
On your laptop:
- Select your planning and customize colors
- Sign in with Discord
- Settings sync to the server
-
On your phone:
- Install the PWA
- Sign in with Discord
- Your planning and colors appear automatically
-
Make a change on your phone:
- Add an event to the blocklist
- The change syncs to the server
-
Back on your laptop:
- Refresh the page or wait for the next sync check
- The blocklist updates automatically
Sync edge cases
Both devices offline
If you make changes on Device A while offline, then make different changes on Device B while offline, the last device to come online wins.Race conditions
If you rapidly switch between devices and make changes, the sync system may receive requests out of order. PlanningSup uses optimistic locking to avoid redundant requests:Clearing server data
To reset your synced preferences:Authentication system
PlanningSup uses Better Auth for authentication, with the following features:- OAuth 2.0: Discord and GitHub providers
- Passkeys (WebAuthn): For passwordless login on supported browsers
- Session cookies: Secure, HTTP-only cookies with automatic refresh
- Deep linking: For Tauri and browser extension OAuth flows
apps/web/src/composables/useAuth.ts and apps/api/src/utils/auth.ts for the implementation.
Next steps
Web app
Learn about the web version features
Desktop & mobile
Install the Tauri-based native apps