Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds a complete Supabase stack integration for .NET Aspire, enabling local development with full Supabase functionality. The integration goes beyond the original issue's scope by providing not just PostgreSQL, but a complete Supabase stack including Auth (GoTrue), REST API (PostgREST), Storage, Kong API Gateway, Studio Dashboard, Postgres-Meta, and Edge Functions support.
Changes:
- Complete Supabase stack with 8+ containerized services working together
- Fluent configuration API for each Supabase component
- Project synchronization from remote Supabase instances
- Local migrations and Edge Functions support
- 44 comprehensive unit tests
Reviewed changes
Copilot reviewed 39 out of 39 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/CommunityToolkit.Aspire.Hosting.Supabase/*.cs | Core implementation with resources, builders, and extensions |
| src/CommunityToolkit.Aspire.Hosting.Supabase/Sync/*.cs | Remote project synchronization functionality |
| src/CommunityToolkit.Aspire.Hosting.Supabase/Helpers/*.cs | SQL generation and Edge Function routing |
| tests/CommunityToolkit.Aspire.Hosting.Supabase.Tests/*.cs | Comprehensive test coverage (44 tests) |
| examples/supabase/* | Complete AppHost example with ServiceDefaults |
| README.md, CommunityToolkit.Aspire.slnx | Documentation and solution integration |
@dotnet-policy-service agree |
|
Can be added client for supabase that will automatically initialize var url = Environment.GetEnvironmentVariable("SUPABASE_URL");
var key = Environment.GetEnvironmentVariable("SUPABASE_KEY");
var options = new Supabase.SupabaseOptions
{
AutoConnectRealtime = true
};
var supabase = new Supabase.Client(url, key, options);
await supabase.InitializeAsync();something like that:
|
aaronpowell
left a comment
There was a problem hiding this comment.
I think there are the bones of a solid integration taking shape here but there's a bit of work that needs to be done before it would fit into the community toolkit.
I've left quite a few comments throughout the PR (although I didn't add them to all the resource classes as there was a set of repeated comments on all of them).
The one thing that I don't think this integration is currently doing well enough is leveraging the Aspire app model design around resource creation and management, and that will need addressing before it could be merged in.
| .WithMigrations("<path_to_migrations_folder>") | ||
| .WithEdgeFunctions("<path_to_edge_functions_folder>"); |
There was a problem hiding this comment.
obviously this is intended for example purposes, but will this have a problem when running the example app? Would it be better to leave that for the docs instead?
| .ConfigureAuth(auth => auth | ||
| .WithSiteUrl("http://localhost:3000") | ||
| .WithAutoConfirm(true) | ||
| .WithAnonymousUsers(true)) | ||
| .ConfigureStorage(storage => storage | ||
| .WithFileSizeLimit(100_000_000) // 100MB | ||
| .WithImageTransformation(true)) | ||
| .ConfigureDatabase(db => db | ||
| .WithPassword("your-secure-password") | ||
| .WithPort(54322)) |
There was a problem hiding this comment.
From an API design perspective, this doesn't align with Aspire, each of those parts should be treated as resources that you manage:
superbase.WithAuth() // pass any required args
.WithSiteUrl(...)
.WithAutoConfirm(true)
.WithAnonymousUsers(true);
superbase.WithStorage(fileSizeLimit: 100_000_000)
.WithImageTransformation(true);
var database = superbase.WithDatabase(password: passwordResource)
.WithPort(54322);| Action<IResourceBuilder<SupabaseAuthResource>> configure) | ||
| { | ||
| var stack = builder.Resource; | ||
| if (stack.Auth == null) |
There was a problem hiding this comment.
| if (stack.Auth == null) | |
| if (stack.Auth is null) |
| Action<IResourceBuilder<SupabaseDatabaseResource>> configure) | ||
| { | ||
| var stack = builder.Resource; | ||
| if (stack.Database == null) |
There was a problem hiding this comment.
| if (stack.Database == null) | |
| if (stack.Database is null) |
| } | ||
| catch (Exception ex) | ||
| { | ||
| Console.WriteLine($"[Supabase Sync] ERROR: {ex.Message}"); |
| /// <summary> | ||
| /// Service for synchronizing data from an online Supabase project to the local development environment. | ||
| /// </summary> | ||
| internal static class SyncService |
There was a problem hiding this comment.
My initial take on this is that it should be a resource that Aspire manages rather than just some arbitrary code that is run during the app host.
Conceptually, it's similar to an installer provided by npm, yarn, python, etc. and we should design it that way.
|
|
||
| namespace CommunityToolkit.Aspire.Hosting.Supabase.Tests; | ||
|
|
||
| [Collection("Supabase")] |
|
|
||
| namespace CommunityToolkit.Aspire.Hosting.Supabase.Tests; | ||
|
|
||
| [Collection("Supabase")] |
| @@ -0,0 +1,6 @@ | |||
| namespace CommunityToolkit.Aspire.Hosting.Supabase.Tests; | |||
|
|
|||
| [CollectionDefinition("Supabase", DisableParallelization = true)] | |||
aaronpowell
left a comment
There was a problem hiding this comment.
I think there are the bones of a solid integration taking shape here but there's a bit of work that needs to be done before it would fit into the community toolkit.
I've left quite a few comments throughout the PR (although I didn't add them to all the resource classes as there was a set of repeated comments on all of them).
The one thing that I don't think this integration is currently doing well enough is leveraging the Aspire app model design around resource creation and management, and that will need addressing before it could be merged in.
Closes #417
Overview
This PR adds a complete Supabase stack integration for .NET Aspire, enabling local development with full Supabase functionality.
Features
ConfigureAuth(),ConfigureDatabase(),ConfigureStorage(), etc.Usage
PR Checklist
Other information
Tests
[Collection("Supabase")]to avoid file locking issues during parallel executionExample Project
Container Images Used
supabase/postgres- PostgreSQL with Supabase extensionssupabase/gotrue- Authentication servicepostgrest/postgrest- REST APIsupabase/storage-api- File storagekong- API Gatewaysupabase/postgres-meta- Database metadata APIsupabase/studio- Dashboard UIsupabase/edge-runtime- Edge Functions runtime