Replies: 2 comments 5 replies
-
|
I just have to reiterate, a stateful implementations in singleton patterns is not best practice - https://learn.microsoft.com/en-us/dotnet/core/extensions/dependency-injection-guidelines |
Beta Was this translation helpful? Give feedback.
-
|
My two cents - for the vast majority of C# users writing REST services or traditional SSR apps, you probably don't need this library at all. Use the Supabase JavaScript/TypeScript SDK on the client, and just connect to the Postgres instance via your vanilla SQL integration strategy of choice, be it Entity Framework, an ORM or whatever you prefer. There are a handful of things like Auth that you will find much easier to deal with using the JavaScript SDK. If you use (asymmetric) JWTs you can auth those on your backend via cookie or params as you wish from the JWT obtained by the JavaScript SDK. You might find it interesting to write your Supabase functions using PostgREST and access those via RPC, either using the JavaScript SDK or on the server using your REST strategy of choice. The primary practical use for this library IMHO is for C#/.NET client-side software, like a Unity or Godot project. I suppose there's a tiny subset of folks writing traditional C# client side apps but it's a very, very tiny userbase at this point. This library can be used stateless, but IMHO you are then just using it as a less well adopted version of a REST client and ORM. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello -
I am new to Supbase integration but severely struggling with the design patterns presented around Supabase.Client, the Supabase.GoTrue.AdminClient, and the Supabase.GoTrue.StatelessClient for deployment within an ASP.NET server side application.
As a general REST API providing business logic and integration with Supabase - the Supabase.Client as a system that allows internal state and session mutation is fundamentally an anti-pattern to asynchronous and concurrent API request handling. I feel like a common use case for Supabase integration would be server-side applications (who unto themselves are issued security keys) would be able to execute privileged requests through the Supabase API without session mutation --- upon further reading, perhaps they can?
Supabase.Client.Auth and Supbase.Client.Auth.Admin - here presented (2) more libraries, that seems to bifurcate the public/private surface within Supabase but Admin depends on Auth which depends on the stateful Supabase.Client - so again we are left with uncertainty around consumption an utilization in concurrent web request pipeline.
Or possibly more obscure//arguably bad security practice - the AdminClient is stated to be stateless unto itself - provided you construct it with a valid JWT, which you cannot generate through Supabase controlled surfaces for the updated API Keys, nor does Supabase continue to use shared symmeteric keys - therefore, you are left with manually minting JWTs from asymmetric signing keys, (also manually generated) but the generation process and requirements are not descride in this project or the documentation outside of the Unit Testing examples for ServiceRole and StatelssClient.
What am I misunderstanding about server-side integration with Supabase? If we are consuming what is fundamentally and HTTP surface in C# it feels the SDK abstraction has gone sideways on allow secure server communication with the Supabase platform? Why is minting your own JWTs required for server side integration in a stateless fashion? Is there any planned develpment support for using the updated API Keys Supabase offers? I'd be willing to help contribute, but I am clearly completely lost on this SDKS architecture and interpretation of Clients and integration with .NET. The closest pattern presented for ASP is the MAUI DI pattern, which ignores the potential problems with concurrent session mutation during service level user management in a singleton.
Honestly, I feel like I have missed something massive in the design intention? This discussion is maybe asking for clarity on how these SDKs are to be used for basic operations like creating and updating users (from the server) without mutating the state of the Supabase.Client on the server?
Beta Was this translation helpful? Give feedback.
All reactions