Supabase with Docker on Debian 12 (PostgreSQL + Kong + Studio + SSL)

Supabase is an open-source backend-as-a-service (BaaS) platform designed to give developers Firebase-like features with full data control. It provides authentication, a RESTful and real-time API, storage management, and an admin dashboard, all powered by PostgreSQL. Supabase is ideal for teams who want rapid app development without giving up flexibility or ownership of their data.

Running Supabase on Debian 12 (Bookworm) with Docker offers a stable, secure, and long-term supported base for deploying self-hosted backend services. Debian’s proven reliability, paired with modern components like systemd 252, OpenSSL 3, and the latest Docker Engine and Compose plugin, makes it an excellent environment for hosting Supabase in production.


Architecture Overview

LayerComponentRole
OSDebian 12 (Bookworm)Stable, secure foundation with long-term support
Container RuntimeDocker Engine + ComposeOrchestrates Supabase and all dependent services
DatabasePostgreSQL 15Stores application, authentication, and metadata
API GatewayKongHandles routing, rate limiting, and JWT validation
RealtimeSupabase Realtime (Elixir)Pushes database change notifications over websockets
AuthSupabase Auth (GoTrue)Provides JWT-based authentication and user management
StorageSupabase StorageHandles file uploads and permissions linked to PostgreSQL
DashboardSupabase StudioWeb UI for managing users, database, and policies
TLSLet’s Encrypt / PKIEnables secure HTTPS access for APIs and the Studio console

Why Use Supabase?

  • Open-source alternative to Firebase with full backend control.
  • Powered by PostgreSQL – advanced SQL, JSONB, triggers, and extensions.
  • Integrated authentication – email, magic links, and OAuth providers.
  • Realtime data – event-driven updates using PostgreSQL replication.
  • Admin dashboard – manage schemas, policies, and storage visually.
  • Self-hosted – deploy anywhere with Docker or Kubernetes.

Supabase vs Other Backend Platforms

Feature/CapabilitySupabase (Self-hosted)Firebase (Google)Appwrite (Self-hosted)PocketBase (Lightweight)
DatabasePostgreSQLFirestore (NoSQL)MariaDB/PostgreSQLSQLite
HostingSelf-hosted or CloudSaaS onlySelf-hostedSelf-hosted
APIsREST + GraphQLProprietary SDKsREST + GraphQLREST
AuthenticationGoTrue (JWT + OAuth)Firebase AuthOAuth, JWTBuilt-in
Realtime updatesYesYes (Firestore)LimitedWebSocket
Open-sourceYesNoYesYes

Supabase shines when you need Firebase-like functionality but prefer the freedom and transparency of open-source infrastructure.


Security & Best Practices

  • Deploy behind Nginx or Traefik with SSL (HTTPS).
  • Generate strong JWT secrets using openssl rand -hex 32.
  • Store credentials securely in .env (never commit them to Git).
  • Restrict PostgreSQL access to internal Docker networks only.
  • Keep Docker images updated with docker compose pull.
  • Limit open ports using Debian’s UFW or nftables firewall.
  • Automate SSL renewals with Certbot or ACME clients.

Typical Use Cases

  • Web and mobile backends with real-time data sync.
  • Self-hosted Firebase replacement for compliance and data control.
  • Prototyping or MVPs that need instant backend APIs.
  • Enterprise systems requiring on-premises or private cloud deployment.
  • Realtime apps like chat, dashboards, IoT, and collaborative tools.

Deploying Supabase with Docker on Debian 12 gives you a scalable, secure, and open-source backend stack built on PostgreSQL — perfect for developers who want the power of Firebase with full ownership of their data and infrastructure.


Step 1: Create a Server Instance on Shape.Host

To begin, create a new Debian 12 VPS:

Log in to your Shape.Host dashboard.

Click Create → Instance.

Shape.host Resources dashboard with Create > Instance highlighted.

Choose your server location closest to your users.

Shape.host instance form with the data center location selector highlighted.

Select a plan with at least 4 CPUs, 8 GB RAM, and 40 GB SSD (recommended for Supabase).

Choose Debian 12 (64-bit) as your operating system.

