# 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="/files/0weQpSl8NU0ohNuOsD3W" 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="/files/FcyQKDc3ah8cmJMcjAlw" 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.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://phoenixcoded.gitbook.io/saasable/admin/development/auth/supabase.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
