> For the complete documentation index, see [llms.txt](https://docs.genvibe.pro/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.genvibe.pro/integrations/supabase.md).

# Supabase (database & auth)

GenVibe uses **your own Supabase account** as your app's backend: a Postgres database, user sign-up and login, file storage and Edge Functions. Everything lives in a standard Supabase project that you own and can open in the Supabase dashboard at any time, so there is no lock-in.

This works for web apps (React, Next.js, Vue and more) and for mobile apps built with Expo.

## What GenVibe can do with Supabase

* Create a new Supabase project for you, or use one you already have
* Create tables and change your schema, recorded as SQL migrations
* Add sign-up and login with Supabase Auth, including "each user only sees their own data" rules
* Store uploaded files with Supabase Storage
* Write and deploy Edge Functions for server-side logic, such as webhooks or calls to private APIs
* Keep your own API keys encrypted and sync them to your Edge Functions as secrets

## Connect Supabase

1. Open your project and click **Connect Supabase**. GenVibe also shows this button in the chat when your app first needs a database.
2. Sign in to Supabase and approve GenVibe's access. GenVibe connects through Supabase's official sign-in (OAuth) and never sees your Supabase password.
3. Pick one of your existing projects, or create a new one.

If you ask for a database feature before connecting, GenVibe shows the **Connect Supabase** button in the chat and keeps building everything that doesn't need the database in the meantime.

## Build features that store data

Just ask. For example:

> Use Supabase to store submitted contact forms, and show them in an admin table.

> Add email/password login with Supabase so users can sign in and only see their own tasks.

> Let users upload a profile picture.

GenVibe creates the tables, access rules and storage it needs, then writes the code that reads and writes your data.

## How database changes are applied

GenVibe writes every schema change as a SQL migration, saves it in your project at `supabase/migrations/<name>.sql`, and applies it to your connected Supabase project. The migration files stay with your code, so you can review the history, apply the same changes to another project, or use them with the Supabase CLI.

{% hint style="warning" %}
Changes are applied to the project you connected. For an app that already has real users and data, connect a separate development project while you build, keep backups, and apply finished migrations to production yourself.
{% endhint %}

## Environment variables

When Supabase is connected, GenVibe adds your project URL and public (anon) key under the names your framework expects:

| Framework                            | Variables                                                   |
| ------------------------------------ | ----------------------------------------------------------- |
| Vite (React, Vue, Svelte and others) | `VITE_SUPABASE_URL`, `VITE_SUPABASE_ANON_KEY`               |
| Next.js                              | `NEXT_PUBLIC_SUPABASE_URL`, `NEXT_PUBLIC_SUPABASE_ANON_KEY` |
| Expo (mobile)                        | `EXPO_PUBLIC_SUPABASE_URL`, `EXPO_PUBLIC_SUPABASE_ANON_KEY` |

The anon key is designed to be used in front-end code. Who can read or change which rows is controlled by the access rules (row level security) on your tables.

## Edge Functions and your own API keys

For server-side logic, ask for it in plain words, for example *"verify Stripe payments in a webhook"*. GenVibe writes a Supabase Edge Function and deploys it to your project.

Put your own private keys, such as Stripe or OpenAI keys, in the **Cloud → Secrets** tab. They are encrypted, kept out of your code, and synced to your Supabase Edge Functions as secrets automatically. See [Cloud: files & API keys](/features/cloud-panel.md).

## Disconnect

Go to **Settings → Applications → Supabase** and click **Disconnect**. Your Supabase projects and data stay in your Supabase account. You can also revoke GenVibe's access from your Supabase organization settings.

## Tips

* Connect Supabase **before** asking for data features, so GenVibe can wire them up straight away.
* Be specific about what to store and who should see it, for example *"anyone can read posts, but only the author can edit theirs"*.
* Test with a throwaway account in the live preview: sign up, create some data, and check it appears.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.genvibe.pro/integrations/supabase.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
