Database
Query your app's database, change rows and schema, ship functions, try changes on a branch, set up social sign-in, move files in and out of storage, and connect servers hosted elsewhere.
Your app runs on a Supabase database that Cofounder manages. Your agent queries it, changes its schema, deploys functions, and manages files, all through your Cofounder login. You never handle database passwords, and you handle a key only when you connect a server Cofounder doesn't host.
Your agent works on the company's default database and on production unless you name another database or a branch.
Query It
Ask your agent a question about your data and it runs the query:
cofounder database query "select count(*) from profiles"Queries are read-only; statements that change data are rejected. Use migrations for schema changes.
For structured table reads, use cofounder database rows read. For row changes,
use structured JSON operations with cofounder database execute. Both run as
the database service role and bypass row-level security (RLS). Update and delete
operations require equality filters and return the affected rows. Row limits
above 1000 are clamped to 1000.
cofounder database rows read --table profiles --column id --limit 20
cofounder database execute --operation update --table profiles --filters '{"id":"profile-123"}' --values '{"display_name":"Ada Lovelace"}' --yesInspect and Verify
Use cofounder database schema get to list tables and columns, then
cofounder database types generate after schema changes. Check security or
performance findings with cofounder database advisors list --kind security
and service health with cofounder database status get. Query logs with
cofounder database logs query using ClickHouse SQL against the unified
logs table. Filter with source = '<source>', such as
source = 'postgres_logs', and use log_attributes['key'] for nested fields.
Query windows can span at most 24 hours. Omit both start and end to query
only the last minute, and add a LIMIT clause to bound the result rows.
Change the Schema
Your agent writes migrations, commits them to your repository, and applies them. Only migrations committed to the repository run, never files on someone's machine. Production is the default target. Your agent can apply to staging first and preview a run without changing anything. Every deploy also runs migrations (see Deploy).
Try Changes on a Branch
A branch is a separate copy of your database for trying changes without touching production. A branch can be tied to a branch of your repository. Your agent can query, migrate, deploy functions, set secrets, and manage storage on a branch. Branches are billed under the company's existing database billing.
Preview changes with cofounder database branches diff --branch <name>
before merging. Merge applies the branch's migrations to the parent project.
Merge and reset run asynchronously, so poll
cofounder database branches get --branch <name> for status. Reset discards
the branch's changes and restores its schema to production.
cofounder database branches diff --branch feature
cofounder database branches merge --branch feature --yes
cofounder database branches get --branch feature
cofounder database branches reset --branch feature --yesDeploy Functions and Their Secrets
Edge Functions are server code that runs next to your database. Your agent deploys the function committed to your repository under a given name, to staging or production. Local files aren't read. Deploys take a moment, and your agent waits for the result. A function with no committed source, or one Supabase rejects, fails with the reason. Success confirms that Supabase lists the deployed version. If confirmation fails or deployment is interrupted, inspect the function before requesting another deployment: the upload may already have completed. A function can be set to accept calls without an auth token.
Your agent can set function secrets, and listing them shows names only, never values.
Delete one deployed function with
cofounder database functions delete --function-slug <name> --environment staging
or use prod for the managed database's production project. The function
source stays in your repository, so you can deploy it again later. The command
returns already_absent only after the selected project confirms the slug is
missing.
To enter a secret yourself, open Settings → Secrets in the dashboard and use Edge Function secrets under the database. Your agent gives you the link, with the database already selected, and confirms the names after you save.
Give Your App Its Database Keys
cofounder database env sync writes the database's URL and keys into a
hosting project's environment. Pass the app's hosting resource ID from
cofounder company resources list. It sets NEXT_PUBLIC_SUPABASE_URL,
NEXT_PUBLIC_SUPABASE_ANON_KEY, SUPABASE_URL, SUPABASE_ANON_KEY, and
SUPABASE_SERVICE_ROLE_KEY for Production, plus Preview and staging when both
the database and the project have staging. It overwrites existing values,
never shows them, and takes effect on the app's next deploy.
cofounder database env sync --hosting-resource-id <hosting-resource-id>To give a trusted Preview branch access to the production database, add
--production-credentials-preview-branch <branch> to the sync command.
The next build on that branch receives all five production variables,
including the service-role key, which lets server code bypass row-level security.
Before importing a different repository or disconnecting this one, remove the five
Supabase variable overrides for each granted branch in Vercel’s Preview environment.
Then retry the repository change. Production and default Preview variables can stay in place.
Set Up Social Sign-In
Let your app's users sign in with an account they already have. Supported
providers: bitbucket, discord, facebook, figma, github, google,
kakao, linkedin_oidc, notion, slack, slack_oidc, spotify,
twitch, twitter, x, and zoom. Use x for X's current OAuth 2.0
sign-in. twitter is its legacy OAuth 1.0a one. LinkedIn uses
linkedin_oidc and Slack's OIDC sign-in uses slack_oidc. Apple, Azure,
GitLab, Keycloak, and WorkOS aren't supported yet.
- Your agent checks which providers are on and which have credentials.
- You register the callback URL your agent gives you with your OAuth app.
- You save the client ID and secret one of two ways. Never paste a secret
into chat or put one in a link.
- In the dashboard: your agent sends you a setup link. It opens sign-in setup on the Secrets page with the database, the provider, and any branch already selected. Use this when only you have the secret.
- From the CLI: save the secret to a file, then run
cofounder database auth providers credentials update --provider github --client-id <id> --client-secret-file <file>. Pass--client-secret-file -to pipe it in instead. Your agent can run this for you when the secret is already in a file or another tool, never in chat.
- Your agent turns sign-in on. Saving credentials doesn't change whether sign-in is on, and your agent can turn it off again.
Changing one provider keeps saved credentials, other providers, and
email/password and SMTP settings. Your agent sees whether a secret is set,
never its value. It reads the settings back after a change but doesn't test a
sign-in. Sign-in email redirects and SMTP are set up
under cofounder email auth.
Move Files In and Out of Storage
Storage holds your app's files, organized in buckets. Paths look like
ss:///<bucket>/<path>.
Create a bucket before uploading files. Buckets are private by default.
Use --public only when anyone with an object URL should be able to download it.
You can limit upload sizes with --file-size-limit in bytes and restrict file
types with repeatable --allowed-mime-type flags.
cofounder database storage buckets create --bucket-id avatars --file-size-limit 1048576 --allowed-mime-type image/pngAn existing bucket name returns a conflict and leaves its settings unchanged.
cofounder database storage cp ./logo.png ss:///public/brand/logo.png --content-type image/png
cofounder database storage ls ss:///public/brand- Your agent copies one file at a time, up to 50 MiB, in either direction.
- An existing file isn't overwritten unless your agent asks for that.
- Moving a file stays within one bucket.
Delete a bucket only after removing the files you intend to delete.
A nonempty bucket is refused without deleting any files. A missing bucket
returns an error. If a create or delete result is unclear, use
cofounder database storage ls with the same --resource and --branch
before deciding whether to retry.
cofounder database storage buckets delete --bucket-id avatarsConnect a Server Hosted Elsewhere
Apps Cofounder hosts get their database keys automatically. When part of your app runs somewhere else, such as a VM, a container, or a worker, your agent issues that server its own key:
cofounder database credentials create --name phone_server- The result holds
SUPABASE_URLandSUPABASE_SECRET_KEY, shown once. Set them as environment variables where the server runs and use them with supabase-js. Never print or commit the key. - The key bypasses row-level security (RLS), so keep it on the server.
- Issue one credential per server. Listing them shows names only, never keys.
- To rotate, create a new credential, deploy it, then revoke the old one. A revoked key can keep working for about five minutes.
- Only a database Cofounder manages can issue credentials.
cofounder database credentials list
cofounder database credentials revoke --name phone_serverCommands
| MCP | CLI | API |
|---|---|---|
Pass --resource with a database's name or id to use another database, and
--branch <name> to work on a branch. Check migrations list or
branches get before retrying an apply or a branch delete with an unclear
result. functions deploy --no-verify-jwt deploys a function that accepts
calls without an auth token. Over MCP, database_storage_transfer returns a
signed link to upload or download with.