Skip to main content

Setting Up Supabase via Command Line

For developers and teams who prioritize automation, version control, or deployment on remote servers, the command-line approach provides flexibility and repeatability. Using Docker and Docker Compose directly allows you to manage Supabase stacks efficiently and integrate the process into scripts or CI/CD pipelines.

Step 1. Install Docker and Docker Compose

       Linux:

sudo apt update

embedded-image-k6yxbegu.pngembedded-image-fc2qlw15.png

sudo apt install docker.io docker-compose -y

embedded-image-iqlezy0n.pngembedded-image-bgiksi0i.png

 

       Windows/macOS: Docker Desktop includes both tools, so no additional installation is needed.

Verify Docker is running before proceeding.

Step 2. Clone the Supabase Repository

git clone https://github.com/supabase/supabase.git

cd supabase/docker

embedded-image-wygkyqam.pngembedded-image-fpr9xyu9.png

This repository contains the docker-compose.yml configuration defining all core services: PostgreSQL, APIs, authentication, Realtime, storage, and Supabase Studio.

Step 3. Configure Environment Variables

Copy the example environment file and customize it:

cp .env.example .env

embedded-image-2dsuuiz4.pngembedded-image-t2zgjohp.png

Edit .env to set your credentials and keys:

       POSTGRES_PASSWORD: PostgreSQL database password

       JWT_SECRET: authentication token secret

       ANON_KEY and SERVICE_ROLE_KEY: API access keys

Properly securing these values is critical, especially in production environments.

Step 4. Launch Supabase

Start the services in detached mode:

docker compose up -d

embedded-image-lgpnyu0p.pngembedded-image-5bbaymwg.png

Docker Compose pulls all necessary images and runs the containers, including database, authentication, Realtime, API, and Studio.

Step 5. Verify and Access the Platform

Check that all containers are running:

docker ps

embedded-image-q8gahagc.pngembedded-image-sbn8lk4n.png

Then open Supabase Studio in your browser:
 http://localhost:3000

embedded-image-5j1agwyc.pngembedded-image-ltfitsoh.png

You now have full access to your self-hosted backend.