---
title: "Build"
description: "Produces a static deploy:"
canonical_url: "https://devfra.me/adapters/build"
---
# Build

> Produces a static deploy:

Produces a static deploy:

1. Copies the SPA dist into `<outDir>`.
2. Runs `setup(ctx)` with `mode: 'build'`.
3. Collects RPC dumps for every `'static'` and `'query'` with `dump.inputs` / `snapshot: true`.
4. Writes `__connection.json` (`{ backend: 'static' }`) and sharded dumps under `__rpc-dump/`.

```ts
import { createBuild } from 'devframe/adapters/build'
import myDevframe from './my-tool'

await createBuild(myDevframe, {
  outDir: 'dist-static',
})
```

| Option    | Default            | Description                                                                    |
| --------- | ------------------ | ------------------------------------------------------------------------------ |
| `outDir`  | `dist-static`      | Output directory (cleared).                                                    |
| `distDir` | `def.clientAssets` | SPA dist override (or [remote assets](https://devfra.me/guide/client-assets)). |
| `pretty`  | `false`            | Pretty-print dump JSON.                                                        |

The RPC client runs read-only. For a custom URL base, build with relative asset paths (`vite.base: './'`).

`buildHub()` from `@devframes/hub/build` produces the same kind of deploy for a whole hub: [Static builds](https://devfra.me/guide/hub-initiate#static-builds).


## Sitemap

See the full [sitemap](https://devfra.me/sitemap.md) for all pages.
