Skip to main content

Crate supabase_client_sdk

Crate supabase_client_sdk 

Source
Expand description

§supabase-client-sdk

A Rust client for Supabase with a fluent, Supabase JS-like API. Uses the PostgREST REST API by default — no database connection needed. Opt into direct PostgreSQL access via sqlx with the direct-sql feature flag.

This is the main facade crate that re-exports all sub-crates behind feature flags.

§Quick Start

use supabase_client_sdk::prelude::*;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let config = SupabaseConfig::new("https://your-project.supabase.co", "your-anon-key");
    let client = SupabaseClient::new(config)?;

    let response = client.from("cities").select("*").execute().await;
    for row in response.into_result()? {
        println!("{}", row.get_as::<String>("name").unwrap());
    }
    Ok(())
}

§Feature Flags

FeatureDefaultDescription
queryYesQuery builder (select, insert, update, delete, upsert, rpc)
deriveYes#[derive(Table)] proc macro
authNoGoTrue authentication client
realtimeNoWebSocket realtime subscriptions
storageNoObject storage client
functionsNoEdge Functions client
direct-sqlNoDirect PostgreSQL via sqlx (bypasses PostgREST)
fullNoAll features enabled

Modules§

backend
builder
client
config
csv_select
delete
error
filter
geojson_select
insert
modifier
postgrest
postgrest_execute
prelude
Prelude module for convenient imports.
response
rpc
select
sql
table
update
upsert
value

Macros§

row
Macro for constructing a Row with key-value pairs.

Structs§

CsvSelectBuilder
Builder for SELECT queries that return CSV text.
DeleteBuilder
Builder for DELETE queries. Implements Filterable and Modifiable. Call .select() to add RETURNING clause.
ExplainOptions
Options for the EXPLAIN modifier.
FilterCollector
Temporary collector used in closures for not() and or_filter().
GeoJsonSelectBuilder
Builder for SELECT queries that return GeoJSON.
InsertBuilder
Builder for INSERT queries. Implements Modifiable (for count). Call .select() to add RETURNING clause.
OrderClause
ParamStore
Store for collecting parameters during query building.
QueryBuilder
Entry point query builder created by client.from("table").
Row
A dynamic row type wrapping a HashMap of column name to JSON value. Used for the string-based (dynamic) API when not using typed structs.
RpcBuilder
Builder for RPC (function call) queries.
SelectBuilder
Builder for SELECT queries. Implements both Filterable and Modifiable.
SqlParts
Collects all the components of a SQL query being built.
SupabaseClient
The main client for interacting with Supabase.
SupabaseConfig
Configuration for connecting to a Supabase instance.
SupabaseResponse
Response type matching Supabase’s { data, error, count, status } pattern.
TypedQueryBuilder
Entry point for typed queries created by client.from_typed::<T>().
TypedRpcBuilder
Typed RPC builder that deserializes results into T.
UpdateBuilder
Builder for UPDATE queries. Implements Filterable and Modifiable. Call .select() to add RETURNING clause.
UpsertBuilder
Builder for UPSERT (INSERT … ON CONFLICT DO UPDATE) queries. Implements Modifiable. Call .select() for RETURNING clause.

Enums§

ArrayRangeOperator
CountOption
Count mode for responses.
ExplainFormat
Output format for EXPLAIN.
FilterCondition
A single filter condition in a WHERE clause.
FilterOperator
IsValue
NullsPosition
OrderDirection
PatternOperator
QueryBackend
Backend for query execution.
SqlOperation
The type of SQL operation.
SqlParam
Type-erased SQL parameter for dynamic query building.
StatusCode
HTTP-like status codes for response metadata.
SupabaseError
All errors that can occur in the supabase-client crate.
TextSearchType

Traits§

Filterable
Trait providing all filter methods for query builders.
IntoSqlParam
Trait for converting Rust types into SqlParam.
Modifiable
Trait providing modifier methods (order, limit, range, single, count).
SupabaseClientQueryExt
Extension trait adding query builder methods to SupabaseClient.
Table
Trait for typed table mapping (REST-only mode, no sqlx::FromRow required).

Functions§

validate_column_name
Validate that a column name is safe (no SQL injection).
validate_identifier
Validate a table or schema name.

Type Aliases§

SupabaseResult
Result alias using SupabaseError.

Derive Macros§

Table
Derive the Table trait for a struct.