Supabase

Supabase is an open-source Firebase alternative that gives you a Postgres database, authentication, real-time subscriptions, edge functions, and file storage. All from one dashboard. Flux uses Supabase to power user accounts, order history, wishlists, and any server-side data that Stripe or Sanity don't own.

Last updated: 2026-03-29

Where Supabase Fits

In a Flux project, each service owns a specific slice of data. Supabase handles everything that needs a persistent relational store tied to a logged-in user. Profiles, orders, wishlists, and custom business logic.

Terminal
WhatWho owns it
Payments & subscriptionsStripe
Blog / CMS contentSanity
User profiles & sessionsSupabase Auth
Orders, wishlists, custom dataSupabase Postgres
Product & user mediaSupabase Storage

Setup & Configuration

Create a free project at supabase.com, copy your project URL and anon key, then install the JS client. The anon key is safe to expose to the browser. Row-Level Security on your tables enforces what each user can actually read or write.

src/lib/supabase.ts

Authentication

Supabase Auth handles sign-up, sign-in, OAuth providers (Google, GitHub), magic links, and session management. The session JWT is automatically attached to every supabase-js request, so your RLS policies can reference auth.uid() to scope rows to the current user.

Terminal

Database & Row-Level Security

Supabase gives you a full Postgres database. Query it with the supabase-js client or raw SQL. Row-Level Security (RLS) policies run inside Postgres. They ensure users can only read or write their own rows, even if the anon key is exposed.

Terminal

File Storage

Supabase Storage is an S3-compatible object store. Use it for product images, user avatars, and any file uploads. Buckets can be public (CDN-served) or private (signed URLs required). Storage policies use the same RLS syntax as database tables.

Terminal