Free

Supabase: set up data, sign-in and user permissions

Set up sign-in and record storage in Supabase for a practice app. Test returning users, files and isolation from other users' data.

Tools

Open the service · Getting started

Supabase combines a database, user sign-in and file storage. Start with one practice action: a user saves a record, returns after signing in again and cannot open someone else's record.

Tool features

Supabase suits apps needing a shared PostgreSQL database and ready-made sign-in. Check working database and auth connections before considering migration, which adds work and data-loss risk.

A local prototype may need only SQLite; PostgreSQL offers a standalone database. Supabase is useful when Auth and Storage are needed together. Compare options for your flow and current terms, including storage, backups and file transfer.

This guide uses the cloud dashboard. Local development has a separate CLI guide. Connecting an app to a cloud project does not require a local environment.

How to select a project and connect an app

  1. Ask Codex to find the code, schema and settings.
  2. Confirm organisation, project, database purpose and test or production environment. Create a project only when no suitable one exists.
  3. Prepare fictional records and two practice accounts.

Follow the API key guide to find the project URL and key type. Browsers use a publishable key, which identifies the app; Auth separately identifies the signed-in user. Server secret keys and legacy service_role bypass RLS and must never enter browser code, public files or Git. A first user flow usually does not need them.

Choose a library for the language and environment from official quick starts. Check installed versions and dependency files. Do not replace working keys from someone else's example: locate every usage and plan migration first.

How to configure records and permissions

One record with an owner and useful field is enough, such as a private note. Save schema changes through project tooling so they can repeat in another environment.

The Data API has two access layers. Grants control a role's table access; RLS controls which rows it can read or change. Check both and API-exposed schemas. Defaults need not match across projects.

Follow the RLS guide to protect API-exposed tables and use the real ownership model. For private records, users read and change only their rows. Updates must validate old and new ownership to prevent transferring a row by tampering with its owner field. Allow deletion only if needed.

Test direct API requests with a user session. Hiding buttons does not secure tables. Administrative-key checks do not validate user policies.

How to check sign-in and files

User A creates a record and sees it after refresh and a new sign-in. User B cannot read, update or delete it, even with its identifier. Unauthenticated requests receive only intended public access.

Repeat after deployment. If sign-in returns to localhost or the wrong place, compare Site URL, Redirect URLs and code against redirect documentation. Set an exact allowed production address and test addresses separately.

Use a private Storage bucket for private files with separate access checks. The bucket guide explains that anyone knowing a public-bucket URL can read it. Test private upload and download with two users; issue temporary signed URLs only to authorised recipients.

For empty reads, check session, row owner and RLS. For permission errors, check grants. If updates affect no row, check read access separately. Repeat A, B and guest tests after fixes.

How to save results and continue

Completion means records survive a new sign-in, other users cannot access them, and schema and policies are saved with the project. Record which app uses the database and where settings live without secret values.

Database backups do not contain Storage objects. Back up files separately. Before deleting a practice project, check dependent apps, export needed data and files, and test recovery on a separate copy, never over production.

Continue with web apps with accounts. Keep existing frontend hosting or use Vercel. Database and site can update independently; verify compatibility.

Prompt for the first flow

Paste into Codex or Work with project access:

Find my project, instructions, database schema and authorised Supabase connection. Confirm organisation, project and environment. Use the existing foundation; if no database exists, propose an option for the flow and current terms.
With fictional data, implement sign-in, creation of a private record and reading it after refresh and a new sign-in. Find the appropriate library and variable names. Use a publishable key and user session in the browser; keep server secrets out of chat and public code.
Save schema and policies through project tooling. Check Data API exposure, grants and RLS. User A should use their records; B and guests must not read or change A's private records, even by direct identifier requests. Test owner tampering. If files are needed, configure and test separate Storage policies.
Perform available actions yourself. Give me a specific step for sign-in or a necessary decision. After authorised deployment, repeat at the actual address and check sign-in redirects. Show actual results and methods for backing up the database and files and restoring to a separate copy.
In This Article
Saved