DEV Community

Alex Spinov
Alex Spinov

Posted on

Supabase Has a Free Backend Platform: PostgreSQL Database, Auth, Storage, and Real-Time — The Open-Source Firebase Alternative

Firebase locks you into Google's NoSQL database, proprietary APIs, and pricing that scales unpredictably. You want the convenience of BaaS but with real SQL, open source, and predictable costs.

That's Supabase — Firebase built on PostgreSQL, with auth, storage, edge functions, and real-time subscriptions.

Free Tier

  • 500 MB database storage
  • 1 GB file storage
  • 50,000 monthly active users (auth)
  • 2 GB bandwidth
  • 500,000 edge function invocations

Quick Start

npx supabase init
npx supabase start  # Local development with Docker
Enter fullscreen mode Exit fullscreen mode

Or use the hosted version at supabase.com.

Database Queries

import { createClient } from "@supabase/supabase-js";

const supabase = createClient(process.env.SUPABASE_URL, process.env.SUPABASE_ANON_KEY);

// SELECT
const { data: users } = await supabase
  .from("users")
  .select("id, name, email, posts(title, created_at)")
  .eq("active", true)
  .order("created_at", { ascending: false })
  .limit(20);

// INSERT
const { data: newUser } = await supabase
  .from("users")
  .insert({ name: "Aleksej", email: "dev@example.com" })
  .select()
  .single();

// UPDATE
await supabase.from("users").update({ name: "New Name" }).eq("id", userId);

// DELETE
await supabase.from("users").delete().eq("id", userId);
Enter fullscreen mode Exit fullscreen mode

Authentication

// Sign up
const { data, error } = await supabase.auth.signUp({
  email: "user@example.com",
  password: "password123",
});

// Sign in
const { data } = await supabase.auth.signInWithPassword({
  email: "user@example.com",
  password: "password123",
});

// OAuth
const { data } = await supabase.auth.signInWithOAuth({
  provider: "google",
});

// Get current user
const { data: { user } } = await supabase.auth.getUser();
Enter fullscreen mode Exit fullscreen mode

Real-Time Subscriptions

const channel = supabase
  .channel("messages")
  .on("postgres_changes", {
    event: "INSERT",
    schema: "public",
    table: "messages",
  }, (payload) => {
    console.log("New message:", payload.new);
  })
  .subscribe();
Enter fullscreen mode Exit fullscreen mode

Row Level Security (RLS)

-- Users can only read their own data
CREATE POLICY "Users read own data" ON users
  FOR SELECT USING (auth.uid() = id);

-- Users can only update their own profile
CREATE POLICY "Users update own profile" ON users
  FOR UPDATE USING (auth.uid() = id);
Enter fullscreen mode Exit fullscreen mode

Supabase vs Firebase vs Appwrite

Feature Supabase Firebase Appwrite
Database PostgreSQL (SQL) Firestore (NoSQL) MariaDB
Open source Yes No Yes
Self-hosted Yes No Yes
Real-time Yes Yes Yes
Auth providers 20+ 15+ 10+
Edge functions Deno Cloud Functions Functions
Pricing Predictable Pay-per-read Free (self-host)

Choose Supabase for SQL, open source, and predictable pricing.

Start here: supabase.com


Need custom data extraction, scraping, or automation? I build tools that collect and process data at scale — 78 actors on Apify Store and 265+ open-source repos. Email me: Spinov001@gmail.com | My Apify Actors

Top comments (0)