Make crate idiomatic, production-ready, and easy to use#11
Merged
Conversation
- Add unified Error type with thiserror, removing LogoutError and DbError - Make Supabase::new() fallible, validating url and api_key are present - Add typed AuthResponse/EmptyResponse structs for auth endpoints - Deduplicate auth headers with private auth_post() helper - Add API error handling (non-2xx returns Error::Api) in auth and db - Add execute_and_parse<T>() convenience method on QueryBuilder - Add #[must_use] on QueryBuilder - Move tokio to dev-dependencies, remove unused time dependency - Re-export key types (Error, AuthResponse, Claims, QueryBuilder) - Add crate-level documentation with quick start example - Add crates.io metadata (keywords, categories)
The CI environment has SUPABASE_URL and SUPABASE_API_KEY set, so tests that assert new(None, ...) fails were passing due to env var fallback. Temporarily remove the env vars in those tests and restore afterward.
kacy
added a commit
that referenced
this pull request
Jan 30, 2026
Make crate idiomatic, production-ready, and easy to use
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Bumps version to 0.3.0 with the following changes:
LogoutErrorandDbErrorwith a singlethiserror-derivedErrorenum (Config,Request,Serialization,Jwt,AuthRequired,Api)Supabase::new()returnsResult, validating thaturlandapi_keyare presentAuthResponseorEmptyResponseinstead of rawreqwest::Response, with automatic non-2xx →Error::Apiconversionauth_post()helper eliminates repeated header setup across 9 auth methodsexecute()checks HTTP status and returnsError::Apifor non-2xx; newexecute_and_parse::<T>()for automatic JSON deserializationtime, movetokioto dev-deps, addthiserror = "2"Error,AuthResponse,Claims,QueryBuilderavailable at crate rootkeywords/categories#[must_use]onQueryBuilderto warn if.execute()is forgottenBreaking changes
Supabase::new()returnsResult?or.unwrap()AuthResponse/EmptyResponselogout()returns singleResultDbErrorremovedsupabase_rust::ErrorLogoutErrorremovedError::AuthRequiredtokiomoved to dev-depsTest plan
cargo build --libcompiles cleanlycargo test— all 27 tests passcargo doc --no-deps— docs generate without warnings