Supabase

The foundation. Provides auth, database, storage, and Edge Functions. Enable it first — Stripe, AI, and Resend run through Supabase Edge Functions.

Requires ChromeShip Pro

Upgrade to Pro to unlock Supabase.

Auth — sign users in and keep them signed in

Use auth.signIn / auth.signUp for email+password. auth.signInWithOAuth for Google login. Call auth.getUser() on any surface mount to check if someone is signed in. auth.onChange lets every surface react when the session changes (sign-in, sign-out, token refresh).

import { auth } from "@/integrations/supabase";

// Sign in, sign up, sign out
await auth.signIn(email, password);
await auth.signUp(email, password);
await auth.signInWithOAuth("google");
await auth.signOut();

// Check session
const user = await auth.getUser();       // { id, email } | null — use on mount
const signedIn = await auth.isAuthenticated();
const session = await auth.getSession(); // full token, user, expiry

// Listen for changes across all surfaces
auth.onChange((session) => {
  if (session.isAuthenticated) showApp(); else showLogin();
});

Database — read and write user data (RLS-scoped)

db talks directly to Supabase PostgREST. It is protected by Row-Level Security policies — set them in the Supabase dashboard to control who can read or write each table. Use this for user-owned data like notes, settings, or saved items.

import { db } from "@/integrations/supabase";

const { data } = await db.from("notes").select("*");
await db.from("notes").insert({ title: "Hello" });
await db.from("notes").update({ title: "Updated" }).eq("id", 1);
await db.from("notes").delete().eq("id", 1);

Edge Functions — server-side logic with secrets

Call your Supabase Edge Functions from extension code. Secrets (API keys, Stripe keys) stay in the function — the extension never sees them.

functions.invoke is the standard call — JSON body, auth auto-attached, parsed response. Use it for almost everything.

import { functions } from "@/integrations/supabase";
const result = await functions.invoke("hello-world", { name: "World" });

functions.raw gives you the full Response object. Use it for downloads, custom headers, or non-JSON responses.

const response = await functions.raw("download-report", {
  method: "POST",
  body: { id: "123" },
});
const blob = await response.blob();

Storage — upload, download, serve files

Store user files (avatars, exports, attachments) in Supabase buckets. getPublicUrl returns a permanent URL. createSignedUrl generates a temporary link for private files.

import { storage } from "@/integrations/supabase";

await storage.upload("avatars", "user-1.png", file, { upsert: true });
const blob = await storage.download("exports", "report.pdf");
const url = storage.getPublicUrl("avatars", "user-1.png");
const signed = await storage.createSignedUrl("private", "doc.pdf", 120);