> For AI agents: the complete documentation index is available at /bull-board/llms.txt, the full documentation bundle is available at /bull-board/llms-full.txt.

# Fastify

[Fastify](https://fastify.dev/). `@bull-board/fastify` registers as a plugin.

## Install

```sh
npm install @bull-board/api @bull-board/fastify
```

::: warning Fastify 5 only
The adapter bundles `@fastify/static` and `@fastify/view`, both of which target `fastify@5`. Registering it on `fastify@4` throws a version mismatch from `fastify-plugin` before the dashboard ever serves a request. Upgrade Fastify, or mount the dashboard on a separate Express instance instead.
:::

```ts
import { createBullBoard } from '@bull-board/api';
import { BullMQAdapter } from '@bull-board/api/bullMQAdapter';
import { FastifyAdapter } from '@bull-board/fastify';
import { Queue } from 'bullmq';
import Fastify from 'fastify';

const queue = new Queue('my-queue', {
  connection: { host: 'localhost', port: 6379 },
});

const app = Fastify();

const serverAdapter = new FastifyAdapter();

createBullBoard({
  queues: [new BullMQAdapter(queue)],
  serverAdapter,
});

serverAdapter.setBasePath('/ui');
await app.register(serverAdapter.registerPlugin(), { prefix: '/ui' });

await app.listen({ host: '0.0.0.0', port: 3000 });
```

`FastifyAdapter` takes the base path from `setBasePath()` or the `prefix` option on `app.register()`. If you set both, they must match, otherwise asset URLs will 404.

::: tip
Top-level `await` in the example. Wrap the body in `async function main() { ... }; main()` if you're on plain CommonJS.
:::

## Full runnable examples

- Simple setup: [`examples/with-fastify`](https://github.com/felixmosh/bull-board/tree/master/examples/with-fastify)
- With basic auth: [`examples/with-fastify-auth`](https://github.com/felixmosh/bull-board/tree/master/examples/with-fastify-auth)
- With visibility guard: [`examples/with-fastify-visibility-guard`](https://github.com/felixmosh/bull-board/tree/master/examples/with-fastify-visibility-guard)

## Next steps

- [UIConfig](/bull-board/configuration/ui-config.md): title, logo, locale, polling.
- [Read-only mode](/bull-board/recipes/read-only-mode.md): disable destructive actions.
- [Visibility guard](/bull-board/recipes/visibility-guard.md): scope visible queues per request.
- [Formatters](/bull-board/recipes/formatters.md): rewrite job fields for the UI.
