Trasys
Node.js SDKFrameworks

Framework Integrations

Mount Trasys middleware in Express, Fastify, Hono, or NestJS to capture method, route, status code, latency, user, session, and trace context per request.

Framework Integrations

The SDK provides a middleware for each supported framework. Mount it as early as possible in your middleware stack — before authentication, body parsing, or route handlers — so it captures the full request lifecycle.

What gets captured automatically

Every instrumented request produces a span with:

AttributeDescription
Method + route pattern/users/:id, not /users/123
Status code + latencyFull end-to-end duration
User ID + tenant IDRead from req.user after your auth middleware runs
Session IDDerived from JWT, cookie, or header per your session config
W3C traceparentExtracted from inbound requests for distributed tracing
x-trasys-trace-idInjected into responses for frontend correlation

Supported frameworks

Ignored routes

Routes listed in ignoreRoutes are skipped entirely — no span is created and the request passes through immediately.

Default ignored routes: /health, /healthz, /ping, /metrics, /favicon.ico

createSdk({
  ignoreRoutes: ['/health', '/internal/ready', '/internal/live', '/_next'],
});

Bun compatibility

All framework middleware works normally on Bun. The SDK detects the Bun runtime at startup and adjusts accordingly.

One limitation on Bun: outbound HTTP spans are not captured. Calls made with fetch will not appear as child spans, and no traceparent header is injected into those requests. Inbound request spans, AI spans, database spans, and all other instrumentation work normally.


Next steps

  • Distributed Tracing — how traceparent propagates once a request leaves this service
  • Session Tracking — how the session ID shown above is derived
  • Sampling — control which of these requests actually get recorded

On this page