Fastify
Register the Trasys SDK's Fastify plugin before your routes to automatically capture every inbound request as a span using sdk.fastifyplugin() at startup.
Fastify
// index.js
require('dotenv').config();
const { sdk } = require('./trasys'); // SDK must be required first
const Fastify = require('fastify');
const app = Fastify({ logger: false });
// Register as a Fastify plugin — before your routes
await app.register(sdk.fastifyplugin());
app.get('/users/:id', async (request, reply) => {
return db.findUser(request.params.id);
});
await app.listen({ port: 3000, host: '0.0.0.0' });TypeScript
// index.ts
import 'dotenv/config';
import { sdk } from './trasys';
import Fastify from 'fastify';
const app = Fastify({ logger: false });
await app.register(sdk.fastifyplugin());
app.get<{ Params: { id: string } }>('/users/:id', async (request, reply) => {
return db.findUser(request.params.id);
});
await app.listen({ port: 3000, host: '0.0.0.0' });If you use a custom type provider (e.g. TypeBoxTypeProvider), cast the return value:
sdk.fastifyplugin() as FastifyPluginAsync
Plugin scope
The plugin uses fastify-plugin internally, which means it decorates the root Fastify instance rather than a scoped child. Every route — regardless of prefix or plugin scope — is automatically instrumented.
Fastify v4 and v5
Both Fastify v4 and v5 are supported. No configuration changes are needed between versions.
Next steps
- Logging — add structured logging correlated to each request
- Session Tracking — link requests to users and sessions
- Distributed Tracing — connect traces across services
Express
Mount the Trasys SDK's Express middleware as the first app.use() call to capture every inbound request as a span before your other application middleware runs.
Hono
Apply the Trasys SDK's middleware to every route in a Hono application with app.use('*', sdk.honoMiddleware()) to automatically capture request spans.

