Running locally
If you don’t want to use the Superagent Cloud you can optionally run Superagent localy. In order to make Superagent more modular we have decoupled the Superagent API from the Superagent UI. You can run the API directly by just leveraging the SDKs. Follow the guides below to get started.
Setup Superagent API
Getting started
-
Clone the Superagent repository and open the superagent folder.
-
Navigate to
libs/superagent
and copy the.env.example
to a new file named.env
.
Set .env
variables
In order to get Superagent running we need to set some mandatory environment variables. Here is an example:
Create a virtual env
In the console, create a virtual environment to install and run the python api.
Then activate the new virtual environment to work in it.
Install dependencies
Use poetry to install the project dependencies in the virtual environment
Start Supabase
Get Supabase Info
Get the hostname and port of your Supabase instance and replace them in the DATABASE_URL
and DATABASE_MIGRATION_URL
variable in your .env
file.
Run database migrations
Start the server
Use local API with the Superagent SDK
And that’s it! You now have an instance of the Superagent API running on your local machine. Make sure to checkout the REST API reference for more details on each API endpoint or visit http://127.0.0.1:8000 to view the Swagger docs.
Setup Superagent UI
Setup Supabase
The Superagent UI is setup using Supabase. It leverages the Supabase’s Auth
and Storage
modules. Configure your Supabase setup as per the instructions below:
- Clone the Superagent repository
-
Navigate to
/libs/ui
-
Install Supabase CLI and create project: https://supabase.com/docs/guides/cli/getting-started
-
Start the local Supabase project
- Run the database migrations
- Create a Supabase storage with the following
storage.objects
permissions:
Setup authentication
Superagent supports password-less authentication and GitHub OAuth. You may add which ever Authentication provider supported by Supabase.
-
Create a new GitHub OAuth app in your GitHub account
-
Copy the
CLIENT_ID
andCLIENT_SECRET
and paste them into the/libs/ui/.env
variables in your local Superagent project. -
Set the following callback URL
- Navigate to your Supabase project you have created for Superagent UI and paste the
CLIENT_ID
andCLIENT_SECRET
NOTE: You can enable any provider using the steps above.
Set .env
variables
-
Change the name of
.env.example
to.env
in/libs/ui
. -
Set the required environment variables.
Run app
- From inside
/libs/ui
run:
- Start the app
You should now be able to visit http://localhost:3000 and see the Superagent login page