# JavaScriptHostingExtensions

- Kind: `class`
- Package: [CommunityToolkit.Aspire.Hosting.JavaScript.Extensions](/reference/api/csharp/communitytoolkit.aspire.hosting.javascript.extensions.md)
- Version: `13.4.0`
- Namespace: `Aspire.Hosting`
- Target framework: `net10.0`
- Source: [GitHub](https://github.com/CommunityToolkit/Aspire/blob/d9dc6fc02412d7398c5722840513d99965a6e98f/src/CommunityToolkit.Aspire.Hosting.JavaScript.Extensions/JavaScriptHostingExtensions.cs)

Provides extension methods for adding JavaScript applications to the distributed application builder.

## Definition

```csharp
namespace Aspire.Hosting;

public static class JavaScriptHostingExtensions
{
    // ...
}
```

## Methods

- [AddApp(IResourceBuilder<NxResource>, string, string?, Func<IResourceBuilder<NxAppResource>, IResourceBuilder<NxAppResource>>)](/reference/api/csharp/communitytoolkit.aspire.hosting.javascript.extensions/javascripthostingextensions/methods.md#addapp-iresourcebuilder-nxresource-string-string-func-iresourcebuilder-nxappresource-iresourcebuilder-nxappresource) : `IResourceBuilder<NxAppResource>` `extension` `ats ignored` -- Adds an individual app to an Nx workspace.
- [AddApp(IResourceBuilder<TurborepoResource>, string, string?, Func<IResourceBuilder<TurborepoAppResource>, IResourceBuilder<TurborepoAppResource>>)](/reference/api/csharp/communitytoolkit.aspire.hosting.javascript.extensions/javascripthostingextensions/methods.md#addapp-iresourcebuilder-turboreporesource-string-string-func-iresourcebuilder-turborepoappresource-iresourcebuilder-turborepoappresource) : `IResourceBuilder<TurborepoAppResource>` `extension` `ats ignored` -- Adds an individual app to a Turborepo workspace.
- [AddNxApp(IDistributedApplicationBuilder, string, string?)](/reference/api/csharp/communitytoolkit.aspire.hosting.javascript.extensions/javascripthostingextensions/methods.md#addnxapp-idistributedapplicationbuilder-string-string) : `IResourceBuilder<NxResource>` `extension` `ats export` -- Adds an Nx monorepo workspace to the distributed application builder.
- [AddTurborepoApp(IDistributedApplicationBuilder, string, string?)](/reference/api/csharp/communitytoolkit.aspire.hosting.javascript.extensions/javascripthostingextensions/methods.md#addturborepoapp-idistributedapplicationbuilder-string-string) : `IResourceBuilder<TurborepoResource>` `extension` `ats export` -- Adds a Turborepo monorepo workspace to the distributed application builder.
- [WithBun(IResourceBuilder<NxResource>, bool, Action<IResourceBuilder<JavaScriptInstallerResource>>)](/reference/api/csharp/communitytoolkit.aspire.hosting.javascript.extensions/javascripthostingextensions/methods.md#withbun-iresourcebuilder-nxresource-bool-action-iresourcebuilder-javascriptinstallerresource) : `IResourceBuilder<NxResource>` `extension` `ats ignored` -- Configures the Nx workspace to use bun as the package manager and optionally installs packages before apps start.
- [WithBun(IResourceBuilder<TurborepoResource>, bool, Action<IResourceBuilder<JavaScriptInstallerResource>>)](/reference/api/csharp/communitytoolkit.aspire.hosting.javascript.extensions/javascripthostingextensions/methods.md#withbun-iresourcebuilder-turboreporesource-bool-action-iresourcebuilder-javascriptinstallerresource) : `IResourceBuilder<TurborepoResource>` `extension` `ats ignored` -- Configures the Turborepo workspace to use bun as the package manager and optionally installs packages before apps start.
- [WithMappedEndpointPort(IResourceBuilder<TResource>, string?)](/reference/api/csharp/communitytoolkit.aspire.hosting.javascript.extensions/javascripthostingextensions/methods.md#withmappedendpointport-iresourcebuilder-tresource-string) : `IResourceBuilder<TResource>` `extension` `ats export` -- Maps the endpoint port for the `JavaScript.JavaScriptAppResource` to the appropriate command line argument.
- [WithNpm(IResourceBuilder<NxResource>, bool, Action<IResourceBuilder<JavaScriptInstallerResource>>)](/reference/api/csharp/communitytoolkit.aspire.hosting.javascript.extensions/javascripthostingextensions/methods.md#withnpm-iresourcebuilder-nxresource-bool-action-iresourcebuilder-javascriptinstallerresource) : `IResourceBuilder<NxResource>` `extension` `ats ignored` -- Configures the Nx workspace to use npm as the package manager and optionally installs packages before apps start.
- [WithNpm(IResourceBuilder<TurborepoResource>, bool, Action<IResourceBuilder<JavaScriptInstallerResource>>)](/reference/api/csharp/communitytoolkit.aspire.hosting.javascript.extensions/javascripthostingextensions/methods.md#withnpm-iresourcebuilder-turboreporesource-bool-action-iresourcebuilder-javascriptinstallerresource) : `IResourceBuilder<TurborepoResource>` `extension` `ats ignored` -- Configures the Turborepo workspace to use npm as the package manager and optionally installs packages before apps start.
- [WithPackageManagerLaunch(IResourceBuilder<NxResource>, string?)](/reference/api/csharp/communitytoolkit.aspire.hosting.javascript.extensions/javascripthostingextensions/methods.md#withpackagemanagerlaunch-iresourcebuilder-nxresource-string) : `IResourceBuilder<NxResource>` `extension` `ats export` -- Configures the Nx workspace to use the specified JavaScript package manager when starting apps.
- [WithPackageManagerLaunch(IResourceBuilder<TurborepoResource>, string?)](/reference/api/csharp/communitytoolkit.aspire.hosting.javascript.extensions/javascripthostingextensions/methods.md#withpackagemanagerlaunch-iresourcebuilder-turboreporesource-string) : `IResourceBuilder<TurborepoResource>` `extension` `ats export` -- Configures the Turborepo workspace to use the specified JavaScript package manager when starting apps.
- [WithPnpm(IResourceBuilder<NxResource>, bool, Action<IResourceBuilder<JavaScriptInstallerResource>>)](/reference/api/csharp/communitytoolkit.aspire.hosting.javascript.extensions/javascripthostingextensions/methods.md#withpnpm-iresourcebuilder-nxresource-bool-action-iresourcebuilder-javascriptinstallerresource) : `IResourceBuilder<NxResource>` `extension` `ats ignored` -- Configures the Nx workspace to use pnpm as the package manager and optionally installs packages before apps start.
- [WithPnpm(IResourceBuilder<TurborepoResource>, bool, Action<IResourceBuilder<JavaScriptInstallerResource>>)](/reference/api/csharp/communitytoolkit.aspire.hosting.javascript.extensions/javascripthostingextensions/methods.md#withpnpm-iresourcebuilder-turboreporesource-bool-action-iresourcebuilder-javascriptinstallerresource) : `IResourceBuilder<TurborepoResource>` `extension` `ats ignored` -- Configures the Turborepo workspace to use pnpm as the package manager and optionally installs packages before apps start.
- [WithYarn(IResourceBuilder<NxResource>, bool, Action<IResourceBuilder<JavaScriptInstallerResource>>)](/reference/api/csharp/communitytoolkit.aspire.hosting.javascript.extensions/javascripthostingextensions/methods.md#withyarn-iresourcebuilder-nxresource-bool-action-iresourcebuilder-javascriptinstallerresource) : `IResourceBuilder<NxResource>` `extension` `ats ignored` -- Configures the Nx workspace to use yarn as the package manager and optionally installs packages before apps start.
- [WithYarn(IResourceBuilder<TurborepoResource>, bool, Action<IResourceBuilder<JavaScriptInstallerResource>>)](/reference/api/csharp/communitytoolkit.aspire.hosting.javascript.extensions/javascripthostingextensions/methods.md#withyarn-iresourcebuilder-turboreporesource-bool-action-iresourcebuilder-javascriptinstallerresource) : `IResourceBuilder<TurborepoResource>` `extension` `ats ignored` -- Configures the Turborepo workspace to use yarn as the package manager and optionally installs packages before apps start.
