gg-supabase

Crates.iogg-supabase
lib.rsgg-supabase
version0.1.0
created_at2025-05-30 22:15:19.722538+00
updated_at2025-05-30 22:15:19.722538+00
description⚡️ A lightweight, async Rust client mirroring the official supabase-js API (database, auth, realtime, storage).
homepage
repository
max_upload_size
id1695717
size92,980
Geoffrey Garrett (geoffreygarrett)

documentation

README

Below is a ready-to-drop-in README.md (followed by a corrected LICENSE section and a tiny Cargo-toml tweak). It aligns gg-supabase with the original Supabase client licensing (MIT), summarises what the crate does, explains the feature-flags you already exposed, and adds a short trademark disclaimer.


# gg-supabase

> A lightweight, async ✨Rust✨ client that speaks the Supabase REST, Realtime and Auth APIs — designed for `tokio` on native targets **and** for the browser via `wasm-bindgen`.

---

## ✨ Why?

Supabase’s official JavaScript client (`supabase-js`) is released under the MIT licence and provides a single, batteries-included interface to PostgREST, Realtime, Storage and Auth:contentReference[oaicite:0]{index=0}.  
Rust still has **no _official_ SDK**, so the community created a patch-work of crates — `postgrest-rs` (dual-licence):contentReference[oaicite:1]{index=1}, `supabase-auth-rs`:contentReference[oaicite:2]{index=2}, `realtime` ports, and more — but there is no **unified** client that looks and feels like the JS original:contentReference[oaicite:3]{index=3}. gg-supabase is that missing glue.

---

## 📦 Installation

```bash
cargo add gg-supabase            # default = native + reqwest + tokio
# or pick your target(s)
cargo add gg-supabase --features browser,wasm     # web-sys + fetch
Feature flag Enables … Default?
native reqwest (native TLS / rustls) stack
browser wasm-bindgen / web-sys fetch
wasm extra helpers for pure WASM (no DOM)
ssr cookie-aware helpers for server-side rendering

All flags simply forward to the same names on gg-supabase-auth so you keep a single feature matrix consistent across crates.


🚀 Quick-start

use gg_supabase::prelude::*;          // re-exports Client, Error, etc.
use serde::{Deserialize, Serialize};

#[derive(Serialize, Deserialize)]
struct Todo { id: i64, task: String, done: bool }

#[tokio::main]
async fn main() -> gg_supabase::Result<()> {
    let supa = SupabaseClient::builder()
        .from_env()?                         // reads SUPABASE_URL + ANON_KEY
        .build();

    // read rows with PostgREST
    let todos: Vec<Todo> = supa
        .from("todos")
        .select("*")
        .execute()
        .await?
        .json()?;

    println!("first task: {}", todos[0].task);

    // sign-in the user
    supa.auth().sign_in_with_password("me@example.com", "••••••").await?;

    Ok(())
}

🛣 Roadmap

  1. Auth (via gg-supabase-auth) — full parity with supabase-js v3 docs
  2. Database — fluent PostgREST wrapper (select / insert / upsert …).
  3. Realtime — web-socket channels (powered by tungstenite), following the JS client’s Presence & Broadcast APIs.
  4. Storage — S3 compatible uploads & signed URLs, modelled after supabase-storage-js (MIT).
  5. Edge Functions & GraphQL — invoke helpers.
  6. Declarative procedural macro for compile-time safe row mapping.

🏗 Status

The crate is alpha: the HTTP core is stable and Auth flows pass integration tests against a local Supabase stack, but the public API may change rapidly. Community testing & PRs are very welcome — see CONTRIBUTING.md.


🤝 Contributing

  1. Fork & git switch -c feat/my-awesome-change
  2. Run cargo test --all-features (native) and wasm-pack test --headless (browser).
  3. Open a PR. All code must be formatted with cargo fmt and pass cargo clippy --all-targets --all-features -D warnings.

For bigger proposals open an issue first so we can discuss design.


📜 License

gg-supabase is released under the MIT License — the same permissive licence used by Supabase’s JS, Auth JS and PostgREST JS clients. See LICENSE.

Trademark notice

“Supabase” is a registered trademark of Supabase Inc. Usage here is purely descriptive. gg-supabase is not affiliated with, endorsed by, or sponsored by Supabase Inc. Please review the official brand-asset guide before redistributing logos or naming derivatives. If you publish the crate to the Supabase Marketplace you must not imply it is an official product.


🐾 About the name

All the obvious crate names are parked, so — just like my other libraries — this one carries my initials: gg-supabase.

Enjoy building with Rust + Supabase! 🎉

---

### Cargo.toml tweak

```toml
[package]
name        = "gg-supabase"
version     = "0.1.0"
edition     = "2021"
description = "⚡️ A lightweight, async Rust client mirroring the official supabase-js API (database, auth, realtime, storage)."
license     = "MIT"
```

---

*This README uses factual references to the upstream JS client, existing Rust community crates and Supabase’s brand policy to keep everything accurate and compliant.*
Commit count: 0

cargo fmt