Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Neon integration #398

Open
Boburmirzo opened this issue Jan 15, 2025 · 0 comments
Open

Add Neon integration #398

Boburmirzo opened this issue Jan 15, 2025 · 0 comments
Labels
integration A new .NET Aspire integration

Comments

@Boburmirzo
Copy link

.NET Aspire issue link

dotnet/aspire#7118

Overview

The Aspire framework does not currently support Neon, a modern, open-source serverless PostgreSQL-compatible database. It has managed integration for Azure as well. While it is possible to use the existing client integrations for PostgreSQL or Npgsql, Neon offers additional features like database branching that are not supported out of the box. We want to enable these unique features through dedicated .NET packages for Aspire.

Usage example

Here is an example of usage

Hosting Integration for Neon

To integrate open source Neon as a hosted resource in a .NET Aspire application:

Install the Aspire.Hosting.Neon NuGet package:

dotnet add package Aspire.Hosting.Neon

Add the Neon server resource in the app host project:

var builder = DistributedApplication.CreateBuilder(args);

// Add Neon server resource with branching support
var neon = builder.AddNeonProject("neon");

// Add a Neon database
var neonDb = neon.AddDatabase("neondb");

// Reference the Neon database in a project
var exampleProject = builder.AddProject<Projects.ExampleProject>()
                            .WithReference(neonDb);

// Initialize and run the application
builder.Build().Run();

Client Integration for Neon

To enable client projects to connect to Neon:

Install the Aspire.Neon NuGet package:

dotnet add package Aspire.Neon

Add the Neon client to the Program.cs file in the client project:

builder.AddNeonDataSource("neondb").addBranch("dev");

Both integrations should align with Aspire's existing conventions and provide a similar experience to the PostgreSQL integration.

Additional context

We are looking for .NET Aspire experts from the community to help us in developing this integration. Let me know your feedback!

Help us help you

Yes, but only if others can assist

@Alirexaa Alirexaa added the integration A new .NET Aspire integration label Jan 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
integration A new .NET Aspire integration
Projects
None yet
Development

No branches or pull requests

2 participants