Skip to content

Add examples/supabase-chat — full persistence example with Supabase (#299)#306

Open
eshwarreddym wants to merge 2 commits intothesysdev:mainfrom
eshwarreddym:feature/amazing-feature
Open

Add examples/supabase-chat — full persistence example with Supabase (#299)#306
eshwarreddym wants to merge 2 commits intothesysdev:mainfrom
eshwarreddym:feature/amazing-feature

Conversation

@eshwarreddym
Copy link
Copy Markdown

Closes #299

Adds a standalone Next.js example that wires OpenUI's threadApiUrl contract to a real Supabase backend, giving developers a production-ready reference to build from.

Includes:

  • Supabase migration: threads + messages tables, RLS policies (per-user ownership), updated_at trigger, and Realtime publication
  • Anonymous auth via signInAnonymously() — stable per-device UUID with zero sign-up friction; upgradeable to email auth
  • All five default thread routes: GET /get, GET /get/:id, POST /create, PATCH /update/:id, DELETE /delete/:id — each auth-checked server-side
  • /api/chat route that streams via openAIAdapter and persists the full conversation to Postgres after each assistant reply
  • Supabase Realtime subscription (postgres_changes on threads) that refreshes the sidebar across tabs
  • README with step-by-step setup: Supabase project, anonymous auth, migration options (SQL Editor or CLI), env vars table, architecture walkthrough, and "going further" pointers

Follows the same structure and tooling as examples/openui-chat.

eshwarreddym and others added 2 commits March 11, 2026 14:14
…hesysdev#299)

Closes thesysdev#299

Adds a standalone Next.js example that wires OpenUI's threadApiUrl contract to a real Supabase backend, giving developers a production-ready reference to build from.

Includes:
- Supabase migration: threads + messages tables, RLS policies (per-user ownership), updated_at trigger, and Realtime publication
- Anonymous auth via signInAnonymously() — stable per-device UUID with zero sign-up friction; upgradeable to email auth
- All five default thread routes: GET /get, GET /get/:id, POST /create, PATCH /update/:id, DELETE /delete/:id — each auth-checked server-side
- /api/chat route that streams via openAIAdapter and persists the full conversation to Postgres after each assistant reply
- Supabase Realtime subscription (postgres_changes on threads) that refreshes the sidebar across tabs
- README with step-by-step setup: Supabase project, anonymous auth, migration options (SQL Editor or CLI), env vars table, architecture walkthrough, and "going further" pointers

Follows the same structure and tooling as examples/openui-chat.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Persistence example with Supabase

2 participants