LimitedRound 2 is open. Get your first month free, no extra charge.Join the waitlist ›
Wire in your backend

How to add Supabase to your iOS app

TL;DR. Supabase gives an iOS app a Postgres database, authentication, storage, and edge functions behind one SDK. You add the Swift package, configure it with your project URL and anon key, and query tables or sign users in. AppFlight wires it in and keeps the anon key client-side while secrets stay server-side.

What Supabase does for an iOS app

Most apps need somewhere to store user data and a way to sign people in. Supabase gives you both without standing up your own server. The database is plain Postgres, so you get real tables, relations, and SQL. Auth handles email, magic links, and Sign in with Apple. Storage holds files like avatars. The safety model rests on Row Level Security: you write policies in Postgres that decide which rows each user can touch, which is what makes a public anon key safe to ship.

Adding Supabase with AppFlight

In AppFlight you open the integrations panel, choose Supabase, and paste your project URL and anon key. AppFlight stores the anon key as a client value, safe to ship in the binary, and keeps your service role key server-side so it never lands in the app. Because AppFlight uses your own Supabase project, backend secrets for other connectors can live there too. From there you can ask the AI to add a sign-in screen or a synced list, and it generates the SwiftUI and the matching queries.

A SwiftUI example

Create the client once, then query a table from an async context:

import Supabase
import SwiftUI

let supabase = SupabaseClient(
    supabaseURL: URL(string: "https://yourproject.supabase.co")!,
    supabaseKey: "your-anon-key"
)

struct Note: Codable, Identifiable {
    let id: Int
    let title: String
}

struct NotesView: View {
    @State private var notes: [Note] = []

    var body: some View {
        List(notes) { note in Text(note.title) }
            .task {
                notes = (try? await supabase
                    .from("notes")
                    .select()
                    .execute()
                    .value) ?? []
            }
    }
}

Alternatives

Firebase is the closest comparison and is strong for realtime sync and a mature analytics suite, but it stores data in a NoSQL document model rather than SQL. CloudKit is free within Apple's ecosystem and integrates tightly with iCloud, though it is Apple-only and harder to query. Supabase is the pick when you want real Postgres, an open-source stack you can self-host, and a single project that can also hold the backend secrets for your other integrations.

FAQ

Is the Supabase anon key safe to ship in an iOS app?

Yes, the anon key is designed to be public and is protected by Row Level Security policies on your tables. The service role key is the secret one and must never ship in the app. AppFlight classifies the anon key as client and keeps the service role key server-side.

Does Supabase handle sign in with Apple?

Yes. Supabase Auth supports Sign in with Apple along with email, magic links, and other providers. You configure the provider in the Supabase dashboard and call the SDK from SwiftUI.

What protects my data if the anon key is public?

Row Level Security. You write Postgres policies that decide which rows each authenticated user can read or write. Without RLS enabled, a public key would expose your tables, so enabling and testing policies is the key step.

Sources

Build this app without opening Xcode.

AppFlight turns a plain-English prompt into a real native iOS app and ships it to the App Store. Round 2 is open: free for your first month.

Join the waitlist