Skip to content
New to BhaiCode? Install the desktop app in under a minute, or build in your browser with Cloud Studio.
BhaiCode Docs
BhaiCode Docs
Databases & Storage › Supabase Managed Postgres

Supabase Managed Postgres

Enterprise Postgres with auth, storage buckets, and realtime subscriptions.

Supabase provides a managed PostgreSQL database alongside authentication, file storage, and realtime subscriptions.

Capabilities

  • Auth integration: Google, GitHub, and email/password flows.
  • Row Level Security: enforce access rules at the database level.
  • Storage buckets: upload and serve images, media, and documents.
lib/supabase.ts
import { createClient } from "@supabase/supabase-js";

export const supabase = createClient(
  process.env.NEXT_PUBLIC_SUPABASE_URL!,
  process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!,
);

export async function fetchOrders() {
  const { data, error } = await supabase
    .from("orders")
    .select("*, items(*)")
    .order("created_at", { ascending: false });

  if (error) throw error;
  return data;
}

Enable RLS on every table

Client-side queries run with the anon key. A table without Row Level Security is readable by anyone with that key.

Provision it from the Supabase connector.

Was this page helpful?

On this page