Skip to content

Add Cross-Browser Conversation Persistence with Remote Storage #19

@ForestMars

Description

@ForestMars

Add Cross-Browser Conversation Persistence with Remote Storage

Description

Currently, Polyglot saves all conversations only in localStorage, which makes them browser- and device-specific. This approach is brittle and limits the user experience: conversations are lost if the user clears their browser data or switches devices.

We want to implement persistent, cross-browser storage while keeping localStorage as a cache for speed. This would allow users to access their conversation history from any device or browser where they log in.

Acceptance Criteria

  1. Remote Persistence

    • Save conversation history to a server-side database (could start with a simple REST API or Firebase/Firestore).
    • Associate conversations with a unique user ID or session token.
  2. Local Cache

    • Continue caching conversations in localStorage for fast access.
    • Sync changes between local cache and remote storage.
  3. Sync Logic

    • On app load, fetch the latest conversation history from the server and populate localStorage.
    • Handle conflicts between local and remote versions gracefully (e.g., last-write-wins or merge strategies).
  4. Cross-Browser Support

    • Conversations should persist across multiple browsers and devices.
    • Implement authentication or a device/session token system to identify users.
  5. Error Handling

    • Offline usage should still be possible via localStorage.
    • Sync retries if network fails.
  6. Future-Proofing

    • Design storage schema so additional features (conversation tags, search, export) can be added easily.

Notes

  • Consider using lightweight solutions initially (Firebase, Supabase, or a simple Node.js backend with SQLite/Postgres).
  • Make sure performance is optimized: fetching hundreds of conversations should not noticeably slow down the app.

Labels

enhancement

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions