> ## Documentation Index
> Fetch the complete documentation index at: https://mintlify.com/vercel/workflow/llms.txt
> Use this file to discover all available pages before exploring further.

# workflow build

> Build workflow bundles for deployment

## Usage

```bash theme={null}
workflow build [options]
```

Or using the short alias:

```bash theme={null}
wf build [options]
```

## Options

<ParamField path="--target" type="string" default="standalone">
  Build target for deployment.

  **Alias:** `-t`

  **Options:**

  * `standalone` - Standalone deployment
  * `vercel-build-output-api` - Vercel Build Output API

  **Example:**

  ```bash theme={null}
  workflow build --target standalone
  workflow build -t vercel-build-output-api
  ```
</ParamField>

<ParamField path="--workflow-manifest" type="string" default="">
  Output location for workflow manifest.

  Must end in `.json`, `.js`, `.cjs`, or `.mjs`.

  **Alias:** `-m`

  **Example:**

  ```bash theme={null}
  workflow build --workflow-manifest ./dist/manifest.json
  workflow build -m ./output/workflows.js
  ```
</ParamField>

## Positional Arguments

<ParamField path="target" type="string">
  Build target (deprecated, use `--target` flag instead).

  **Example:**

  ```bash theme={null}
  workflow build standalone  # deprecated
  workflow build --target standalone  # preferred
  ```
</ParamField>

## Examples

### Default Build

```bash theme={null}
workflow build
```

Builds with standalone target.

### Vercel Build

```bash theme={null}
workflow build --target vercel-build-output-api
```

### Custom Manifest Location

```bash theme={null}
workflow build --workflow-manifest ./dist/manifest.json
```

### Combined Options

```bash theme={null}
workflow build --target standalone --workflow-manifest ./build/workflows.json
```

## Build Targets

### `standalone`

Builds workflows for standalone deployment:

* Creates workflow bundles
* Generates manifest
* Suitable for custom hosting

Output:

```
.workflow/
├── workflows.mjs
├── steps.mjs
├── webhook.mjs
└── manifest.json
```

### `vercel-build-output-api`

Builds workflows for Vercel deployment:

* Creates Vercel Build Output API compatible functions
* Configures serverless functions
* Sets up edge routes

Output:

```
.vercel/output/
└── functions/
    ├── .well-known/workflow/v1/flow.func/
    ├── .well-known/workflow/v1/step.func/
    └── .well-known/workflow/v1/webhook/[token].func/
```

## Output

Successful build:

```bash theme={null}
$ workflow build --target standalone

Using target: standalone
Building with StandaloneBuilder
Build completed successfully!
```

With warnings:

```bash theme={null}
$ workflow build --target invalid

Invalid target "invalid". Using default "standalone".
Valid targets: standalone, vercel-build-output-api
Using target: standalone
Building with StandaloneBuilder
Build completed successfully!
```

Build error:

```bash theme={null}
$ workflow build

Using target: standalone
Building with StandaloneBuilder
Error: Build failed: Unable to find workflow files
```

## Error Handling

### Invalid Manifest Extension

```bash theme={null}
$ workflow build --workflow-manifest ./manifest.txt

Error: Invalid --workflow-manifest provided, must end in .json or .js. 
Received: ./manifest.txt
```

### Invalid Target

Automatically falls back to `standalone` with a warning.

### Build Failures

Displays detailed error message:

```bash theme={null}
Error: Build failed: [error details]
```

## Configuration

The build command uses `getWorkflowConfig()` to load configuration:

* Discovers workflow files in the project
* Applies build target settings
* Configures output paths
* Sets up bundler options

## Workflow Discovery

Automatically discovers workflows from:

* `workflows/` directory
* Source directories configured by framework integrations
* Files with `"use workflow"` or `"use step"` directives

## Manifest Output

The manifest contains:

```json theme={null}
{
  "workflows": {
    "workflowId": {
      "id": "workflowId",
      "name": "Workflow Name",
      "steps": [...]
    }
  },
  "steps": {
    "stepId": {
      "id": "stepId",
      "name": "Step Name"
    }
  },
  "classes": {...}
}
```

## Exit Codes

* `0` - Build succeeded
* `1` - Build failed

## Related Commands

* [workflow dev](/api-reference/cli/dev) - Development server (coming soon)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.