Quickback Docs

Supabase

Quickback generates PostgreSQL schemas with Row Level Security for Supabase. Database-level security with Supabase Auth integration.

Quickback supports Supabase as a deployment target, generating PostgreSQL schemas with Row Level Security (RLS) policies that enforce your firewall configuration at the database level.

Why Supabase?

  • Full PostgreSQL — Advanced queries, joins, PostGIS, full-text search
  • Database-Level Security — RLS policies enforce access even if API is bypassed
  • Integrated Auth — Supabase Auth with JWT claims for RLS
  • Real-time — Postgres Changes for live updates
  • Managed Infrastructure — Automatic backups, scaling, monitoring

Configuration

import { defineConfig, defineRuntime, defineDatabase, defineAuth } from "@quickback/compiler";

export default defineConfig({
  name: "my-app",
  providers: {
    runtime: defineRuntime("supabase"),
    database: defineDatabase("supabase"),
    auth: defineAuth("supabase-auth"),
  },
});

Key Difference from Neon

FeatureSupabaseNeon
Auth functionauth.uid()auth.user_id()
Auth providerSupabase AuthNeon Authorize + Better Auth
Users tableauth.userspublic.users (Better Auth)

Row Level Security

Quickback generates RLS policies from your firewall config:

firewall: {
  organization: {},
  owner: { mode: 'optional' }
}
-- Generated policy
CREATE POLICY "documents_select" ON documents FOR SELECT
USING (
  organization_id = get_active_org_id()
  AND (has_any_role(ARRAY['admin']) OR user_id = auth.uid())
);

Firewall Patterns

Organization-Scoped:

CREATE POLICY "projects_select" ON projects FOR SELECT
USING (organization_id = public.get_active_org_id());

User-Scoped:

CREATE POLICY "preferences_select" ON preferences FOR SELECT
USING (user_id = auth.uid());

Defense in Depth

All generated policies include a deny policy for anonymous users:

CREATE POLICY "tablename_deny_anon" ON tablename FOR ALL
TO anon
USING (false);

Generated Helper Functions

FunctionPurpose
get_active_org_id()Returns user's active organization from user_sessions
has_any_role(roles[])Checks if user has any specified role
has_org_role(role)Checks for a specific role
is_org_member()Checks org membership
get_user_role()Returns user's role in active org

Generated Files

supabase/
├── migrations/
│   ├── 0100_create_rls_helpers.sql
│   ├── 0101_create_rls_policies.sql
│   └── 0102_create_audit_triggers.sql
src/
├── db/
│   └── schema.ts
└── lib/
    └── supabase.ts

Getting Started

  1. Install the Supabase CLI
  2. Configure your Quickback project for Supabase
  3. Run quickback compile
  4. Push migrations with supabase db push

On this page