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
| Feature | Default | Description |
|---|---|---|
query | Yes | Query builder (select, insert, update, delete, upsert, rpc) |
derive | Yes | #[derive(Table)] proc macro |
auth | No | GoTrue authentication client |
realtime | No | WebSocket realtime subscriptions |
storage | No | Object storage client |
functions | No | Edge Functions client |
direct-sql | No | Direct PostgreSQL via sqlx (bypasses PostgREST) |
full | No | All 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
Rowwith key-value pairs.
Structs§
- CsvSelect
Builder - Builder for SELECT queries that return CSV text.
- Delete
Builder - Builder for DELETE queries. Implements Filterable and Modifiable.
Call
.select()to add RETURNING clause. - Explain
Options - Options for the EXPLAIN modifier.
- Filter
Collector - Temporary collector used in closures for
not()andor_filter(). - GeoJson
Select Builder - Builder for SELECT queries that return GeoJSON.
- Insert
Builder - Builder for INSERT queries. Implements Modifiable (for count).
Call
.select()to add RETURNING clause. - Order
Clause - Param
Store - Store for collecting parameters during query building.
- Query
Builder - 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.
- Select
Builder - Builder for SELECT queries. Implements both Filterable and Modifiable.
- SqlParts
- Collects all the components of a SQL query being built.
- Supabase
Client - The main client for interacting with Supabase.
- Supabase
Config - Configuration for connecting to a Supabase instance.
- Supabase
Response - Response type matching Supabase’s
{ data, error, count, status }pattern. - Typed
Query Builder - Entry point for typed queries created by
client.from_typed::<T>(). - Typed
RpcBuilder - Typed RPC builder that deserializes results into
T. - Update
Builder - Builder for UPDATE queries. Implements Filterable and Modifiable.
Call
.select()to add RETURNING clause. - Upsert
Builder - Builder for UPSERT (INSERT … ON CONFLICT DO UPDATE) queries.
Implements Modifiable. Call
.select()for RETURNING clause.
Enums§
- Array
Range Operator - Count
Option - Count mode for responses.
- Explain
Format - Output format for EXPLAIN.
- Filter
Condition - A single filter condition in a WHERE clause.
- Filter
Operator - IsValue
- Nulls
Position - Order
Direction - Pattern
Operator - Query
Backend - Backend for query execution.
- SqlOperation
- The type of SQL operation.
- SqlParam
- Type-erased SQL parameter for dynamic query building.
- Status
Code - HTTP-like status codes for response metadata.
- Supabase
Error - All errors that can occur in the supabase-client crate.
- Text
Search Type
Traits§
- Filterable
- Trait providing all filter methods for query builders.
- Into
SqlParam - Trait for converting Rust types into
SqlParam. - Modifiable
- Trait providing modifier methods (order, limit, range, single, count).
- Supabase
Client Query Ext - 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§
- Supabase
Result - Result alias using SupabaseError.
Derive Macros§
- Table
- Derive the
Tabletrait for a struct.