Supabase is used for the Superagent UI, it provides the database, Authentication with well know auth providers and a Bucket for file storage.

Website -

GitHub - supabase/supabase

Setting up supabase with Docker

For quickly trying out supabase with Superagent, a docker compose example is provided in the folder libs/.docker/ui/supabase/ For a production setup refer to the official documentation on self hosting supabase.

Run supabase with docker compose

  1. cd into the supabase example folder

    $cd libs/.docker/ui/supabase/
  2. Copy the .env.example file into a .env file

    $cp .env.example .env
  3. In the example .env file many of the variables are pre-configured to work with Superagent locally with docker compose, out of the box. It is advised to review and change all of the keys and passwords in the .env file.

    • Supabase has a guide and a tool for generating new values for JWT_SECRET, ANON_KEY and SERVICE_ROLE_KEY in their official docs. Review your POSTGRES_PASSWORD and DASHBOARD_PASSWORD too.
    • Copy any changed values over to the docker .env file for Superagent.
    $# libs/.docker/.env
    >JWT_SECRET=<JWT_SECRET from supabase .env>
    >NEXT_PUBLIC_SUPABASE_ANON_KEY=<ANON_KEY from supabase .env>
    >SUPABASE_DB_URL=postgresql://postgres:<POSTGRES_PASSWORD from supabase .env>@supabase-db:5433/postgres
  4. Setup Authentication provider for use with Superagent UI.

    • The following external auth providers are supported by Supabase and in turn by Superagent - apple, azure, bitbucket, discord, facebook, figma, github, gitlab, google, keycloak, linkedin, notion, spotify, slack, twitch, twitter and workos
    • An example set of variables is provided below for GITHUB auth, for others simply change the name of the provider in each variable name. e.g GOTRUE_EXTERNAL_AZURE_ENABLED. Refer to each providers own documentation for information on setting up auth.
    • See the section GitHub Authentication Setup below for steps to setup GitHub Authentication via your github account.
    $# libs/.docker/ui/supabase/.env
  5. Start supabase with docker compose using the provided script in the same folder.

    • The script will ensure the superagent docker network exists, stops any previously running containers, then runs supabase with docker compose.
    $ # Check if the network exists
    > if ! docker network ls | grep -q superagent_network; then
    > # Create the network if it does not exist
    > docker network create superagent_network
    > fi
    > ./ && docker compose up -d
    > docker logs supabase-db
  6. You can access the supabase ui in the browser to confirm the service is up.

    http://localhost:8000 or http://supabase-kong:8000 if you have added the following to your hosts file.

    $# hosts file
    > supabase-kong
  7. Login with the values DASHBOARD_USERNAME and DASHBOARD_PASSWORD from libs/.docker/ui/supabase/.env

Supabase Storage

File storage is already configured in the provided supabase docker setup. This is created when you deploy using the script from libs\.docker\ui\supabase\volumes\db\init\data.sql. Though there is one manual step needed to enable superagent to access it:

Required setup to enable storage access

You can access the storage and manage files at the following url

Supabase container logs

$# Supabase API
>docker logs supabase-kong -f
># Supabase Database
>docker logs supabase-db -f

Stop supabase

Use the provided script to stop running services for supabase

$# libs/.docker/ui/supabase

Uninstall supabase

Use the provided script to remove the running services for supabase , this will delete all data stored in the volumes.

$# libs/.docker/ui/supabase

Authentication Examples

GitHub Authentication Setup

  1. Create a new GitHub OAuth app in your GitHub account


  3. Set the following callback URL, for use with docker compose use http://localhost:8000/auth/v1/callback

  4. Update the environment variables:

    • If using supabase via docker compose - Update the values in the Supabase .env file libs/.docker/ui/supabase/.env
    $# libs/.docker/ui/supabase/.env
    • If using supabase in the cloud: Navigate to your Supabase project you have created for Superagent UI and paste the CLIENT_ID and CLIENT_SECRET
    Screenshot 2023-09-15 at 09 08 52
  5. Finally update the variables in the libs/.docker/.env file

    $# libs/.docker/.env
Was this page helpful?