Alibaba Cloud Supabase CLI

更新时间:
复制 MD 格式

Manage your AnalyticDB for PostgreSQL Supabase (AnalyticDB Supabase) projects from the command line. Create projects, run database operations, manage migrations, and deploy edge functions with Alibaba Cloud mode enabled by default.

Introduction

What is the Alibaba Cloud Supabase CLI

The Alibaba Cloud Supabase CLI extends the open-source Supabase CLI with full AnalyticDB Supabase platform support. It includes all standard Supabase features plus Alibaba Cloud-exclusive capabilities for infrastructure management and project operations.

Key benefits

  • Out of the box: Alibaba Cloud mode enabled by default — no --profile parameter needed.

  • Full-stack support: Project management, database operations, migrations, functions, secrets, and storage.

  • No Docker required: All core commands connect directly to the remote database without a local container environment.

  • Alibaba Cloud-exclusive: Manage VPCs, availability zones, and IP whitelists.

  • Multi-platform: Supports macOS, Linux, and Windows.

Use cases

  • Project management: Create, query, and delete AnalyticDB Supabase projects.

  • Local development: Pull the remote schema, push local migrations, and run SQL queries.

  • CI/CD integration: Automate database migrations and function deployments in your pipeline.

  • Operations and maintenance: View project status, manage secrets, and monitor the database schema.

Installation

Install Supabase CLI

Configure access credentials

Configure your Alibaba Cloud access credentials:

# Method 1: Environment variables (Recommended)
export ALIYUN_ACCESS_KEY_ID="your-access-key-id"
export ALIYUN_ACCESS_KEY_SECRET="your-access-key-secret"

# Method 2: Combined token
export ALIYUN_ACCESS_TOKEN="AccessKeyId|AccessKeySecret"

# Optional: Set the default region and database password
export ALIYUN_REGION_ID="cn-hangzhou"
export SUPABASE_DB_PASSWORD="your-db-password"

Supported commands

Project management (supabase projects)

Create, query, and delete AnalyticDB Supabase projects.

Command

Description

Example

projects list

Lists all projects.

supabase projects list

projects show [ref]

Shows details for a project.

supabase projects show sbp-xxxxxxx

projects api-keys

Shows the API keys for a project.

supabase projects api-keys --project-ref sbp-xxxxxxx

projects create [name]

Creates a new project.

supabase projects create "MyProject"

projects delete [ref]

Deletes a project.

supabase projects delete sbp-xxxxxxx

projects ip-whitelist [ref]

Updates the IP whitelist.

supabase projects ip-whitelist sbp-xxxxxxx --ip-list "192.168.1.0/24"

projects reset-password [ref]

Resets the database password.

supabase projects reset-password sbp-xxxxxxx --password "new-password"

Examples:

# List all projects
supabase projects list

# Show project details
supabase projects show sbp-3zyrsu6j0w4s****

# Show API keys
supabase projects api-keys --project-ref sbp-3zyrsu6j0w4s****

Infrastructure management (supabase infra)

Alibaba Cloud-exclusive commands for managing regions, VPCs, and vSwitches.

Command

Description

Example

infra regions

Lists available regions and availability zones.

supabase infra regions

infra vpcs

Lists the VPCs in a specified region.

supabase infra vpcs --region cn-hangzhou

infra vswitches

Lists the vSwitches in a specified VPC.

supabase infra vswitches --region cn-hangzhou --vpc-id vpc-xxx --zone-id cn-hangzhou-i

Examples:

# List all available regions
supabase infra regions

# List the VPCs in the China (Hangzhou) region
supabase infra vpcs --region cn-hangzhou

Project linking (supabase link)

Link a local project to a remote AnalyticDB Supabase project.

Command

Description

Example

link

Links to a remote project.

supabase link --project-ref sbp-xxxxxxx --password "db-password"

unlink

Unlinks from the current project.

supabase unlink

Example:

# Link to an Alibaba Cloud project
supabase link --project-ref sbp-3zyrsu6j0w4s**** --password '<your-db-password>'

Database management (supabase db)

Manage Postgres database schema, migrations, and queries.

Command

Description

Example

db tables list

Lists database tables.

supabase db tables list --project-ref sbp-xxxxxxx

db columns list

Lists the columns of a table.

supabase db columns list --project-ref sbp-xxxxxxx --table users

db indexes list

Lists indexes.

supabase db indexes list --project-ref sbp-xxxxxxx

db extensions list

Lists extensions.

supabase db extensions list --project-ref sbp-xxxxxxx

db diff

Shows the differences between local and remote database schemas.

supabase db diff --project-ref sbp-xxxxxxx --password "db-password"

db dump

Dumps the database schema.

supabase db dump --project-ref sbp-xxxxxxx --password "db-password" --file schema.sql

db pull

Pulls the remote schema.

supabase db pull --project-ref sbp-xxxxxxx --password "db-password"

db push

Pushes local migrations.

supabase db push --project-ref sbp-xxxxxxx --password "db-password"

db lint

Lints the schema for errors.

supabase db lint --project-ref sbp-xxxxxxx --password "db-password"

db query [sql]

Executes an SQL query.

supabase db query "SELECT * FROM users" --linked

Examples:

# List all tables
supabase db tables list --project-ref sbp-3zyrsu6j0w4s****

# View table structure
supabase db columns list --project-ref sbp-3zyrsu6j0w4s*** --table inventory

# Run an SQL query (requires a linked project)
supabase db query "SELECT * FROM public.inventory LIMIT 10" --linked

Migration management (supabase migration)

