# AddBunApp

- Module: [Aspire.Hosting.JavaScript](/reference/api/go/aspire.hosting.javascript.md)
- Version: `17.0.0`
- Kind: `method`
- Defined on: `DistributedApplicationBuilder`
- Source: [GitHub](https://github.com/microsoft/aspire/tree/bcfa151cdca6d0a573f22d5d9c23f9c727cb3b2f)

Adds a Bun application to the application model. Bun should be available on the PATH.

## Remarks

This method executes the script directly using `bun <script>`. Bun natively runs JavaScript and TypeScript
files so no transpile step is required.
If the application directory contains a `package.json` file, Bun will be added as the default package manager.
When publishing to a container, the default base image is `oven/bun:1` for both the build and runtime stages.

## Definition

```go
func (DistributedApplicationBuilder) AddBunApp(
    name string,
    appDirectory string,
    scriptPath string,
) BunAppResource
```

## Parameters

- `name` (`string`) -- The name of the resource.
- `appDirectory` (`string`) -- The path to the directory containing the Bun application.
- `scriptPath` (`string`) -- The path to the script (for example, `server.ts`) relative to `appDirectory` to run.

## Returns

[`BunAppResource`](/reference/api/go/aspire.hosting.javascript/bunappresource.md) -- The resource builder.

Returns a handle; failures surface later via `Err()`.

## Applies to

- `DistributedApplicationBuilder`
