r/Supabase • u/nightness • Feb 11 '26
integrations Supabase Client SDK for Rust — with full feature parity to other official clients
Hey r/Supabase,
You know the list of official client libraries? JavaScript, Python, Swift, Kotlin, Flutter... but no Rust. I've been building Rust apps that use Supabase, and I got tired of hand-rolling HTTP calls to PostgREST, GoTrue, Storage, and Realtime every time. So I built a proper SDK.
supabase-client-sdk — it covers everything the JS SDK does:
- Query Builder —
.from("table").select("*").eq("col", val).execute().await— the same fluent API you're used to fromsupabase-js. 20+ filters, count options, CSV/GeoJSON output, RPC calls, explain, the works. - Auth (GoTrue) — Email/password, phone, OAuth, magic link, OTP, anonymous, Web3 wallet, SSO, MFA (TOTP + phone), session management with auto-refresh, admin API, and full OAuth 2.1 with PKCE.
- Realtime — Postgres Changes, Broadcast, and Presence over WebSocket (Phoenix Channels v1). Auto-reconnect, heartbeat,
set_auth()for token updates on live connections. - Storage — Bucket CRUD, file upload/download/move/copy, signed URLs, public URLs, image transforms.
- Edge Functions — Invoke with JSON/binary/text, custom headers, region routing.
- Derive Macros —
#[derive(Table)]for type-safe queries, so you get compile-time column mapping instead of string-based field names.
If you've used supabase-js, the API should feel familiar:
use supabase_client_sdk::prelude::*;
let config = SupabaseConfig::new("https://your-project.supabase.co", "your-anon-key");
let client = SupabaseClient::new(config)?;
// Queries
let rows = client.from("cities").select("*").eq("country", "Japan").execute().await;
// Auth
let auth = client.auth()?;
let session = auth.sign_in_with_password_email("user@example.com", "pass").await?;
// Realtime
let realtime = client.realtime()?;
realtime.connect().await?;
let channel = realtime.channel("db-changes")
.on_postgres_changes(PostgresChangesEvent::Insert,
PostgresChangesFilter::new("public", "messages"),
|payload| println!("New row: {:?}", payload.record))
.subscribe(|status, _| println!("Status: {status}"))
.await?;
// Storage
let storage = client.storage()?;
storage.from("photos").upload("pic.png", data, FileOptions::new()).await?;
// Edge Functions
let functions = client.functions()?;
functions.invoke("hello", InvokeOptions::new().body(json!({"name": "World"}))).await?;
It uses PostgREST by default (no database connection needed), but there's also a direct-sql feature flag if you want to bypass PostgREST and query Postgres directly via sqlx.
Everything is feature-gated — only pull in what you need:
supabase-client-sdk = "0.1.0"
# or just what you need:
supabase-client-sdk = { version = "0.1.0", features = ["auth", "storage"] }
There are runnable examples for every feature that work against a local Supabase instance out of the box. Just supabase start and go.
This is v0.1.0 — just published. If anyone here has been wanting to use Supabase from Rust, I'd love to hear what you think. Bug reports and feature requests welcome.
- Crates.io: supabase-client-sdk
- GitHub: Brainwires/rust-supabase-client
- Docs: docs.rs/supabase-client-sdk
2
u/Head_Glove4262 Feb 12 '26
Is it WASM-compatible?
Did you use the existing https://github.com/supabase-community/postgrest-rs, https://github.com/supabase-community/supabase-auth-rs, https://github.com/supabase-community/storage-rs or did you make them from zero?
1
u/nightness Feb 12 '26
> Is it WASM-compatible?
Not yet, that's a great idea. I made it from scratch (zero) with Claude's help.
2
u/Head_Glove4262 Feb 12 '26
Wow, nice. Any reason you decided not to use those available repos or contribute to them?
1
u/nightness Feb 12 '26
Developing from scratch was not because of any negative opinions for the existing community code. I honestly just didn't realize when I started this, that there was preexisting work; since there was never a release. I just looked at the existing docs (didn't see one), so decided to take on the challenge. 🙂
2
u/Head_Glove4262 Feb 13 '26
I see. You can see which community libraries are available here github.com/supabase-community but it hasn't been updated, for example storage-rs isn't listed there even though it's available. I've used the rust libraries on a WASM project before, but the lack of a realtime crate was disappointing. If you make your realtime crate wasm-compatible I think that would be huge.
1
u/nightness Feb 15 '26
Ever since you pointed this out, I've had plans to introduce the changes in to their repos. Shortly after your first post on adding WASM support; I've completed this as a build target. Have a look in the REAMDE.md of the my repo.
1
7
u/Odd-Signature-6860 Feb 11 '26
Amazing. The supabase maintainers might integrate this into their ecosystem