Manage database migration scripts and history.

Command

Description

Example

migration list

Lists migration records.

supabase migration list --project-ref sbp-xxxxxxx --password "db-password"

migration up

Applies pending migrations.

supabase migration up --project-ref sbp-xxxxxxx --password "db-password"

migration down

Rolls back a migration.

supabase migration down --linked --last 1

migration repair

Repairs the migration history.

supabase migration repair [version] --status reverted

migration new [name]

Creates a new migration file.

supabase migration new add_users_table

migration fetch

Fetches migration files.

supabase migration fetch --db-url "postgresql://..."

Examples:

# View migration history
supabase migration list --project-ref sbp-3zyrsu6j0w4s**** --password '<your-db-password>'

# Repair a migration status
supabase migration repair 20260416111028 --status reverted --project-ref sbp-3zyrsu6j0w4s****

Edge functions (supabase functions)

Deploy and invoke AnalyticDB Supabase edge functions.

Command

Description

Example

functions list

Lists all functions.

supabase functions list --project-ref sbp-xxxxxxx

functions deploy [slug]

Deploys a function.

supabase functions deploy hello-world

functions download [slug]

Downloads a function.

supabase functions download hello-world

functions delete [slug]

Deletes a function.

supabase functions delete hello-world

functions invoke [slug]

Invokes a function.

supabase functions invoke hello-world --data '{"name":"world"}'

Examples:

# List all functions
supabase functions list --project-ref sbp-3zyrsu6j0w4s****

# Deploy a function
supabase functions deploy hello-world --project-ref sbp-3zyrsu6j0w4s****

Secret management (supabase secrets)

Manage environment variables and secrets for AnalyticDB Supabase projects.

Command

Description

Example

secrets list

Lists all secrets.

supabase secrets list --project-ref sbp-xxxxxxx

secrets set [NAME=VALUE]

Sets a secret.

supabase secrets set MY_KEY=my-value

secrets unset [NAME]

Unsets a secret.

supabase secrets unset MY_KEY

Examples:

# List secrets
supabase secrets list --project-ref sbp-3zyrsu6j0w4s****

# Set a secret
supabase secrets set DATABASE_URL=postgresql://... --project-ref sbp-3zyrsu6j0w4s****

User management (supabase auth)

Alibaba Cloud-exclusive commands for managing Supabase Auth users.

Command

Description

Example

auth users list

Lists all users.

supabase auth users list --project-ref sbp-xxxxxxx

auth users get <id>

Shows details for a user.

supabase auth users get <user-id> --project-ref sbp-xxxxxxx

auth users create

Creates a user.

supabase auth users create --email user@example.com

auth users update <id>

Updates a user.

supabase auth users update <user-id> --email new@example.com

auth users delete <id>

Deletes a user.

supabase auth users delete <user-id>

Parameters for creating a user:

Parameter

Description

--email

The user's email address.

--phone

The user's phone number.

--password

The user's password.

--email-confirm

Automatically confirms the user's email address.

--phone-confirm

Automatically confirms the user's phone number.

Examples:

# List all users
supabase auth users list --project-ref sbp-xxxxxxx

# Create a user
supabase auth users create --email user@example.com --password 'SecurePass123' --project-ref sbp-xxxxxxx

# Update a user's email
supabase auth users update <user-id> --email new@example.com --project-ref sbp-xxxxxxx

# Delete a user
supabase auth users delete <user-id> --project-ref sbp-xxxxxxx

Storage management (supabase storage)

Manage buckets and files in AnalyticDB Supabase Storage.

Command

Description

Example

storage buckets list

Lists buckets.

supabase storage buckets list --project-ref sbp-xxxxxxx

storage buckets create [name]

Creates a bucket.

supabase storage buckets create my-bucket

storage buckets delete [name]

Deletes a bucket.

supabase storage buckets delete my-bucket

storage ls [path]

Lists files.

supabase storage ls s3://my-bucket/

storage cp [src] [dst]

Copies a file.

supabase storage cp local.txt s3://my-bucket/

storage mv [src] [dst]

Moves a file.

supabase storage mv s3://bucket/a.txt s3://bucket/b.txt

storage rm [path]

Deletes a file.

supabase storage rm s3://my-bucket/file.txt

Code generation (supabase gen)

Generate type definitions from your database schema.

Command

Description

Example

gen bearer-jwt

Generates a JWT.

supabase gen bearer-jwt

gen signing-key

Generates a signing key.

supabase gen signing-key

Supports TypeScript, Go, Swift, and Python.

Example:

# Generate TypeScript types
supabase gen types typescript --project-ref sbp-3zyrsu6j0w4s**** --password '<your-db-password>'

Quick start

Step 1: Configure your environment

export ALIYUN_ACCESS_KEY_ID="your-access-key-id"
export ALIYUN_ACCESS_KEY_SECRET="your-access-key-secret"
export SUPABASE_DB_PASSWORD="your-db-password"

Step 2: List all projects

supabase projects list

Step 3: Link a project

supabase link --project-ref sbp-3zyrsu6j0w4s**** --password '<your-db-password>'

Step 4: Show project details

supabase projects show sbp-3zyrsu6j0w4s****

Step 5: Query the database

# List all tables
supabase db tables list --project-ref sbp-3zyrsu6j0w4s****

# Run an SQL query
supabase db query "SELECT * FROM public.inventory LIMIT 10" --linked

Step 6: Pull the schema

# Pull the remote schema to your local environment
supabase db pull --project-ref sbp-3zyrsu6j0w4s**** --password '<your-db-password>'