Shape.host instance form with the operating system image selector highlighted.

Click Create Instance.

Shape.host instance form with the Create Instance button highlighted.

Copy your instance’s public IP address from the Resources section once it’s ready.

Shape.host Resources dashboard with the server IP address highlighted.

Step 2: Connect to Your Server

  • Linux/macOS: ssh root@your_server_ip
  • Windows (PuTTY):
    1. Open PuTTY, enter your server IP, and select SSH.
    2. Click Open and log in with your Shape.Host credentials.

Step 3: Install Docker and Docker Compose

Update your system:

apt update
Terminal showing APT package management commands and output.

Install dependencies:

apt install -y ca-certificates curl gnupg lsb-release
Terminal showing APT package management commands and output.

Add Docker’s official GPG key:

install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg
chmod a+r /etc/apt/keyrings/docker.gpg
Terminal showing apt commands or output during Install Docker and Docker Compose.

Add the Docker repository:

echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian \
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" > /etc/apt/sources.list.d/docker.list
Terminal showing APT package management commands and output.

Update again and install Docker Engine with plugins:

apt update
apt install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
Terminal showing APT package management commands and output.

Enable and start Docker:

systemctl enable docker
systemctl start docker

Step 4: Clone the Supabase Repository

Clone the official Supabase Docker setup:

git clone https://github.com/supabase/supabase.git
cd supabase/docker
Terminal showing systemd service management commands or output.

Copy the example environment file:

cp .env.example .env

Step 5: Configure Environment Variables

Open the .env file for editing:

nano .env

Update the following important variables with strong, unique values:

POSTGRES_PASSWORD=MyStrongP4ssword!
JWT_SECRET=$(openssl rand -hex 32)
ANON_KEY=myanonkey123456
SERVICE_ROLE_KEY=myservicerolekey456789
SECRET_KEY_BASE=$(openssl rand -hex 32)

SITE_URL=http://localhost:3000
SUPABASE_PUBLIC_URL=http://localhost:8000
API_EXTERNAL_URL=http://localhost:8000
KONG_HTTP_PORT=8000
KONG_HTTPS_PORT=8443

DOCKER_SOCKET_LOCATION=/var/run/docker.sock

STUDIO_DEFAULT_ORGANIZATION=MyOrg
STUDIO_DEFAULT_PROJECT=MyProject
Supabase environment configuration with database, authentication and dashboard settings.

💡 Tip:
Generate strong random strings for secrets using:

openssl rand -hex 32

Press CTRL + O, ENTER, then CTRL + X to save and exit.

Terminal showing file and directory setup commands.

Step 6: Fix Docker Socket Mount (Important)

Edit the Docker Compose file:

nano docker-compose.yml

Locate the line:

- ${DOCKER_SOCKET_LOCATION}:/var/run/docker.sock:ro,z

If ${DOCKER_SOCKET_LOCATION} is not defined, replace it with the absolute path:

- /var/run/docker.sock:/var/run/docker.sock:ro,z

Save and close the file.

Terminal showing docker commands or output during Fix Docker Socket Mount (Important).

Step 7: Launch Supabase Containers

Start Supabase with Docker Compose:

docker compose up -d
Terminal showing container image download progress.

Check running containers:

docker ps

You should see containers for services like:

  • kong
  • studio
  • rest
  • realtime
  • postgres
Terminal showing the Docker container listing.

Step 8: Access Supabase

Once all containers are running, access the Supabase Studio dashboard in your browser:

http://YOUR_SERVER_IP:8000

You’ll see the Supabase interface, allowing you to manage your database, authentication, APIs, and projects.

Browser authentication prompt for Supabase Studio.
Supabase Studio project overview with database and API tools.

Step 9: Manage the Stack

Stop Supabase:

docker compose down

Restart later:

docker compose up -d

View logs for troubleshooting:

docker compose logs -f

You installed Supabase with Docker on Debian 12, giving you a full self-hosted backend stack including PostgreSQL, authentication, storage, and APIs — all running securely in containers.

For best performance and reliability, deploy your applications on Shape.Host Cloud VPS, optimized for Docker and production workloads.