> ## Documentation Index
> Fetch the complete documentation index at: https://docs.agentset.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Step 5: Supabase

> Configure PostgreSQL database for application data

Next, you'll need to set up any PostgreSQL database (e.g. [Supabase](https://supabase.com/)). This will be used to store application data (e.g. user sessions, user data, etc.).

<Steps>
  <Step title="Create Supabase database">
    In your [Supabase account](https://supabase.com/), create a new database.

    Make sure to copy the password you write to use for the next step.

    <Frame>
      <img src="https://mintcdn.com/agentset/vcYsAoevgOLWGz34/images/self-hosting/supabase-create-db.png?fit=max&auto=format&n=vcYsAoevgOLWGz34&q=85&s=4f628695444be2b978a6de8c98d8fb08" alt="Supabase create database" width="1460" height="1204" data-path="images/self-hosting/supabase-create-db.png" />
    </Frame>
  </Step>

  <Step title="Set up Supabase environment variables">
    Then, click on the **Connect** button on the top left, navigate to the **ORMs** tab, and select **Prisma**.

    After that, copy the `DATABASE_URL` and `DIRECT_URL` into your `.env` file. And make sure to replace `[YOUR-PASSWORD]` with the password you wrote down in the previous step.

    <Frame>
      <img src="https://mintcdn.com/agentset/vcYsAoevgOLWGz34/images/self-hosting/supabase-connection.png?fit=max&auto=format&n=vcYsAoevgOLWGz34&q=85&s=b71d21ece14176db8435de76634236e4" alt="Supabase connection" width="1934" height="1290" data-path="images/self-hosting/supabase-connection.png" />
    </Frame>
  </Step>

  <Step title="Apply migrations">
    In the terminal, run the following command to generate the Prisma client:

    ```bash Terminal theme={null}
    pnpm run db:generate
    ```

    Then, run the following command to apply the database migrations:

    ```bash Terminal theme={null}
    pnpm run db:deploy
    ```
  </Step>
</Steps>

## Next Steps

Once you've completed the Supabase setup, proceed to [Step 6: GitHub OAuth](/open-source/step-6-github-oauth) to enable authentication.
