@apirelio/fastify
v0.2.1
Published
Fail-safe customer-aware API analytics plugin for Fastify.
Maintainers
Readme
Apirelio Fastify SDK
Documentation · npm · Apirelio
Connect Fastify API errors, latency and releases to the affected customers without capturing request or response payloads.
Fastify 4–5 plugin for privacy-safe, customer-aware API analytics. Capture happens in Fastify's
onResponse lifecycle hook and only enqueues into a bounded background batch transport.
npm install @apirelio/fastifyimport Fastify from 'fastify'
import apirelioFastify from '@apirelio/fastify'
const app = Fastify()
await app.register(apirelioFastify, {
apiKey: process.env.APIRELIO_API_KEY ?? '',
endpoint: process.env.APIRELIO_ENDPOINT ?? 'https://apirelio.com',
service: 'billing-api',
environment: 'production',
includeRoutes: ['/api/**'],
excludeRoutes: ['/api/health', '/api/internal/**'],
resolveCustomer: request => request.user ? { id: String(request.user.companyId) } : null,
})The plugin flushes during Fastify shutdown. Bodies, query strings, cookies, authorization values, email addresses and IP addresses are never captured.
Route patterns are exact paths or prefixes ending in /**. If includeRoutes is omitted, all
incoming Fastify routes are eligible; excludeRoutes always takes precedence.
