LogTide integration for Nuxt 3 — auto error capture, request tracing via Nitro hooks, and Vue error handling.
- Nuxt Module — zero-config setup via
nuxt.config.ts - Server-side request tracing via Nitro lifecycle hooks
- Vue error handler for client-side error capture
- Navigation tracking as breadcrumbs on the client
- W3C Trace Context propagation (
traceparent) - Runtime config injection (server + public)
- Full TypeScript support with strict types
npm install @logtide/nuxt
# or
pnpm add @logtide/nuxt
# or
yarn add @logtide/nuxtAdd the module to your nuxt.config.ts:
// nuxt.config.ts
export default defineNuxtConfig({
modules: ['@logtide/nuxt'],
logtide: {
dsn: 'https://lp_your_key@your-instance.com',
// Or use apiUrl + apiKey instead of dsn:
// apiUrl: 'https://your-instance.com',
// apiKey: 'lp_your_key',
service: 'my-nuxt-app',
environment: 'production',
release: '1.0.0',
},
});That's it. The module automatically:
- Registers a Nitro server plugin that traces every request and captures errors
- Registers a Vue client plugin that captures Vue errors and tracks navigation
All options are set in nuxt.config.ts under the logtide key:
| Option | Type | Default | Description |
|---|---|---|---|
dsn |
string |
required | DSN string: https://lp_KEY@host/PROJECT |
service |
string |
'nuxt-app' |
Service name for log attribution |
environment |
string |
— | Environment (e.g. production, staging) |
release |
string |
— | Release / version identifier |
debug |
boolean |
false |
Enable debug logging |
The server plugin hooks into Nitro's lifecycle:
request— creates a trace span, extracts incomingtraceparent, stores context on the eventafterResponse— finishes the span asokerror— finishes the span aserrorand captures the error with full context
The client plugin:
- Sets up
vueApp.config.errorHandlerto capture Vue component errors - Tracks
page:startandpage:finishhooks as navigation breadcrumbs - Reads configuration from Nuxt runtime config (public)
The module injects LogTide configuration into Nuxt's runtime config, making it available in both server and client plugins:
// Server-side
const config = useRuntimeConfig().logtide;
// Client-side
const config = useRuntimeConfig().public.logtide;import type { ModuleOptions } from '@logtide/nuxt';The ModuleOptions interface extends ClientOptions from @logtide/types (excluding integrations and transport which are configured automatically).
MIT License - see LICENSE for details.
