DEV Community

Alex Spinov
Alex Spinov

Posted on

Supabase Has Free PostgreSQL Superpowers Most Developers Never Use

Most developers use Supabase as "Firebase but PostgreSQL." That barely scratches the surface. Here are features hiding in plain sight.

1. Edge Functions (Deno Runtime)

import { serve } from "https://deno.land/std@0.168.0/http/server.ts";
import { createClient } from "https://esm.sh/@supabase/supabase-js@2";

serve(async (req) => {
  const supabase = createClient(
    Deno.env.get("SUPABASE_URL")!,
    Deno.env.get("SUPABASE_SERVICE_ROLE_KEY")!,
  );
  const { orderId } = await req.json();
  const { data: order } = await supabase
    .from("orders").select("*, items(*)").eq("id", orderId).single();
  return new Response(JSON.stringify({ order }));
});
Enter fullscreen mode Exit fullscreen mode

2. Row Level Security — The Real Power

CREATE POLICY "Users see own data" ON profiles
  FOR SELECT USING (auth.uid() = user_id);

CREATE POLICY "Team access" ON projects
  FOR SELECT USING (
    auth.uid() IN (
      SELECT user_id FROM team_members WHERE team_id = projects.team_id
    )
  );
Enter fullscreen mode Exit fullscreen mode

RLS lets you write security rules at the database level — no middleware needed.

3. Realtime Presence and Broadcast

const channel = supabase.channel("room-1");
channel
  .on("presence", { event: "sync" }, () => {
    console.log("Online:", Object.keys(channel.presenceState()));
  })
  .subscribe(async (status) => {
    if (status === "SUBSCRIBED") {
      await channel.track({ user_id: "123", name: "Alice" });
    }
  });
Enter fullscreen mode Exit fullscreen mode

Build collaborative apps without WebSocket servers.

4. pg_vector — AI Embeddings in PostgreSQL

CREATE EXTENSION IF NOT EXISTS vector;

CREATE TABLE documents (
  id BIGSERIAL PRIMARY KEY,
  content TEXT,
  embedding vector(1536)
);

SELECT content, 1 - (embedding <=> $1) AS similarity
FROM documents ORDER BY embedding <=> $1 LIMIT 5;
Enter fullscreen mode Exit fullscreen mode

Build RAG apps directly in your database. No Pinecone needed.

5. Storage with Image Transforms

const { data } = await supabase.storage
  .from("avatars").upload(`${userId}/photo.png`, file);

supabase.storage.from("avatars").getPublicUrl(`${userId}/photo.png`, {
  transform: { width: 200, height: 200, resize: "cover" },
});
Enter fullscreen mode Exit fullscreen mode

On-the-fly image resizing included in the free tier.

6. Database Webhooks

Trigger HTTP calls on INSERT/UPDATE/DELETE — no polling needed. Configure in Dashboard → Database → Webhooks.

Free Tier

  • 500MB database, 1GB storage
  • 50K monthly active users
  • 500K Edge Function invocations
  • Unlimited API requests

Building data-intensive apps? I create web scraping and API tools. Email spinov001@gmail.com or explore my Apify tools.

Top comments (0)