All connectors
Frameworks

Fastify

Fastify plugin with preHandler hooks.

Registers a preHandler hook that runs the engine before route handlers. Honours Fastify schemas and per-route opt-out.

Install

pnpm add @blackunicorn/bonklm-fastify

Minimal example

import Fastify from 'fastify'
import { GuardrailEngine } from '@blackunicorn/bonklm'
import { bonklmPlugin } from '@blackunicorn/bonklm-fastify'

const app = Fastify()
const guard = new GuardrailEngine({ validators: ['prompt-injection'] })
await app.register(bonklmPlugin, { guard })
Related connectors