| Crates.io | pixeluvw_supabase |
| lib.rs | pixeluvw_supabase |
| version | 0.1.0 |
| created_at | 2026-01-23 15:08:17.050963+00 |
| updated_at | 2026-01-23 15:08:17.050963+00 |
| description | A production-ready, high-performance Supabase SDK for Rust with middleware, retry logic, and Arc |
| homepage | https://github.com/pixeluvw/pixeluvw_supabase |
| repository | https://github.com/pixeluvw/pixeluvw_supabase |
| max_upload_size | |
| id | 2064708 |
| size | 262,183 |
A high-performance Rust SDK for Supabase.
Designed for reliability and improved developer experience, this crate provides a strongly-typed, fluent interface for interacting with the entire Supabase stack (Database, Auth, Realtime, Storage, and Edge Functions).
Note: This SDK is currently in Beta. APIs are stable but may evolve.
Add this to your Cargo.toml:
[dependencies]
pixeluvw_supabase = "0.1"
tokio = { version = "1", features = ["full"] }
serde = { version = "1", features = ["derive"] }
serde_json = "1"
dotenv = "0.15"
Create a .env file in your project root (ensure it's in your .gitignore):
SUPABASE_URL=https://your-project.supabase.co
SUPABASE_KEY=your-anon-key
use pixeluvw_supabase::{supabase, SupabaseClient};
use serde_json::json;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
dotenv::dotenv().ok();
// Initialize the client (automatically loads from env)
let client = supabase!()?;
// Perform a query
let users: Vec<serde_json::Value> = client
.from("users")
.select("*")
.eq("status", "active")
.limit(5)
.execute()
.await?;
println!("Users: {:?}", users);
Ok(())
}
The query builder allows you to construct complex queries with ease.
// Select with multiple filters and ordering
let items = client
.from("todos")
.select("id, title, is_complete")
.eq("user_id", "123")
.is_("deleted_at", "null")
.order("created_at", false) // descending
.execute()
.await?;
// Insert new data
client
.from("todos")
.insert(json!({ "title": "Buy milk", "user_id": "123" }))
.execute()
.await?;
// Update existing data
client
.from("todos")
.update(json!({ "is_complete": true }))
.eq("id", 1)
.execute()
.await?;
eq, neq, gt, gte, lt, lte, like, ilike, is_, in_, contains, contained_by, range_gt, range_gte, range_lt, range_lte, range_adjacent, overlaps, text_search, match_, filter, not, or, and.
Handle user sessions securely.
// Sign in with email and password
let session = client.auth().sign_in_with_password("user@example.com", "pass123").await?;
// The client automatically attaches the access token to subsequent requests!
// You can also access the user object:
println!("Logged in as: {}", session.user.id);
// Sign out
client.auth().sign_out().await?;
OAuth Login:
let url = client.auth().sign_in_with_oauth(
pixeluvw_supabase::Provider::Github,
Some("https://myapp.com/callback"), // redirect URL
None, // scopes
)?;
// Redirect your user to `url`
Subscribe to database changes instantly.
use pixeluvw_supabase::PostgresEvent;
use tokio_stream::StreamExt;
let mut channel = client
.realtime()
.channel("room-1")
.on_postgres_changes(
PostgresEvent::Insert,
"public",
Some("messages"),
None // No filter
)
.subscribe()
.await?;
// Listen for messages
while let Some(msg) = channel.next().await {
println!("New event: {:?}", msg);
}
Manage user files.
let bucket = client.storage().from("avatars");
// Upload a file
bucket.upload("user_123.png", "./local_path.png", None).await?;
// Get a public URL
let url = bucket.get_public_url("user_123.png")?;
You can customize the client behavior using ClientConfig.
use pixeluvw_supabase::{ClientConfig, SupabaseClient};
let config = ClientConfig {
timeout_secs: 60,
max_retries: 3,
retry_base_delay_ms: 500,
};
let client = SupabaseClient::with_config("url", "key", config)?;
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License.