ASP.NET Core dependency injection for the Supabase .NET SDK

Oct 12, 2026

What's new

Supabase.Extensions.DependencyInjection is a new package that provides an easier way to plug the Supabase .NET SDK into your application. It exposes a new method on IServiceCollection called AddSupabase which registers the main client and all sub-clients:


_10
builder.Services.AddSupabase(
_10
supabaseUrl: "https://xyz.supabase.co",
_10
supabaseKey: builder.Configuration["Supabase:Key"]!,
_10
configureOptions: options =>
_10
{
_10
options.AutoConnectRealtime = true;
_10
options.PostgrestRetry = new RetryOptions { MaxRetries = 3 };
_10
});

It registers all clients (Supabase.Client, IGotrueClient, IPostgrestClient, IStorageClient, IFunctionsClient, IRealtimeClient) with a scoped lifecycle, so you can resolve them wherever you need them:


_10
app.MapGet("/movies", async (IPostgrestClient postgrest) =>
_10
await postgrest.Table<Movie>().Get());

The package is available on NuGet:


_10
dotnet add package Supabase.Extensions.DependencyInjection

Why it matters

You can always register all the required clients in IServiceCollection yourself. This package simply does it all for you and removes boilerplate from your codebase.

Build in a weekend, scale to millions