new·The score now tells you which way it movedA brain's exam only ever grows: its own material writes questions, and so does every question a real caller asked and did not get answered. The score is a percentage over that growing set, so a brain that learned more could post a smaller number — and this week three did. One of them answered two MORE questions than the week before and showed eighteen points less. Printed as a single percentage, that reads as decline to a reader and as punishment to anyone who contributes material.all news →
mozg.beta
Sign in

Supabase · all subjects

cli

99 notes in this subject, read out of this brain and free to use. This is page 2 of 2.

Backup before upgrading Supabase CLI

Before upgrading the CLI, stop and delete Supabase container data volumes to ensure managed services can apply new migrations on a clean database state. Backup your local schema and data first: `supabase db diff -f my_schema` and `supabase db dump --local --data-only > supabase/seed.sql`, then run `supabase stop --no-backup`. The `--no-backup` flag will delete data.

Local Supabase default URLs and ports

When `supabase start` completes, local services are available at: Studio (http://127.0.0.1:54323), Mailpit (http://127.0.0.1:54324), MCP (http://127.0.0.1:54321/mcp), Project URL (http://127.0.0.1:54321), REST (http://127.0.0.1:54321/rest/v1), GraphQL (http://127.0.0.1:54321/graphql/v1), Edge Functions (http://127.0.0.1:54321/functions/v1), and PostgreSQL (postgresql://postgres:postgres@127.0.0.1:54322/postgres).

Access local Supabase Studio

The local Supabase Studio graphical interface for working with your database is available at http://localhost:54323

Access local PostgreSQL database

The local Postgres instance can be accessed through `psql` or any Postgres client at `postgresql://postgres:postgres@localhost:54322/postgres`. Example: `psql 'postgresql://postgres:postgres@localhost:54322/postgres'`. When accessing from an edge function in the local Supabase setup, replace `localhost` with `host.docker.internal`.

Stop local Supabase services

Stop the Supabase stack without resetting your local database with: `supabase stop`

Disable Supabase CLI telemetry

Disable telemetry by running `supabase telemetry disable`. Check status and re-enable with `supabase telemetry status` and `supabase telemetry enable`. Alternatively, opt out using the environment variable `SUPABASE_TELEMETRY_DISABLED=1` or the broader `DO_NOT_TRACK=1` convention.

Supabase CLI basic setup commands

To set up and run the Supabase stack locally, use two commands: `supabase init` to create a new local project (creates a `supabase/` folder and `config.toml` file), then `supabase start` to launch the Supabase services. Both commands must be run from the same directory where `init` was executed.

CLI installation methods affect command syntax

The Supabase CLI can be installed as a project dependency (npm, pnpm, yarn, bun) or globally (Homebrew, Scoop, Linux packages). Project dependency installations have no global `supabase` command and require running commands through the package runner (e.g., `npx supabase <command>`). Global installs use `supabase <command>` directly. The CLI is project-scoped and expects to run inside a directory initialized with `supabase init`.

Node.js version requirement for npm CLI

The Supabase CLI requires Node.js 20 or later when run via `npx` or `npm`. Older Node.js versions, such as 16, are not supported and will fail to start the CLI.

Install Supabase CLI via npm

Install the CLI as a project dev dependency with `npm install supabase --save-dev` (or equivalent commands for pnpm, yarn, bun). Pin the version in `package.json` so your whole team uses the same CLI version. Run commands through your package runner with `npx supabase --help` (or `pnpm supabase`, `yarn supabase`, `bunx supabase`).

Install Supabase CLI via Homebrew

On macOS and Linux, install the CLI with Homebrew using: `brew install supabase/tap/supabase`

Lint database with plpgsql_check using CLI

The Supabase CLI provides Postgres linting using the `supabase db lint` command. This is powered by plpgsql_check, which leverages the internal Postgres parser/evaluator to catch errors that would occur at runtime.

supabase db lint command flags and options

The `supabase db lint` command accepts the following flags: --level (warning or error, default warning) to set the error level to emit, --linked to lint the linked project for schema errors, and -s or --schema (accepts multiple strings, default all) to list schemas to include.

Test database with pgTAP using CLI

The Supabase CLI provides Postgres linting and testing using the `supabase test db` command. This is powered by the pgTAP extension. Run `supabase test db --help` to see the available options.

Create test in Supabase CLI

Use the command 'supabase test new <test_name>.test' to create a new test file in the Supabase CLI.

Run database tests with Supabase CLI

Run all database tests using the command 'supabase test db'. This will execute all .test.sql files and report results.

Create new test file with CLI

Run 'supabase test new 000-setup-tests-hooks' to create a new test file.

Remove custom domain CLI command

Use the CLI command `supabase domains delete --project-ref abcdefghijklmnopqrst` to remove an activated custom domain. Removing a custom domain may cause issues with OAuth or SAML that require reversing the preparation steps taken before activation.

Remove vanity subdomain CLI command

Use the CLI command `supabase vanity-subdomains delete --project-ref abcdefghijklmnopqrst --experimental` to remove a vanity subdomain. Removing a subdomain may cause issues with OAuth or SAML that require reversing the preparation steps taken before activation.

Activate vanity subdomain CLI command

Use the CLI command `supabase vanity-subdomains activate --project-ref abcdefghijklmnopqrst --desired-subdomain my-example-brand --experimental` to activate and claim a vanity subdomain.

Check vanity subdomain availability CLI command

Use the CLI command `supabase vanity-subdomains check-availability --project-ref abcdefghijklmnopqrst --desired-subdomain my-example-brand --experimental` to check if a desired vanity subdomain is available.

Activate custom domain CLI command

Use the CLI command `supabase domains activate --project-ref abcdefghijklmnopqrst` to activate a custom domain for a project. After activation, Supabase serves requests from the new domain, but the original Supabase project domain continues to work and serve requests.

Detect bloat with Supabase CLI

Use the Supabase CLI to view dead tuples: npx supabase login, npx supabase init, npx supabase link, then npx supabase inspect db bloat --linked

Delete project via Supabase CLI

To delete a project using the Supabase CLI, run the command: supabase projects delete <project-ref>

Supabase CLI get network restrictions subcommand

Run `supabase network-restrictions get --project-ref {ref} --experimental` to retrieve current network restrictions. This command returns DB Allowed IPv4 CIDRs, DB Allowed IPv6 CIDRs, and a boolean indicating whether restrictions are applied successfully. If restrictions have never been applied, the allowed CIDRs lists are empty and Restrictions applied successfully is false.

Supabase CLI update network restrictions subcommand

Run `supabase network-restrictions update --project-ref {ref} --db-allow-cidr <CIDR> [--db-allow-cidr <CIDR> ...] --experimental` to update network restrictions. CIDRs you provide replace any previously applied restrictions. To keep existing restrictions, include them alongside any new CIDRs in the update command.

Supabase CLI append network restrictions flag

Use the `--append` flag with the `supabase network-restrictions update` command to add a CIDR without replacing existing restrictions. Example: `supabase network-restrictions update --project-ref {ref} --db-allow-cidr 1.2.3.4/32 --append --experimental`

Supabase CLI remove all network restrictions

To remove all network restrictions, run `supabase network-restrictions update --project-ref {ref} --db-allow-cidr 0.0.0.0/0 --db-allow-cidr ::/0 --experimental`. This allows all IPv4 and IPv6 addresses to connect.

Network restrictions CLI requirements

To configure network restrictions with the CLI, you need Supabase CLI version 1.22.0 or higher. If your project was created before December 23, 2022, you must upgrade it to the latest Supabase version before using network restrictions.

CLI requirements for managing SSL enforcement

To manage SSL enforcement via CLI, you need Supabase CLI version 1.37.0 or later installed and you must be logged into your Supabase account using the CLI. You must also have Owner or Admin permissions for the project on which you are enabling SSL enforcement.

Check SSL enforcement status via CLI

Use the supabase ssl-enforcement get command with --project-ref and --experimental flags to check whether SSL is currently being enforced. The response will be 'SSL is being enforced.' if enabled or 'SSL is *NOT* being enforced.' if disabled.

Update SSL enforcement via CLI

Use the supabase ssl-enforcement update command to change the SSL enforcement status. Use --enable-db-ssl-enforcement flag to enable SSL enforcement or --disable-db-ssl-enforcement flag to disable it. Both require --project-ref and --experimental flags. Requires Supabase CLI version 1.37.0 or later.

Link local project to remote project

Use 'supabase link --project-ref <project-id>' to associate your local project with a remote project on the Supabase Platform. The project-id can be found in your project's dashboard URL: https://supabase.com/dashboard/project/<project-id>.

Log in to Supabase CLI

Run 'supabase login' or 'npx supabase login' to authenticate with the Supabase CLI before deploying to the platform.

Backup database with CLI commands

To backup a Supabase database using the CLI, run three commands in sequence: (1) supabase db dump --db-url [CONNECTION_STRING] -f roles.sql --role-only to backup roles, (2) supabase db dump --db-url [CONNECTION_STRING] -f schema.sql to backup schema, (3) supabase db dump --db-url [CONNECTION_STRING] -f data.sql --use-copy --data-only -x "storage.buckets_vectors" -x "storage.vector_indexes" to backup data while excluding storage vectors. Replace [CONNECTION_STRING] with your actual database connection string.

Supabase local project setup with yarn

To initialize a local Supabase project using yarn, run: yarn supabase init. To start the local Supabase stack using yarn, run: yarn supabase start.

Install Supabase CLI as a project dependency

To install Supabase CLI as a project dependency, use one of the following commands based on your package manager: **Using npm:** ``` npm install supabase --save-dev ``` This installs the CLI into your project as a dev dependency, which you run through `npx supabase`. **Using pnpm:** ``` pnpm add supabase --save-dev --allow-build=supabase ``` This installs the CLI into your project as a dev dependency, which you run through `pnpm supabase`. Note: The `--allow-build=supabase` flag is required for pnpm version 10 or higher. For older versions of pnpm, omit this flag.

Update Supabase CLI

The Supabase CLI can be updated using different package managers: **Homebrew:** Update with `brew upgrade supabase`. For the beta channel, use `brew upgrade supabase-beta`. **Scoop:** Update with `scoop update supabase`. For the beta channel, use `scoop update supabase-beta`.

Supabase CLI commands for pnpm

To initialize a local Supabase project using pnpm, run: pnpm supabase init To start the local Supabase stack using pnpm, run: pnpm supabase start

Give your agent this brain