Skip to content

Supabase Setup

Supabase is an open-source Firebase alternative built on PostgreSQL. It provides a database, authentication, file storage, and real-time subscriptions. If your app needs a backend — user accounts, data persistence, file uploads — Supabase is a solid choice.

  1. Create a Supabase project

    Sign up at supabase.com and create a new project. Pick a region close to your users and set a database password.

  2. Copy your credentials

    Go to Settings → API in your Supabase dashboard. Copy the Project URL and the anon key (the public API key).

  3. Tell Primio to set up Supabase

    In the chat, send: “Set up Supabase with this URL: [your-project-url] and anon key: [your-anon-key]

    The AI will add the Supabase Flutter package, configure the client, and initialize it in your app.

Once Supabase is set up, you can add authentication. Ask Primio for the login method you need:

  • “Add Supabase authentication with email and password sign-up”
  • “Add Google OAuth sign-in using Supabase Auth”
  • “Add Apple Sign-In using Supabase Auth”
  • “Add a sign-in screen with email login and a sign-up page”

Supabase uses PostgreSQL’s Row Level Security to control who can read and write data. When the AI sets up auth, it should also create appropriate RLS policies on your tables.

You can be explicit about this: “Only let users read and update their own profile data” or “Make the recipes table readable by everyone but only writable by the author.”

If you skip RLS, your tables may be accessible to anyone with your anon key. Always verify that RLS is enabled on tables that contain user data.

Supabase gives you a full PostgreSQL database. You create tables in the Supabase dashboard (not in Primio), then ask Primio to connect your app to them via Supabase’s API.

Step 1: Create tables in Supabase Go to your Supabase dashboard → Table Editor and create the tables you need. For example, a recipes table with columns: id, title, description, image_url, user_id, created_at.

Step 2: Ask Primio to connect

  • “Connect to the Supabase recipes table and display all recipes on the home screen in a grid”
  • “Let users create, edit, and delete their own recipes via Supabase”
  • “Add a detail page that loads a single recipe by ID from Supabase”
  • “Add pull-to-refresh on the recipes list”

The AI writes the Dart code to call Supabase’s REST API — fetching, creating, updating, and deleting rows.

Supabase Storage lets users upload and retrieve files. Common uses:

  • “Set up Supabase Storage for user profile images”
  • “Allow users to upload photos to Supabase Storage and display them in the feed”
  • “Add image upload to the recipe creation form, store in Supabase Storage”

Set up services incrementally. Start with the Supabase client configuration, then add auth, then database, then storage. Test each piece before moving on.

Be specific about table structure. Give the AI exact column names and types. Vague requests like “add a database” produce generic results.

Check your RLS policies. After the AI creates tables, verify in the Supabase dashboard that RLS is enabled and the policies make sense. This is a security concern — don’t skip it.

Firebase Setup

Firebase is another popular backend option with a different approach.