Skip to content

Choosing the Right Integration

Not sure which FlareLog integration to use? This guide will help you decide.

Quick Decision Tree

Are you using a framework?
├── Yes
│   ├── Express    → @flarelog/sdk/express
│   ├── Hono       → @flarelog/sdk/hono
│   ├── Next.js    → @flarelog/sdk/next
│   ├── React      → @flarelog/sdk/react
│   └── TanStack   → @flarelog/sdk/tanstack-start
└── No (plain handler)
    ├── Cloudflare Workers → @flarelog/sdk/cf-workers
    ├── Vercel Serverless  → @flarelog/sdk/vercel (withVercelServerless)
    ├── Vercel Edge        → @flarelog/sdk/vercel (withVercelEdge)
    └── Node.js / other    → @flarelog/sdk (core)

Integration Reference

Your stackImportWhat you get
Express@flarelog/sdk/expressexpressMiddleware + expressErrorHandler, req.logger
Hono@flarelog/sdk/honohonoMiddleware, c.get("logger")
Next.js (API routes)@flarelog/sdk/nextwithFlareLog, req.logger + req.traceId
React (browser)@flarelog/sdk/reactFlareLogErrorBoundary, useFlareLog hook
TanStack Start@flarelog/sdk/tanstack-startServer function + client wrappers
Cloudflare Workers (plain)@flarelog/sdk/cf-workersworkerFetch, full OTel spans, ctx.waitUntil flush
Vercel (standalone API, Edge, Middleware)@flarelog/sdk/vercelwithVercelServerless + withVercelEdge
No framework / custom@flarelog/sdkCore flarelog() factory, spans, logError, breadcrumbs

Common Confusion Points

  • "Next.js on Vercel" → Use @flarelog/sdk/next. The Next.js integration works on any hosting platform; Vercel is just deployment.
  • "React on Vercel" → Use @flarelog/sdk/react for the client side, @flarelog/sdk/next for API routes.
  • "Vercel without Next.js" → Use @flarelog/sdk/vercel for standalone api/ routes, Edge Functions, and Middleware.
  • "Hono on Cloudflare Workers" → Use @flarelog/sdk/hono for the middleware. Optionally pair with @flarelog/sdk/cf-workers for workerFetch.

Rule of thumb: Pick the framework integration first. Only reach for the platform integration (cf-workers, vercel) when you don't use a framework or need platform-specific features like OTel span auto-creation or execution-context flushing.

Framework vs Platform Integrations

Understanding the difference helps you pick the right one:

Framework integrationsPlatform integrations
Examples/express, /hono, /next, /react, /tanstack-start/cf-workers, /vercel
Tied toA web frameworkA deployment runtime
Works onAny platform that runs the frameworkOnly the specific platform
What they doAttach logger to framework objects (req.logger, c.get("logger"))OTel span creation, execution-context flushing, env detection
When to useYou're using that framework (always preferred)You're writing raw handlers without a framework

Overlap examples

ScenarioUseReason
Next.js on Vercel/nextFramework integration is the right abstraction
Next.js on a VPS/nextSame — framework integration is platform-agnostic
Hono on Cloudflare Workers/honoFramework integration; Hono runs natively on Workers
Plain Worker (no framework)/cf-workersNeed platform-specific workerFetch + ctx.waitUntil
Vercel API route (no Next.js)/vercelNeed platform-specific Serverless/Edge wrappers
Express on Vercel Serverless/expressFramework integration; runs on Node.js under the hood

Released under the MIT License.