floris-xlx / supabase_rs

Supabase SDK for Rust
MIT License
10 stars 6 forks source link

Using external crates for core functionality #24

Open strykejern opened 2 days ago

strykejern commented 2 days ago

I see that a lot of the core functionality is implemented locally in this project instead of relying on external crates. Was using other crates considered?

I did some searching and found a few candidates covering a lot of the functionality of Supabase. Maybe we could consider using these instead of implementing this functionality ourselves?

By leveraging other crates more I think we could simplify our work on building and maintaining this project. We could then lean on their feature implementations and testing and instead supply value in tying it all together in this crate.

REST API

Since Supabase's REST API is PostgREST I think we could leverage the crate postgrest.

Storage

I think Supabase has support for the S3 protocol, so I'm thinking that we could try to use a crate for interacting through that interface to avoid rolling our own implementation. Crates that came up in search are aws-sdk-s3, object_store and rusoto_s3. It's worth looking into if any of these (or similar) could be used to interact with the storage system.

Auth

I'm not sure if this is some standard API that has specific crates for interacting with it, so if not we would maybe have to roll our own. I see that other people are already working on this, and we could see if we could use a crate like supabase-auth directly here.

GraphQL

I don't have any experience with GraphQL, but maybe we could leverage crates like graphql_client or similar?

floris-xlx commented 1 day ago

You make a good point, however in the end we are wrapping a REST api, there's only so many things that would actually yield positive results with depend it vs write it yourself.

We keep more control over the total binary size and internal dependancy tree.

We use supabase_rs in production at xylex and im not sure what we would gain however your point is valid.

floris-xlx commented 1 day ago

Supabase wrapped any S3 or whatever the fuck they use internally so it's abstracted away to a neat REST api