{"id":1840,"date":"2026-09-05T09:24:25","date_gmt":"2026-09-05T03:54:25","guid":{"rendered":"https:\/\/cpanelfree.com\/blog\/how-to-self-host-supabase-alternative-firebase-vps\/"},"modified":"2026-09-05T12:57:40","modified_gmt":"2026-09-05T07:27:40","slug":"how-to-self-host-supabase-alternative-firebase-vps","status":"publish","type":"post","link":"https:\/\/cpanelfree.com\/blog\/how-to-self-host-supabase-alternative-firebase-vps\/","title":{"rendered":"How to Self-Host Supabase on Ubuntu VPS with Docker (Free Firebase Alternative)"},"content":{"rendered":"<h2>Why Self-Host Supabase on Your Own Cloud VPS?<\/h2>\n<p>Supabase is the premier open-source alternative to Google Firebase. It provides developers with a full enterprise stack: an ACID-compliant PostgreSQL database, automated instant REST and GraphQL APIs (PostgREST), real-time WebSocket subscriptions, complete user authentication with OAuth providers (GoTrue), AI vector embeddings (pgvector), and a web-based administrative Studio dashboard.<\/p>\n<p>While Supabase Cloud offers a generous managed tier, high-concurrency applications, vector search workloads, and large file storage pools can quickly exceed free allowances. Self-hosting Supabase on an Ubuntu Cloud VPS provides 100% data sovereignty, zero database row limits, unlimited storage volumes, and total freedom to customize PostgreSQL extensions\u2014without recurring SaaS bills.<\/p>\n<p>In this technical deployment playbook, we will configure official Supabase Docker Compose on Ubuntu 24.04\/22.04 LTS, generate production cryptographic secrets, configure PostgreSQL with pgvector, and expose the Studio dashboard securely behind an Nginx reverse proxy with SSL encryption.<\/p>\n<h2>Step 1: Installing Docker Engine and Git<\/h2>\n<p>Ensure your Ubuntu VPS has Docker Engine and Docker Compose V2 installed:<\/p>\n<pre><code># Update package list and install Docker prerequisite tools\nsudo apt update &amp;&amp; sudo apt install -y curl git openssl ca-certificates\n\n# Install official Docker CE and compose plugin\ncurl -fsSL https:\/\/get.docker.com | sudo sh\nsudo systemctl enable --now docker<\/code><\/pre>\n<h2>Step 2: Cloning the Official Supabase Docker Repository<\/h2>\n<p>Clone the official Supabase repository and navigate to the production Docker directory:<\/p>\n<pre><code># Clone Supabase repository\ngit clone --depth 1 https:\/\/github.com\/supabase\/supabase \/var\/www\/supabase\n\n# Enter docker orchestration folder\ncd \/var\/www\/supabase\/docker\n\n# Copy production environment template\ncp .env.example .env<\/code><\/pre>\n<h2>Step 3: Generating Cryptographic Security Secrets<\/h2>\n<p>Never run Supabase in production with default secrets. You must generate unique cryptographic tokens for JWT signing, database root credentials, and API secret keys:<\/p>\n<pre><code># Generate random 32-character database and JWT secrets\nopenssl rand -hex 32\nopenssl rand -hex 32\nopenssl rand -base64 32<\/code><\/pre>\n<p>Edit <code>\/var\/www\/supabase\/docker\/.env<\/code> and configure the following essential environment keys:<\/p>\n<pre><code># Database Credentials\nPOSTGRES_PASSWORD=YourStrongDatabasePassword2026!\nPOSTGRES_DB=postgres\n\n# API &amp; Studio Security\nJWT_SECRET=YourSuperLongJwtSecretKeyAtLeast32Chars!\nANON_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...\nSERVICE_ROLE_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...\n\n# Web Dashboard Credentials\nDASHBOARD_USERNAME=admin\nDASHBOARD_PASSWORD=UltraSecureAdminPass2026!\n\n# Public Base URLs\nSITE_URL=https:\/\/app.example.com\nAPI_EXTERNAL_URL=https:\/\/supabase.example.com<\/code><\/pre>\n<h2>Step 4: Launching Supabase Fleet via Docker Compose<\/h2>\n<p>Start the Supabase microservices cluster in background daemon mode:<\/p>\n<pre><code># Pull latest container images and launch cluster\ndocker compose up -d\n\n# Verify that all 11 Supabase services are healthy\ndocker compose ps<\/code><\/pre>\n<h2>Step 5: Nginx Reverse Proxy Configuration &amp; SSL Setup<\/h2>\n<p>Expose the Supabase Kong API gateway (port 8000) and Studio dashboard (port 3000 or 8000) via Nginx at <code>\/etc\/nginx\/sites-available\/supabase.example.com<\/code>:<\/p>\n<pre><code>server {\n    listen 80;\n    server_name supabase.example.com;\n\n    client_max_body_size 100M;\n\n    location \/ {\n        proxy_pass http:\/\/127.0.0.1:8000;\n        proxy_http_version 1.1;\n        proxy_set_header Upgrade $http_upgrade;\n        proxy_set_header Connection \"upgrade\";\n        proxy_set_header Host $host;\n        proxy_set_header X-Real-IP $remote_addr;\n        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;\n        proxy_set_header X-Forwarded-Proto $scheme;\n    }\n}<\/code><\/pre>\n<p>Activate the configuration and issue a free Let&#8217;s Encrypt SSL certificate:<\/p>\n<pre><code>sudo ln -s \/etc\/nginx\/sites-available\/supabase.example.com \/etc\/nginx\/sites-enabled\/\nsudo nginx -t &amp;&amp; sudo systemctl reload nginx\nsudo certbot --nginx -d supabase.example.com<\/code><\/pre>\n<h2>Supabase Architecture Component Overview<\/h2>\n<table style=\"width: 100%;border-collapse: collapse;margin: 20px 0;border: 1px solid #334155\">\n<thead>\n<tr style=\"background-color: #0f172a;color: #38bdf8\">\n<th style=\"padding: 12px;border: 1px solid #334155\">Component<\/th>\n<th style=\"padding: 12px;border: 1px solid #334155\">Underlying Technology<\/th>\n<th style=\"padding: 12px;border: 1px solid #334155\">Function<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr style=\"background-color: #1e293b;color: #f8fafc\">\n<td style=\"padding: 10px;border: 1px solid #334155\"><strong>PostgreSQL 15<\/strong><\/td>\n<td style=\"padding: 10px;border: 1px solid #334155\">Custom Engine + pgvector<\/td>\n<td style=\"padding: 10px;border: 1px solid #334155\">Core relational &amp; vector embedding database<\/td>\n<\/tr>\n<tr style=\"background-color: #0f172a;color: #f8fafc\">\n<td style=\"padding: 10px;border: 1px solid #334155\"><strong>GoTrue<\/strong><\/td>\n<td style=\"padding: 10px;border: 1px solid #334155\">Go Authentication Server<\/td>\n<td style=\"padding: 10px;border: 1px solid #334155\">Handles user signups, logins, JWTs, and OAuth<\/td>\n<\/tr>\n<tr style=\"background-color: #1e293b;color: #f8fafc\">\n<td style=\"padding: 10px;border: 1px solid #334155\"><strong>PostgREST<\/strong><\/td>\n<td style=\"padding: 10px;border: 1px solid #334155\">Haskell Web Server<\/td>\n<td style=\"padding: 10px;border: 1px solid #334155\">Converts PostgreSQL schema into instant REST APIs<\/td>\n<\/tr>\n<tr style=\"background-color: #0f172a;color: #f8fafc\">\n<td style=\"padding: 10px;border: 1px solid #334155\"><strong>Realtime<\/strong><\/td>\n<td style=\"padding: 10px;border: 1px solid #334155\">Elixir Phoenix Engine<\/td>\n<td style=\"padding: 10px;border: 1px solid #334155\">Broadcasts database changes via WebSockets<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2>Production Security &amp; Backup Checklist<\/h2>\n<ul>\n<li><strong>Automate PostgreSQL Dumps:<\/strong> Schedule a nightly <code>docker exec -t supabase-db pg_dumpall -U postgres | gzip &gt; \/backups\/supabase.sql.gz<\/code> cron job.<\/li>\n<li><strong>Restrict Direct Database Access:<\/strong> Keep port <code>5432<\/code> bound to <code>127.0.0.1<\/code> and access via SSH tunneling or internal Docker networks only.<\/li>\n<li><strong>Enable Rate Limiting in Kong:<\/strong> Configure request throttling on authentication endpoints to prevent brute-force attacks.<\/li>\n<\/ul>\n<h2>Enabling and Leveraging pgvector for AI &amp; LLM Embeddings<\/h2>\n<p>One of Supabase&#8217;s most compelling capabilities is native support for <strong>pgvector<\/strong>, allowing you to store high-dimensional vector embeddings generated by OpenAI, Anthropic, or HuggingFace directly alongside your relational application data for semantic search and Retrieval-Augmented Generation (RAG):<\/p>\n<pre><code>-- Enable pgvector extension in Supabase PostgreSQL CLI\nCREATE EXTENSION IF NOT EXISTS vector;\n\n-- Create documents table with vector embeddings\nCREATE TABLE documentation_embeddings (\n    id BIGSERIAL PRIMARY KEY,\n    content TEXT,\n    embedding VECTOR(1536),\n    created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW()\n);\n\n-- High-speed Cosine Similarity Index\nCREATE INDEX ON documentation_embeddings USING ivfflat (embedding vector_cosine_ops) WITH (lists = 100);<\/code><\/pre>\n<h2>Automating Disaster Recovery &amp; Nightly PostgreSQL Backups<\/h2>\n<p>Protect your database by creating a persistent backup cron script at <code>\/usr\/local\/bin\/backup-supabase.sh<\/code>:<\/p>\n<pre><code>#!\/bin\/bash\nset -e\nBACKUP_DIR=\"\/var\/backups\/supabase\/$(date +%Y%m%d)\"\nmkdir -p $BACKUP_DIR\n\n# Export compressed dump of entire PostgreSQL database cluster\ndocker exec -t supabase-db pg_dumpall -U postgres | gzip &gt; $BACKUP_DIR\/supabase_all.sql.gz\n\n# Delete backups older than 30 days\nfind \/var\/backups\/supabase\/ -type d -mtime +30 -exec rm -rf {} +\necho \"Supabase database backup completed successfully!\"<\/code><\/pre>\n<h2>Supabase Microservices Port &amp; Resource Allocation<\/h2>\n<table style=\"width: 100%;border-collapse: collapse;margin: 20px 0;border: 1px solid #334155\">\n<thead>\n<tr style=\"background-color: #0f172a;color: #38bdf8\">\n<th style=\"padding: 12px;border: 1px solid #334155\">Service Name<\/th>\n<th style=\"padding: 12px;border: 1px solid #334155\">Container Port<\/th>\n<th style=\"padding: 12px;border: 1px solid #334155\">Memory Limit<\/th>\n<th style=\"padding: 12px;border: 1px solid #334155\">Role<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr style=\"background-color: #1e293b;color: #f8fafc\">\n<td style=\"padding: 10px;border: 1px solid #334155\"><strong>supabase-db<\/strong><\/td>\n<td style=\"padding: 10px;border: 1px solid #334155\">5432 (Internal)<\/td>\n<td style=\"padding: 10px;border: 1px solid #334155\">1,024 MB<\/td>\n<td style=\"padding: 10px;border: 1px solid #334155\">PostgreSQL 15 Relational Core<\/td>\n<\/tr>\n<tr style=\"background-color: #0f172a;color: #f8fafc\">\n<td style=\"padding: 10px;border: 1px solid #334155\"><strong>supabase-kong<\/strong><\/td>\n<td style=\"padding: 10px;border: 1px solid #334155\">8000 (HTTP)<\/td>\n<td style=\"padding: 10px;border: 1px solid #334155\">256 MB<\/td>\n<td style=\"padding: 10px;border: 1px solid #334155\">API Gateway &amp; Authentication Router<\/td>\n<\/tr>\n<tr style=\"background-color: #1e293b;color: #f8fafc\">\n<td style=\"padding: 10px;border: 1px solid #334155\"><strong>supabase-studio<\/strong><\/td>\n<td style=\"padding: 10px;border: 1px solid #334155\">3000 (Internal)<\/td>\n<td style=\"padding: 10px;border: 1px solid #334155\">384 MB<\/td>\n<td style=\"padding: 10px;border: 1px solid #334155\">Visual Web Management GUI<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<div style=\"background-color: #0f172a;border-left: 4px solid #38bdf8;padding: 18px 24px;margin: 30px 0;border-radius: 8px\">\n<h3 style=\"color: #38bdf8;margin-top: 0\">Recommended Related Technical Guides<\/h3>\n<ul style=\"margin-bottom: 0;color: #cbd5e1\">\n<li><a href=\"https:\/\/cpanelfree.com\/blog\/how-to-run-docker-docker-compose-cheap-linux-vps\/\" style=\"color: #38bdf8;text-decoration: underline\">Running Docker and Docker Compose on Cheap Linux VPS<\/a><\/li>\n<li><a href=\"https:\/\/cpanelfree.com\/blog\/how-to-host-strapi-headless-cms-linux-vps-postgresql-pm2\/\" style=\"color: #38bdf8;text-decoration: underline\">Hosting Strapi CMS on Linux VPS with PostgreSQL<\/a><\/li>\n<li><a href=\"https:\/\/cpanelfree.com\/blog\/how-to-deploy-nodejs-express-app-linux-vps-nginx-pm2\/\" style=\"color: #38bdf8;text-decoration: underline\">Deploying Node.js &amp; Express Backends with PM2<\/a><\/li>\n<\/ul>\n<\/div>\n<div style=\"background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);color: #ffffff;padding: 28px;border-radius: 12px;margin: 35px 0;text-align: center\">\n<h3 style=\"color: #ffffff;margin-top: 0;font-size: 22px\">Host Scalable Databases &amp; APIs on CpanelFree Cloud VPS<\/h3>\n<p style=\"color: #e0f2fe;font-size: 15px;max-width: 650px;margin: 0 auto 18px auto\">Experience unthrottled CPU compute, pure NVMe SSDs, and 100% free hosting and VPS servers engineered for high-concurrency database workloads.<\/p>\n<p>  <a href=\"https:\/\/cpanelfree.com\/\" style=\"background-color: #ffffff;color: #0284c7;font-weight: 700;padding: 12px 28px;border-radius: 8px;text-decoration: none;display: inline-block\">Get Free Cloud Hosting Today &rarr;<\/a>\n<\/div>\n<div style=\"border-left: 4px solid #38bdf8;border-radius: 8px;padding: 20px;margin: 30px 0\">\n<h3 style=\"margin-top: 0;color: #38bdf8;font-size: 18px;display: flex;align-items: center\">\n        <span style=\"margin-right: 8px\">\ud83d\udd17<\/span> Recommended Related Technical Guides:<br \/>\n    <\/h3>\n<ul style=\"margin: 10px 0 0 0;padding-left: 20px;line-height: 1.8\">\n<li><a href=\"https:\/\/cpanelfree.com\/blog\/how-to-host-website-free-forever-guide\/\" style=\"color: #38bdf8;text-decoration: none;font-weight: 600\">How to Host a Website for Free Forever: Complete Beginner Guide (2026)<\/a><\/li>\n<li><a href=\"https:\/\/cpanelfree.com\/blog\/free-wordpress-hosting-softaculous-installer\/\" style=\"color: #38bdf8;text-decoration: none;font-weight: 600\">Top 5 Free WordPress Hosting Services with 1-Click Softaculous Installer<\/a><\/li>\n<li><a href=\"https:\/\/cpanelfree.com\/blog\/how-to-backup-linux-vps-to-cloud-storage-s3-rclone\/\" style=\"color: #38bdf8;text-decoration: none;font-weight: 600\">How to Automatically Backup Your Linux VPS to Cloud Storage (S3 \/ Rclone Guide)<\/a><\/li>\n<li><a href=\"https:\/\/cpanelfree.com\/blog\/how-to-setup-clickhouse-fast-analytics-database-vps\/\" style=\"color: #38bdf8;text-decoration: none;font-weight: 600\">How to Install ClickHouse Columnar Database on Ubuntu VPS for Real-Time Big Data Analytics<\/a><\/li>\n<li><a href=\"https:\/\/cpanelfree.com\/#plans\" style=\"color: #10b981;text-decoration: none;font-weight: 600\">Explore $0 Free cPanel Web Hosting Plans (NVMe SSD, AutoSSL)<\/a><\/li>\n<\/ul>\n<\/div>\n<div style=\"background: linear-gradient(135deg, rgba(6, 182, 212, 0.15) 0%, rgba(59, 130, 246, 0.15) 100%);border-radius: 12px;padding: 25px;margin: 30px 0;text-align: center\">\n<h3 style=\"color: #38bdf8;margin-top: 0;font-size: 20px\">Deploy Fast, Reliable Web Hosting on CpanelFree<\/h3>\n<p style=\"color: #94a3b8;font-size: 14px;line-height: 1.6;max-width: 600px;margin: 0 auto 15px\">\n        Get genuine cPanel control, unmetered NVMe SSD storage, and free AutoSSL at $0 cost forever.\n    <\/p>\n<p>    <a href=\"https:\/\/cpanelfree.com\/#plans\" style=\"display: inline-block;background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);color: #ffffff;padding: 10px 22px;border-radius: 6px;text-decoration: none;font-weight: bold;font-size: 14px\">Claim Free Hosting Account<\/a>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Why Self-Host Supabase on Your Own Cloud VPS? Supabase is the premier open-source alternative to Google Firebase. It provides developers with a full enterprise stack: an ACID-compliant PostgreSQL database, automated instant REST and GraphQL APIs (PostgREST), real-time WebSocket subscriptions, complete user authentication with OAuth providers (GoTrue), AI vector embeddings (pgvector), and a web-based administrative Studio [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":2492,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[166],"tags":[],"class_list":["post-1840","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-developer-stacks"],"_links":{"self":[{"href":"https:\/\/cpanelfree.com\/blog\/wp-json\/wp\/v2\/posts\/1840","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/cpanelfree.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cpanelfree.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cpanelfree.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/cpanelfree.com\/blog\/wp-json\/wp\/v2\/comments?post=1840"}],"version-history":[{"count":2,"href":"https:\/\/cpanelfree.com\/blog\/wp-json\/wp\/v2\/posts\/1840\/revisions"}],"predecessor-version":[{"id":2292,"href":"https:\/\/cpanelfree.com\/blog\/wp-json\/wp\/v2\/posts\/1840\/revisions\/2292"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/cpanelfree.com\/blog\/wp-json\/wp\/v2\/media\/2492"}],"wp:attachment":[{"href":"https:\/\/cpanelfree.com\/blog\/wp-json\/wp\/v2\/media?parent=1840"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cpanelfree.com\/blog\/wp-json\/wp\/v2\/categories?post=1840"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cpanelfree.com\/blog\/wp-json\/wp\/v2\/tags?post=1840"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}