generated from mintlify/starter
-
Couldn't load subscription status.
- Fork 13
Supabase guide #169
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Supabase guide #169
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,220 @@ | ||
| --- | ||
| title: Using Supabase with Hypermode | ||
| sidebarTitle: Supabase | ||
| description: | ||
| Connect your Hypermode agent to Supabase for real-time database operations | ||
| --- | ||
|
|
||
| <div className="flex items-center gap-3 mb-6"> | ||
| <img | ||
| src="/images/agents/connections/icons/supabase.svg" | ||
| alt="Supabase" | ||
| width={48} | ||
| height={48} | ||
| /> | ||
| <div> | ||
| <h2 className="text-2xl font-bold m-0">Supabase</h2> | ||
| <p className="text-gray-600 m-0"> | ||
| Open source PostgreSQL development platform | ||
| </p> | ||
| </div> | ||
| </div> | ||
|
|
||
| ## Overview | ||
|
|
||
| Supabase is an open source alternative to Firebase that provides a complete | ||
| backend solution with PostgreSQL at its core. This guide will walk you through | ||
| connecting your Hypermode agent to Supabase, enabling powerful database | ||
| operations and real-time interactions. | ||
|
|
||
| ## Prerequisites | ||
|
|
||
| Before connecting Supabase to Hypermode, you'll need: | ||
|
|
||
| 1. A [Supabase account](https://supabase.com/) | ||
| 2. A Supabase project with API credentials | ||
| 3. A [Hypermode workspace](https://hypermode.com/) | ||
|
|
||
| ## Setting up Supabase | ||
|
|
||
| ### Step 1: Create your Supabase account | ||
|
|
||
| If you haven't already, sign up for a free Supabase account. | ||
|
|
||
|  | ||
|
|
||
| ### Step 2: Generate API credentials | ||
|
|
||
| Navigate to your project settings and create a new API key: | ||
|
|
||
| 1. Go to **Settings** → **API** in your Supabase dashboard | ||
| 2. Create a new service role key (this bypasses Row Level Security) | ||
| 3. Copy your project URL to extract the subdomain ID | ||
|
|
||
|  | ||
|
|
||
| <Note> | ||
| The subdomain ID is the part before `.supabase.co` in the project URL. For | ||
| example, if the URL is `https://supa-project-id.supabase.co`, then the | ||
| subdomain ID is `supa-project-id`. | ||
| </Note> | ||
|
|
||
| ## Creating your Supabase agent | ||
|
|
||
| ### Step 1: Create a new agent | ||
|
|
||
| From the Hypermode interface, create a new agent manually: | ||
|
|
||
| 1. Click the agent dropdown menu | ||
| 2. Select "Create new Agent" | ||
|
|
||
|  | ||
|
|
||
| ### Step 2: Configure agent settings | ||
|
|
||
| Use these recommended settings for your Supabase agent: | ||
|
|
||
| - **Agent Name**: SupaAgent | ||
| - **Agent Title**: Connects to Supabase | ||
| - **Description**: SupaAgent issues queries | ||
| - **Instructions**: You have a connection to Supabase and various other | ||
| developer tools to streamline data access and awareness | ||
| - **Model**: GPT-4.1 | ||
|
|
||
|  | ||
|
|
||
| ### Step 3: View your agent profile | ||
|
|
||
| Once created, navigate to your agent's settings page to see the profile: | ||
|
|
||
|  | ||
|
|
||
| ## Connecting to Supabase | ||
|
|
||
| ### Step 1: Add the Supabase connection | ||
|
|
||
| Navigate to the **Connections** tab and add Supabase: | ||
|
|
||
| 1. Click "Add connection" | ||
| 2. Select "Supabase" from the dropdown | ||
|
|
||
|  | ||
|
|
||
| ### Step 2: Configure credentials | ||
|
|
||
| Enter your Supabase credentials: | ||
|
|
||
| - **Subdomain ID**: Your project reference `supa-project-id` | ||
| - **Service Key**: Your service role key from Supabase | ||
|
|
||
|  | ||
|
|
||
| <Warning> | ||
| Keep your service key secure! This key bypasses Row Level Security and should | ||
| never be exposed in client-side code. | ||
| </Warning> | ||
|
|
||
| ## Setting up your database | ||
|
|
||
| <Note> | ||
| The Supabase connector allows you to query and manipulate data but doesn't | ||
| modify schemas. You'll need to create your database schema directly in | ||
| Supabase. | ||
| </Note> | ||
|
|
||
| ### Step 1: Create your schema | ||
|
|
||
| Navigate to the SQL editor in your Supabase dashboard and run this example | ||
| schema: | ||
|
|
||
| ```sql | ||
| -- 1. Movies Table | ||
| CREATE TABLE IF NOT EXISTS public."Movies" ( | ||
| id SERIAL PRIMARY KEY, | ||
| title VARCHAR(255) NOT NULL, | ||
| year INTEGER | ||
| ); | ||
|
|
||
| -- 2. Actors Table | ||
| CREATE TABLE IF NOT EXISTS public."Actors" ( | ||
| id SERIAL PRIMARY KEY, | ||
| name VARCHAR(255) NOT NULL | ||
| ); | ||
|
|
||
| -- 3. MovieActors Join Table | ||
| CREATE TABLE IF NOT EXISTS public."MovieActors" ( | ||
| movie_id INTEGER NOT NULL REFERENCES public."Movies"(id) ON DELETE CASCADE, | ||
| actor_id INTEGER NOT NULL REFERENCES public."Actors"(id) ON DELETE CASCADE, | ||
| PRIMARY KEY (movie_id, actor_id) | ||
| ); | ||
| ``` | ||
|
|
||
|  | ||
|
|
||
| ### Step 2: View your schema | ||
|
|
||
| Confirm your tables are created successfully: | ||
|
|
||
|  | ||
|
|
||
| ### Step 3: Update agent instructions | ||
|
|
||
| For your agent to understand your database structure, update its instructions | ||
| with your schema information: | ||
|
|
||
|  | ||
|
|
||
| ## Testing the connection | ||
|
|
||
| ### Test 1: Query empty tables | ||
|
|
||
| Start a new thread and test with a simple query: | ||
|
|
||
| ```text | ||
| Can you list the movies? | ||
| ``` | ||
|
|
||
| You should see a Supabase tool call in the chat history, confirming the | ||
| connection works: | ||
|
|
||
|  | ||
|
|
||
| ### Test 2: Insert data | ||
|
|
||
| Now try adding data to your database: | ||
|
|
||
| ```text | ||
| Can you add The Matrix 1999 and Neo the actor into my Supabase database? | ||
| ``` | ||
|
|
||
|  | ||
|
|
||
| ## What you can do | ||
|
|
||
| With your Supabase connection established, your agent can: | ||
|
|
||
| - **Query data** with complex filters and joins | ||
| - **Insert, update, and delete** records | ||
| - **Execute transactions** for data consistency | ||
| - **Work with relationships** between tables | ||
| - **Integrate with other tools** like GitHub, Slack, and Stripe | ||
|
|
||
| ## Best practices | ||
|
|
||
| 1. **Schema documentation**: Keep your agent's instructions updated with your | ||
| current schema | ||
| 2. **Security**: Use Row Level Security policies for additional protection | ||
| 3. **Performance**: Create indexes for frequently queried columns | ||
| 4. **Error handling**: Your agent will handle common database errors gracefully | ||
|
|
||
| ## Learn more | ||
|
|
||
| - [Supabase Documentation](https://supabase.com/docs) | ||
| - [MCP Supabase Connector](https://mcp.pipedream.com/app/supabase) | ||
| - [PostgreSQL Best Practices](https://www.postgresql.org/docs/current/index.html) | ||
|
|
||
| <Tip> | ||
| Combine Supabase with other Hypermode connections to build powerful workflows. | ||
| For example, use GitHub to track code changes that affect your database, or | ||
| Slack to notify your team of important data updates. | ||
| </Tip> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -206,4 +206,6 @@ MRR | |
| LTV | ||
| CAC | ||
| upsell | ||
| will | ||
| will | ||
| signup | ||
| [sS]upabase | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.