-
Notifications
You must be signed in to change notification settings - Fork 112
Description
Related to an existing integration?
Yes
Existing integration
https://github.com/dotnet/aspire/tree/main/src/Aspire.Hosting.PostgreSQL
Overview
.NET Aspire issue link
Scenario
I have a couple of services that are running on Supabase and others that are one Azure Containers. I need to have all the services on the same infrastructure. Supabase docker image is available freely.
Overview
The Aspire framework does not currently support Supabase, a modern, open-source serverless PostgreSQL-compatible database. It has .NET client packages for C# here https://supabase.com/docs/reference/csharp/introduction
Usage example
To integrate open source Supabase as a hosted resource in a .NET Aspire application:
Install the 'Aspire.Hosting.Supabase' NuGet package:
dotnet add package Aspire.Hosting.Supabase
Add the Supabase server resource in the app host project:
var builder = DistributedApplication.CreateBuilder(args);
// Add Supabase server resource
var sb = builder.AddSupabase("supabase");
// Add a Supabase database
var sbDb = sb .AddDatabase("supabasedb");
// Reference the Supabase database in a project
var exampleProject = builder.AddProject<Projects.ExampleProject>()
.WithReference(sbDb);
// Initialize and run the application
builder.Build().Run();
To enable client projects to connect to Supabase :
Install the Aspire.Supabase
NuGet package:
dotnet add package Aspire.Supabase
Add the Supabase client to the Program.cs file in the client project:
builder.AddSupabaseDataSource("sbdb"));
Both integrations should align with Aspire's existing conventions and provide a similar experience to the PostgreSQL integration.
Breaking change?
No
Alternatives
Not that I can find.
Additional context
Links
https://supabase.com/docs
https://supabase.com/docs/guides/self-hosting/docker
Help us help you
No, just wanted to propose this