Skip to content

Framework Integrations

Six frameworks across three languages. Each integration captures requests at the transport layer.

Express

  • expressMiddleware() must be the first middleware (before express.json(), cors(), routes)
  • Errors passed to next(err) are captured via the error handler
  • See Node.js SDK for full setup

Next.js

  • Create instrumentation.ts in your project root (not app/ or src/)
  • Must be async function register() with NEXT_RUNTIME === "nodejs" guard and dynamic import()
  • Only /api/* routes captured; static pages and _next/* are skipped
  • Requires Next.js 14+
  • See Node.js SDK for full setup

FastAPI

  • Monitor(app, ...) must be called after app = FastAPI() and before route definitions
  • Adds HTTP middleware internally via @app.middleware("http")
  • See Python SDK for full setup

Flask

  • Monitor(app, ...) must be called after app = Flask(__name__) and before route definitions
  • Uses before_request, after_request, and teardown_request hooks
  • See Python SDK for full setup

net/http (Go)

  • kohi.NetHTTPMiddleware(monitor)(mux) must be the outermost middleware
  • Call monitor.Close() on shutdown
  • See Go SDK for full setup

fasthttp (Go)

  • kohi.FastHTTPMiddleware(monitor)(handler) must be the outermost handler wrapper
  • Call monitor.Close() on shutdown
  • See Go SDK for full setup

Wizard

npx @kohicorp/wizard

Auto-detects your framework from package.json, go.mod, or pyproject.toml/requirements.txt. Installs the SDK, creates .env, shows setup code. Use --local for local development.