Initializing
Create a new client for use in the browser.
You can initialize a new Supabase client using the createClient()
method.
The Supabase client is your entrypoint to the rest of the Supabase functionality and is the easiest way to interact with everything we offer within the Supabase ecosystem.
Parameters
The unique Supabase URL which is supplied when you create a new project in your project dashboard.
The unique Supabase Key which is supplied when you create a new project in your project dashboard.
Automatically refreshes the token for logged-in users. Defaults to true.
If debug messages for authentication client are emitted. Can be used to inspect the behavior of the library.
Detect a session from the URL. Used for OAuth login callbacks. Defaults to true.
OAuth flow to use - defaults to implicit flow. PKCE is recommended for mobile and server-side applications.
Provide your own locking mechanism based on the environment. By default no locking is done at this time.
Whether to persist a logged-in session to storage. Defaults to true.
A storage provider. Used to store the logged-in session.
Optional key name used for storing tokens in local storage.
The Postgres schema which your tables belong to. Must be on the list of exposed schemas in Supabase. Defaults to `public`.
A custom `fetch` implementation.
Optional headers for initializing the client.
Options 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')
import { createClient } from '@supabase/supabase-js'
// Use a custom domain as the supabase URL
const supabase = createClient('https://my-custom-domain.com', 'public-anon-key')