Database (bring your own Supabase)
CloudCode doesn't provision a database, auth, storage or serverless functions for the apps you build. For a backend, connect your own Supabase project (the free tier is enough to start). You own the data and can manage it from the Supabase dashboard whether or not you keep using CloudCode. The agent writes the client code, queries and migrations for you.
// src/lib/supabase.ts
import { createClient } from "@supabase/supabase-js";
const SUPABASE_URL = "https://YOUR-PROJECT.supabase.co";
const SUPABASE_ANON_KEY = "YOUR-ANON-KEY"; // public by design; RLS protects your data
export const supabase = createClient(SUPABASE_URL, SUPABASE_ANON_KEY);import { supabase } from "@/lib/supabase";
// Select
const { data, error } = await supabase
.from("posts")
.select("*")
.eq("user_id", userId);
// Insert
await supabase.from("posts").insert({ title: "Hello world", user_id: userId });
// Realtime subscription
supabase
.channel("posts")
.on("postgres_changes", { event: "*", schema: "public", table: "posts" }, (payload) => {
console.log("Change received:", payload);
})
.subscribe();Row-level security (RLS)
Ask the agent to enable RLS on every table and write policies that match auth.uid() to an owner column. Then check the generated SQL before you apply it, because RLS is the only thing protecting rows from anyone holding your anon key.