This extension provides Supabase Database support (with RLS) for Chatbot UI.
Add the extension with npm:
npm i @chatbot-ui/supabase@latest
Run the Supabase Generation Script in the Supabase SQL editor.
This will do the following:
- Create the tables required by Chatbot UI.
- Create the authentication schema and tables required by NextAuth.js.
- Enable Row Level Security for the tables required by Chatbot UI.
- Apply the Row Level Security policies required by Chatbot UI.
Expose the next_auth schema in the API settings by adding next_auth to the "Exposed schemas" list.
More information here.
Update /chat.config.ts
to use the new database.
import { ClientDatabase } from '@chatbot-ui/supabase';
export const ChatConfig = {
..., // Other config
database: ClientDatabase,
... // Other config
};
};
All the following env variables are required for the extension to work. These can be found here.
Environment Variable | Default value | Description |
---|---|---|
NEXT_PUBLIC_SUPABASE_URL | '' |
The project URL. |
NEXT_PUBLIC_SUPABASE_ANON_KEY | '' |
The supabase project anon key. |
SUPABASE_SERVICE_ROLE_KEY | '' |
The supabase project service role key. |
SUPABASE_JWT_SECRET | '' |
Warning! Generating a new JWT Secret will invalidate all tokens above. |