Skip to main content
net10.0net8.0net9.0

An Aspire integration for hosting NodeJS apps using Vite, Yarn, PNPM, or NPM.

Published
Sep 28, 2026
1mo ago
Total Downloads
232.6K
232,605

Install

dotnet add package CommunityToolkit.Aspire.Hosting.JavaScript.Extensions --version 13.5.1-beta.781
ProductVersions
.NET
net10.0net8.0net9.0

README

CommunityToolkit.Aspire.Hosting.JavaScript.Extensions library

This integration contains extensions for the Node.js hosting package for Aspire, including support for frontend monorepos (Nx, Turborepo).

Getting Started

Install the package

In your AppHost project, install the package using the following command:

dotnet add package CommunityToolkit.Aspire.Hosting.JavaScript.Extensions

Example usage

For Nx and Turborepo monorepos, use the dedicated monorepo methods to avoid package installation race conditions:

// Nx workspace
var nx = builder.AddNxApp("nx", workingDirectory: "../frontend")
    .WithYarn()
    .WithPackageManagerLaunch(); // Automatically uses yarn from installer

var app1 = nx.AddApp("app1");
var app2 = nx.AddApp("app2", appName: "my-app-2");

// Turborepo workspace
var turbo = builder.AddTurborepoApp("turbo", workingDirectory: "../frontend")
    .WithPackageManagerLaunch("pnpm"); // Explicitly specify pnpm

var turboApp1 = turbo.AddApp("app1");
var turboApp2 = turbo.AddApp("app2", filter: "custom-filter");

See MONOREPO.md for detailed documentation on monorepo support.

Configuring Package Manager for Monorepos

The WithPackageManagerLaunch() method configures which package manager command is used when running individual apps in Nx or Turborepo workspaces:

// Auto-infer from package installer
var nx = builder.AddNxApp("nx", workingDirectory: "../frontend")
    .WithYarn()
    .WithPackageManagerLaunch(); // Uses 'yarn' command

// Explicitly specify package manager
var turbo = builder.AddTurborepoApp("turbo", workingDirectory: "../frontend")
    .WithPnpm()
    .WithPackageManagerLaunch("pnpm"); // Uses 'pnpm' command

// Bun example
var bunRepo = builder.AddTurborepoApp("bun-repo", workingDirectory: "../frontend")
    .WithBun()
    .WithPackageManagerLaunch("bun"); // Uses 'bun' command

// Generated commands:
// Nx with yarn: yarn nx serve app1
// Turborepo with pnpm: pnpm turbo run dev --filter app1
// Turborepo with bun: bunx turbo run dev --filter app1

Package installation with custom flags

You can pass additional flags to package managers during installation:

// yarn with frozen lockfile
builder.AddYarnApp("yarn-app", "./path/to/app")
    .WithYarnPackageInstallation(configureInstaller =>
    {
        configureInstaller.WithArgs("--frozen-lockfile", "--verbose");
    })
    .WithExternalHttpEndpoints();

// pnpm with frozen lockfile
builder.AddPnpmApp("pnpm-app", "./path/to/app")
    .WithPnpmPackageInstallation(configureInstaller =>
    {
        configureInstaller.WithArgs("--frozen-lockfile");
    })
    .WithExternalHttpEndpoints();

Additional Information

https://learn.microsoft.com/dotnet/aspire/community-toolkit/hosting-nodejs-extensions

Feedback & contributing

https://github.com/CommunityToolkit/Aspire

Changes from Previous Version

No structural changes between v13.5.1-beta.779 and v13.5.1-beta.781.

Adoption Assessment

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

This version is marked prerelease. Validate its API and upgrade path before production use.Compatibility metadata lists 3 target frameworks; confirm the exact target used by your application.

Related Guides & Workflows

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