Skip to main content
Published
Aug 25, 2026
1mo ago
Total Downloads
270.7K
270,727

Install

dotnet add package Aspire.Hosting.Nats --version 13.5.3
ProductVersions
.NET
net8.0

README

NATS hosting integration

Use this integration to model, configure, and orchestrate a NATS resource in an Aspire solution.

Getting started

Add the integration

From your AppHost directory, add the Aspire.Hosting.Nats integration with the Aspire CLI:

aspire add Aspire.Hosting.Nats

Usage example

In the AppHost, add a NATS resource and reference it from another resource with either C# or TypeScript:

C#

var nats = builder.AddNats("nats");

var myService = builder.AddProject<Projects.MyService>()
                       .WithReference(nats);

TypeScript

const nats = await builder.addNats("nats");

const myService = await builder.addNodeApp("myService", "../my-service", "server.js")
                       .withReference(nats);

Connection Properties

When you reference a NATS resource using WithReference, the following connection properties are made available to the consuming project:

NATS server

The NATS server resource exposes the following connection properties:

Property Name Description
Host The hostname or IP address of the NATS server
Port The port number the NATS server is listening on
Username The username for authentication
Password The password for authentication
Uri The connection URI with the format nats://{Username}:{Password}@{Host}:{Port}

Aspire exposes each property as an environment variable named [RESOURCE]_[PROPERTY]. For instance, the Uri property of a resource called nats becomes NATS_URI.

Additional documentation

Feedback & contributing

https://github.com/microsoft/aspire

Changes from Previous Version

No structural changes between v13.5.2 and v13.5.3.

Adoption Assessment

A verified publisher signal is available. Assess fit from the package's supported frameworks, license and dependency graph rather than popularity alone.

Compatibility metadata lists 1 target framework; confirm the exact target used by your application.The published metadata declares 33 direct dependency entries across framework groups. Inspect the resolved dependency graph for your target framework.

Related Guides & Workflows

Learn how to evaluate, integrate, or audit this package in your .NET project.