> For the complete documentation index, see [llms.txt](https://phoenixcoded.gitbook.io/saasable/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://phoenixcoded.gitbook.io/saasable/admin/development/auth/supabase.md).

# Supabase

To set up Supabase in your project, first, you need to [create your Supabase account](https://supabase.com/).\
Create a project and get the **supabaseUrl** and **supabaseKey** for integration.

1. Make sure the email provider is enabled and configured with proper values.\
   \
   **Path :** Supabase => Authentication => Providers

<figure><img src="https://content.gitbook.com/content/FYraHF5vkX1IKpfr4Qlh/blobs/0PxstsdsrVd1QPYl03ob/email_setup.png" alt=""><figcaption></figcaption></figure>

2. To send an OTP on the signup flow, you need to configure it in the Supabase email template with\
   \&#xNAN;**{{ .Token }}** variable. You can also design your own email template there.\
   \
   **Path :** Supabase => Authentication => Email Templates

<figure><img src="https://content.gitbook.com/content/FYraHF5vkX1IKpfr4Qlh/blobs/yK25lEPIT64JlbocLD6A/image.png" alt=""><figcaption></figcaption></figure>

{% hint style="warning" %}
According to the new guidelines of Supabase, you need to set up your own **SMTP** server to send an email. For more information about Supabase and its integrations, view the [documentation](https://supabase.com/docs).
{% endhint %}

3. Supabase account is configured; now we will set it up in our project. To enable Supabase authentication, make the following changes:\\
   1. Change the **auth provider** in the **config** file.

      <pre class="language-typescript" data-title="src/config.ts"><code class="lang-typescript">...
      export const AUTH_PROVIDER: AuthType = AuthType.SUPABASE;
      ...
      </code></pre>

   2. Add your **supabaseUrl** and **supabaseKey** in the **.env** file.

      <pre class="language-properties" data-title=".env"><code class="lang-properties">...

      ## Supabase
      NEXT_PUBLIC_SUPABASE_URL=
      NEXT_PUBLIC_SUPABASE_ANON_KEY=
      </code></pre>

   3. 🎉 **Congrats!** Supabase is now configured in your project. 🚀 You can test it by running the project.\
      \
      By default, signup assigns the "**user**" role. You can customize this role in the `signUp` API of Supabase by modifying the code in `src/app/api/supabase/auth/index.ts` to fit your specific requirements.
