---
title: "Nuxt"
description: "Register Blyp as a Nuxt server plugin, access the scoped logger per event, and mount clientLogHandler in a server API route."
canonical_url: "https://www.blyp.dev/docs/integrations/nuxt"
markdown_url: "https://www.blyp.dev/docs/integrations/nuxt.md"
last_updated: "2018-10-20"
x_farming_labs_generated_preamble: true
---

# Nuxt
URL: /docs/integrations/nuxt
LLM index: /llms.txt
Description: Register Blyp as a Nuxt server plugin, access the scoped logger per event, and mount clientLogHandler in a server API route.

# Nuxt

Import from `@blyp/core/nuxt`. The `createLogger()` export is an alias of `createNuxtLogger()`.

```ts
import { createLogger } from "@blyp/core/nuxt";

const nuxtLogger = createLogger({
  level: "info",
});

// server/plugins/blyp.ts
const serverPlugin = nuxtLogger.serverPlugin;
export default serverPlugin;
```

## Using the logger in handlers

Use `getLogger(event)` when you need the request-scoped logger inside a server route or handler:

```ts
export default defineEventHandler((event) => {
  nuxtLogger.getLogger(event).info("nuxt-route");
  return { ok: true };
});
```

Nuxt reuses Blyp's Nitro request lifecycle internally, so request-scoped logging behavior matches the Nitro adapter.

## Client ingestion route

Mount the client ingestion handler as a Nuxt server API route:

```ts
// server/api/inngest.post.ts
import { createLogger } from "@blyp/core/nuxt";

const nuxtLogger = createLogger();

const clientLogHandler = nuxtLogger.clientLogHandler;
export default clientLogHandler;
```

`clientLogHandler` is exported as an event handler and uses the configured ingestion path.

## What auto-logged requests look like

With automatic request logging enabled, Blyp emits terminal output like:

```text
[INFO]  GET  /health        200  2ms
[INFO]  POST /checkout      200  143ms
[INFO]  GET  /users/42      404  8ms
[ERROR] POST /payments      500  1203ms
```

Fields included automatically: method, path, status code, and duration.

**In production (NDJSON):**

```json
{"level":"info","time":1710000000000,"msg":"GET /health","type":"http_request","method":"GET","url":"/health","statusCode":200,"responseTime":2}
{"level":"info","time":1710000000001,"msg":"POST /checkout","type":"http_request","method":"POST","url":"/checkout","statusCode":200,"responseTime":143}
```

## Relevant types

```ts
import type {
  NuxtEventLike,
  NuxtLoggerConfig,
  NuxtLoggerFactory,
  NuxtLoggerPlugin,
} from "@blyp/core/nuxt";
```

## Sitemap

See the full [sitemap](/sitemap.md) for all pages.
Docs-scoped sitemap: [/docs/sitemap.md](/docs/sitemap.md).
Well-known sitemap: [/.well-known/sitemap.md](/.well-known/sitemap.md).
