Skip to main content

If you are using our backend SDK that is lesser than the following versions, please visit the older documentation link here.

Creating a Supabase Client

We will be creating a client to interact with Supabase using the supabase-js library.

  • Install the supabase-js library

    npm install @supabase/supabase-js
  • Create a new file called utils/supabase.ts and add the following:

    // utils/supabase.ts

    import { createClient } from '@supabase/supabase-js'

    let supabase_url = process.env.NEXT_PUBLIC_SUPABASE_URL || "TODO: Your Supabase URL"
    let supabase_key = process.env.NEXT_PUBLIC_SUPABASE_KEY || "TODO: Your Supabase Key"

    const getSupabase = (access_token: string) => {
    const supabase = createClient(

    supabase.auth.session = () => ({
    token_type: "",
    user: null

    return supabase

    export { getSupabase }
Looking for older versions of the documentation?
Which UI do you use?
Custom UI
Pre built UI