Technologia

Supabase

Open-source alternatywa dla Firebase. PostgreSQL, auth, storage, real-time — bez vendor lock-in.

Czym jest Supabase?

Supabase to open-source Backend-as-a-Service zbudowany na PostgreSQL. Oferuje bazę danych SQL, autentykację, storage, edge functions i real-time subscriptions. W przeciwieństwie do Firebase, Supabase nie ma vendor lock-in — Twoje dane są w standardowym PostgreSQL.

Supabase łączy moc PostgreSQL (relacje, JSONB, RLS) z prostotą Firebase (SDK, auth, real-time). Idealny dla startupów, które chcą szybki start bez rezygnacji z SQL.

Przykłady kodu

CRUD z TypeScript SDK

Supabase + TypeScript import { createClient } from '@supabase/supabase-js'; const supabase = createClient(SUPABASE_URL, SUPABASE_ANON_KEY); // Pobierz użytkowników z relacjami const { data: users } = await supabase .from('users') .select(` id, name, email, orders (id, total, status) `) .eq('is_active', true) .order('created_at', { ascending: false }) .limit(20); // Insert z typami const { data, error } = await supabase .from('users') .insert({ name: 'Jan', email: 'jan@test.pl' }) .select() .single();

Auth

Supabase Auth // Google Sign-In const { data } = await supabase.auth.signInWithOAuth({ provider: 'google', options: { redirectTo: 'https://app.com/callback' }, }); // Email + Password const { data: user } = await supabase.auth.signUp({ email: 'user@example.com', password: 'securePassword123', }); // Obserwuj stan sesji supabase.auth.onAuthStateChange((event, session) => { if (event === 'SIGNED_IN') { console.log('Zalogowany:', session?.user.email); } });

Row Level Security

PostgreSQL RLS -- Użytkownik widzi tylko swoje dane ALTER TABLE orders ENABLE ROW LEVEL SECURITY; CREATE POLICY "Users see own orders" ON orders FOR SELECT USING (auth.uid() = user_id); CREATE POLICY "Users create own orders" ON orders FOR INSERT WITH CHECK (auth.uid() = user_id);

Real-time subscriptions

Supabase Realtime // Nasłuchuj zmian w tabeli supabase .channel('orders') .on('postgres_changes', { event: 'INSERT', schema: 'public', table: 'orders', filter: `user_id=eq.${userId}`, }, (payload) => { console.log('Nowe zamówienie:', payload.new); }) .subscribe();

Ocena kompetencji

SQL (PostgreSQL)
100%
Auth
92%
Real-time
88%
Szybkość startu
95%
Open source
100%
Ekosystem
75%

Co potrafi Supabase

PostgreSQL

Pełny SQL. Relacje, JOIN-y, JSONB, full-text search, RLS. Twoja baza, Twoje dane.

Auth

Email, Google, GitHub, Apple, phone. MFA, magic links, custom claims.

Storage

Upload plików z policies. Image transformations, CDN, resumable uploads.

Edge Functions

Deno-based serverless functions. TypeScript, webhooks, cron jobs.

Realtime

Postgres changes, broadcast, presence. Chat, cursors, live dashboards.

AI / Vectors

pgvector extension. Embeddings, similarity search. AI-ready z PostgreSQL.

Kiedy wybrać Supabase?

Idealny gdy: chcesz moc PostgreSQL z prostotą Firebase, budujesz SaaS z relacjami, potrzebujesz RLS (multi-tenant), chcesz uniknąć vendor lock-in, budujesz z Next.js.

Nie najlepszy gdy: potrzebujesz NoSQL (lepiej Firebase), budujesz offline-first mobile app (lepiej Firebase), potrzebujesz zaawansowanych Cloud Functions (lepiej Firebase/AWS).