Initializing
Create a new client for use in the browser.
Parameters
- supabaseUrlREQUIREDstring
The unique Supabase URL which is supplied when you create a new project in your project dashboard.
- supabaseKeyREQUIREDstring
The unique Supabase Key which is supplied when you create a new project in your project dashboard.
- optionsOptionalSupabaseClientOptionsauthOptionalobjectautoRefreshTokenOptionalboolean
Automatically refreshes the token for logged-in users. Defaults to true.
detectSessionInUrlOptionalbooleanDetect a session from the URL. Used for OAuth login callbacks. Defaults to true.
flowTypeOptionalobjectOAuth flow to use - defaults to implicit flow. PKCE is recommended for mobile and server-side applications.
persistSessionOptionalbooleanWhether to persist a logged-in session to storage. Defaults to true.
storageOptionalobjectA storage provider. Used to store the logged-in session.
storageKeyOptionalstringOptional key name used for storing tokens in local storage.
dbOptionalobjectThe Postgres schema which your tables belong to. Must be on the list of exposed schemas in Supabase. Defaults to `public`.
schemaOptionalSchemaNameglobalOptionalobjectfetchOptionalFetchA custom `fetch` implementation.
headersOptionalRecordOptional headers for initializing the client.
realtimeOptionalRealtimeClientOptionsOptions passed to the realtime-js instance
import { createClient } from '@supabase/supabase-js'
// Create a single supabase client for interacting with your database
const supabase = createClient('https://xyzcompany.supabase.co', 'public-anon-key')