supabase-kt

repository·master·Indexed 21 days ago

https://github.com/supabase-community/supabase-kt

A Kotlin Multiplatform (KMP) client library for interacting with Supabase services, including Auth, Postgrest, Storage, Realtime, and Edge Functions. It supports a wide range of targets including JVM, Android, JS, Wasm, Apple (iOS, macOS, tvOS, watchOS), Windows, and Linux.

Tokens
14K
Snippets
57
Records
82
Agent score
74%

What's inside supabase-kt

  1. Supported targets for Supabase-kt Storage

    master

    The Storage client is multiplatform and supports the following targets:

    TargetStatus
    JVM
    Android
    JS (Browser, NodeJS)
    Wasm (wasm-js)
    Apple (iOS, tvOS, watchOS, MacOS)
    Windows (mingwX64)
    Linux (linuxX64)

    Note: Linux does not support persistent resumable upload URL caching.

  2. Check Auth module platform support

    master

    The auth-kt module is multiplatform. Support status varies by target:

    TargetStatusNotes
    JVM
    Android
    JSBrowser, NodeJS
    Wasmwasm-js
    Apple☑️iOS and macOS are fully supported. Includes tvOS and watchOS.
    Windows☑️mingwX64
    Linux☑️linuxX64. No support for persistent session storage.

    Note: Targets marked with ☑️ have no built-in OAuth support.

  3. Supported platforms for GoTrue/Auth-kt

    master

    The authentication module is multiplatform. Support status varies by target:

    TargetStatusNotes
    JVMFully supported
    AndroidFully supported
    JSBrowser and NodeJS
    Wasmwasm-js
    Apple☑️iOS and macOS are fully supported. Includes tvOS and watchOS.
    Windows☑️mingwX64
    Linux☑️No support for persistent session storage.

    Note: For Apple, Windows, and Linux targets, built-in OAuth support is not available.

  4. How Desktop Deeplinking works with unique4j

    master

    The Desktop implementation uses Conveyor for protocol registration and unique4j to manage single-instance behavior.

    When a user completes a login (e.g., via Google), they are redirected to the registered URL protocol. If the application is already running, unique4j allows the new instance (triggered by the redirect) to communicate the authentication data to the existing instance before closing itself. This ensures the user is logged in within the primary application window.

  5. Available supabase-kt Plugins

    master

    Plugins can be installed using the createSupabaseClient function to extend functionality. Key plugins include:

    • Apollo GraphQL integration: Creates an Apollo GraphQL Client for interacting with the Supabase API.
    • Compose Auth: Provides native Google & Apple Auth for Compose Multiplatform.
    • Compose Auth UI: Provides UI components for Compose Multiplatform.
    • Coil3 Integration: Provides integration for displaying images stored in Supabase Storage across all Compose Multiplatform targets.
  6. Configure the Postgrest plugin in SupabaseClient

    master

    After adding the dependency, you must install the Postgrest plugin within your createSupabaseClient configuration block to enable Postgrest functionality.

    val supabase = createSupabaseClient(
        supabaseUrl = "https://id.supabase.co",
        supabaseKey = "apikey"
    ) {
        install(Postgrest) {
            // settings
        }
    }
  7. Install supabase-kt using the BOM

    master

    If you are using multiple Supabase modules, it is recommended to use the Bill of Materials (BOM) to ensure all modules use compatible versions.

    implementation(platform("io.github.jan-tennert.supabase:bom:VERSION"))
    implementation("io.github.jan-tennert.supabase:[module]")
  8. Initialize the Storage plugin in SupabaseClient

    master

    After adding the dependency, you must install the Storage plugin when creating your SupabaseClient instance using the install(Storage) block.

    val supabase = createSupabaseClient(
        supabaseUrl = "https://id.supabase.co",
        supabaseKey = "apikey"
    ) {
        //... 
    
        install(Storage) {
            // settings
        }
    }
  9. Install Supabase-kt Realtime

    master

    To use Realtime features, add the realtime-kt dependency to your project. Ensure you replace VERSION with the latest available version.

    Supported targets include JVM, Android, JS (Browser/NodeJS), Wasm, Apple (iOS, tvOS, watchOS, MacOS), Windows, and Linux.

    dependencies {
        implementation("io.github.jan-tennert.supabase:realtime-kt:VERSION")
    }