Skip to main content
The Supabase CLI is a powerful command-line tool that enables you to run the entire Supabase stack locally on your machine or in CI environments. It provides essential tools for local development, database migrations, type generation, and deployment workflows.

What is the Supabase CLI?

The Supabase CLI allows you to:
  • Run Supabase locally: Develop your project entirely on your local machine using Docker containers
  • Manage database migrations: Track and version your database schema changes with migration files
  • Generate TypeScript types: Automatically create type definitions from your database schema
  • Deploy to production: Push your local changes to the Supabase Platform
  • Set up CI/CD workflows: Integrate Supabase into your automated testing and deployment pipelines
The CLI uses Docker containers to manage the local development stack, so you’ll need Docker Desktop or a compatible container runtime installed.

Key Features

Local Development Stack

With just two commands, you can set up and start a complete local Supabase environment:
supabase init    # Create a new local project
supabase start   # Launch all Supabase services
This gives you access to:
  • PostgreSQL database: Full Postgres instance with extensions
  • Studio: Web-based database management interface
  • API Gateway: Kong-based gateway for REST, Realtime, Storage, and Auth
  • PostgREST: Automatic REST API from your database schema
  • GoTrue: Authentication and user management
  • Realtime: WebSocket-based subscriptions
  • Storage: Object storage for files
  • Mailpit: Email testing interface for auth emails

Database Migration Management

The CLI provides a complete migration workflow:
# Create a new migration
supabase migration new create_users_table

# Apply migrations
supabase migration up

# Generate migration from schema diff
supabase db diff -f my_changes

# Reset database with migrations
supabase db reset

Learn More

Explore database migration workflows and best practices

Type Generation

Automatically generate TypeScript types from your database schema:
supabase gen types typescript --local > types/supabase.ts
This ensures type safety across your entire application and keeps your types in sync with your database.

Testing and Linting

The CLI includes tools for testing and linting your database:
# Test your database with pgTAP
supabase test db

# Lint your database for common issues
supabase db lint

Quick Start

Get started with the Supabase CLI in minutes:
1

Install the CLI

Install the Supabase CLI using your preferred package manager.
brew install supabase/tap/supabase
2

Initialize your project

Create a new Supabase project in your current directory.
supabase init
3

Start local services

Launch the entire Supabase stack locally.
supabase start

Installation Guide

View detailed installation instructions for all platforms

Available Services

When you run supabase start, you’ll see output with URLs and credentials for all services:
Started supabase local development setup.

         API URL: http://localhost:54321
          DB URL: postgresql://postgres:postgres@localhost:54322/postgres
      Studio URL: http://localhost:54323
     Mailpit URL: http://localhost:54324
        anon key: eyJh......
service_role key: eyJh......

Studio

Access at http://localhost:54323 for visual database management

API Gateway

Access at http://localhost:54321 for REST, Realtime, Storage, and Auth

Database

Connect via postgresql://postgres:postgres@localhost:54322/postgres

Mailpit

Access at http://localhost:54324 to test authentication emails

Common Commands

Here are the most commonly used CLI commands:
CommandDescription
supabase initInitialize a new project
supabase startStart local Supabase services
supabase stopStop local services
supabase statusShow status of local services
supabase migration new <name>Create a new migration file
supabase migration upApply pending migrations
supabase db diffGenerate migration from schema changes
supabase db resetReset database and reapply migrations
supabase db pushPush migrations to remote database
supabase loginAuthenticate with Supabase Platform
supabase linkLink to a remote project
Use supabase --help or supabase <command> --help to see all available commands and options.

Next Steps

Installation

Install the CLI on your platform

Local Development

Set up your local development environment

Migrations

Learn how to manage database migrations

Deployment

Deploy your project to production

Resources

CLI Reference

Complete CLI command reference

GitHub Repository

View the source code and contribute

GitHub Action

Integrate with GitHub Actions

Community Support

Get help from the community