Skip to content

Persistence example with Supabase #299

@zahlekhan

Description

@zahlekhan

Is your feature request related to a problem? Please describe.
OpenUI supports chat persistence via threadApiUrl and custom hooks (fetchThreadList, createThread, updateThread, deleteThread, loadThread) on ChatProvider, but there is no concrete example showing how to wire this to a real database. Developers need to figure out the schema, API routes, and integration themselves.

Describe the solution you'd like
Add a standalone example app in the examples/ folder (e.g., examples/supabase-chat) that demonstrates full chat persistence with Supabase. The example should include:

  • Supabase schema (tables for threads and messages) with migration files.
  • Supabase auth integration for per-user thread ownership.
  • API routes that implement the persistence hooks (create, load, update, delete threads).
  • Real-time subscription support for live updates using Supabase Realtime.
  • A working Next.js app wiring it all together with ChatProvider.
  • Clear setup instructions (Supabase project creation, env vars, running migrations).

Describe alternatives you've considered

  • A generic persistence guide in the docs without runnable code, but a working example is far more practical.
  • Using a different database (e.g., Postgres with Prisma, SQLite), but Supabase is popular in the AI/LLM community and offers auth, real-time, and storage out of the box.

Additional context
The example should follow the same structure as examples/openui-chat. Persistence docs already exist at docs/content/docs/chat/persistence.mdx — the example should complement those docs with a production-ready reference implementation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions