Skip to main content

Installation

Gradle (Kotlin DSL)

Add the Supabase Kotlin dependency to your build.gradle.kts:

Gradle (Groovy)

Initializing

Create a Supabase client to interact with your database.
String
required
The unique Supabase URL for your project.
String
required
The Supabase anon key for your project.
SupabaseClientBuilder.() -> Unit
Configuration block for installing plugins.

Database Operations

Select Data

Query data from your tables.
List<T>
The returned rows from the query, deserialized to your data class.

Select with Filters

Select Specific Columns

Common Filters

Insert Data

Insert rows into your tables.
T
required
The value to insert.

Insert Multiple Rows

Update Data

Update existing rows in your tables.
T
required
The values to update.

Upsert Data

Insert or update rows based on unique constraints.

Delete Data

Delete rows from your tables.

Authentication

Sign Up

Create a new user account.
String
required
The user’s email address.
String
required
The user’s password.
JsonObject
Additional user metadata.
String
A URL to redirect to after signup.
AuthResponse

Sign In

Sign in an existing user.

Sign Out

Sign out the current user.

Get Session

Get the current session.
SessionInfo?
The current session object or null if no active session.

Get User

Get the current user.
UserInfo?
The current user object or null if not authenticated.

Auth State Changes

Listen to authentication state changes.

Storage

Upload File

Upload a file to a storage bucket.
String
required
The file path including the file name.
ByteArray
required
The file data to upload.
Boolean
default:"false"
When true, overwrites existing file with the same path.
String
MIME type of the file.

Download File

Download a file from storage.
String
required
The file path to download.
ByteArray
The file data.

List Files

List all files in a bucket.

Delete Files

Delete files from storage.

Get Public URL

Get the public URL for a file.

Realtime

Subscribe to Changes

Listen to database changes in realtime.
String
required
The database schema to listen to.
String
required
The table to listen to.

Unsubscribe

Stop listening to changes.

Edge Functions

Invoke Function

Invoke a Supabase Edge Function.
String
required
The name of the Edge Function to invoke.
T
The request body to send to the function.
Map<String, String>
Custom headers to send with the request.
HttpMethod
default:"HttpMethod.Post"
HTTP method to use.
T
The response data from the function, deserialized to your data class.

Error Handling

Handle errors using try-catch blocks:

Compose Multiplatform Integration

Use Supabase with Compose Multiplatform:

Additional Resources

GitHub Repository

View the source code and contribute

Maven Central

View package details and versions