Supabase
Supabase is used for the Superagent UI, it provides the database, Authentication with well know auth providers and a Bucket for file storage.
Website - supabase.com
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
-
cd
into the supabase example folder -
Copy the
.env.example
file into a.env
file -
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
andSERVICE_ROLE_KEY
in their official docs. Review yourPOSTGRES_PASSWORD
andDASHBOARD_PASSWORD
too. - Copy any changed values over to the docker .env file for Superagent.
- Supabase has a guide and a tool for generating new values for
-
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
andworkos
- 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.gGOTRUE_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.
- The following external auth providers are supported by Supabase and in turn by Superagent -
-
Start supabase with docker compose using the provided
run.sh
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.
-
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. -
Login with the values
DASHBOARD_USERNAME
andDASHBOARD_PASSWORD
fromlibs/.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
- http://localhost:8000/project/default/storage/buckets/superagent
- Click the drop-down next to the
superagent
stoage - Edit
- Set the toggle to
public
Supabase container logs
Stop supabase
Use the provided stop.sh
script to stop running services for supabase
Uninstall supabase
Use the provided uninstall.sh
script to remove the running services for supabase
, this will delete all data stored in the volumes.
Authentication Examples
GitHub Authentication Setup
-
Create a new GitHub OAuth app in your GitHub account
-
Copy the
CLIENT_ID
andCLIENT_SECRET
-
Set the following callback URL, for use with docker compose use
http://localhost:8000/auth/v1/callback
-
Update the environment variables:
- If using supabase via docker compose - Update the values in the Supabase .env file
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
andCLIENT_SECRET
- If using supabase via docker compose - Update the values in the Supabase .env file
-
Finally update the variables in the
libs/.docker/.env
file