Nuxt 3 Security Monitoring With SecureNow: Setup Guide

Add SecureNow security monitoring to a Nuxt 3 app with the official Nuxt module: install, nuxt.config.ts, runtime config, deployment, CLI checks and fixes.

Apr 2, 2026·7 min read

Nuxt 3 Security Monitoring With SecureNow: Setup Guide

Modern Nuxt 3 applications are not “just frontends.” With Nitro, you ship API routes, server middleware, authentication callbacks, webhooks, and SSR HTML from the same codebase. Every one of those server entry points is a place where abuse can start: credential stuffing against /api/auth, SQL injection in query parameters, scanners probing for /.env, or bots hammering SSR pages to burn CPU. Traditional front-end analytics will not tell you what happened on the server before your page was sent.

SecureNow turns OpenTelemetry traces from your Nuxt server into a security-aware observability stream: you see who hit what, how fast it failed or succeeded, which headers were present, and (when enabled) redacted bodies for mutating requests — without building a custom logging pipeline or bolting a WAF onto every route by hand.

This guide is intentionally practical. You will install one npm package, add a single line to nuxt.config.ts, run npx securenow login and npx securenow init, and run nuxt dev. After that, we cover optional configuration, what is traced automatically, how to deploy to common hosts, how to confirm traces with the CLI, and what to do when something does not show up in the dashboard.

...

Why Nuxt 3 Apps Need Security Observability

Unified server surface. In Nuxt 3, “the server” is not a separate repo — it is Nitro: file-based API handlers, server routes, middleware, and SSR execution. A single compromised assumption in one handler can expose data from another. You need visibility that ties each incoming request to method, path, status, duration, and client context.

SSR amplifies risk. Server-side rendering executes your code for every page view. Attackers can craft URLs and headers that stress rendering paths, cache keys, or data-fetching logic. Without traces, you are guessing from CPU graphs.

API routes are public by default. Unless you lock everything behind auth, /api/* endpoints are discoverable. Observability lets you distinguish legitimate clients from scanning traffic and correlate spikes with specific paths and IPs.

Production parity. Development and production should send the same shape of telemetry (with sensible sampling if you choose). SecureNow uses OTLP over HTTP — the same integration pattern whether you run node .output/server/index.mjs on your own server or deploy to Vercel.

...

Prerequisites

  • Node.js 22.23.4+, 24.22.1+, or 26.12.1+ (LTS recommended; match what your host supports in production).
  • A Nuxt 3 or 4 project (nuxt >= 3.0.0). If you only have Nuxt 2, this module path is not applicable — upgrade or use a generic Node instrumentation path instead.
  • A terminal and browser for dashboard verification.
  • The SecureNow CLI (npx securenow, shipped in the same package) to log in, link the project to an application, and run traces from the command line.

If you do not have a Nuxt app yet, scaffold one:

npx nuxi@latest init my-nuxt-app
cd my-nuxt-app
npm install
...

Step 1: Install securenow

From your project root:

npm install securenow

This package includes the OpenTelemetry SDK, Node auto-instrumentations, OTLP exporters, the SecureNow CLI entrypoint, and the Nuxt module re-exported as securenow/nuxt. You do not need to install @opentelemetry/* packages manually for the basic flow — the module externalizes them so Nitro does not incorrectly bundle OpenTelemetry internals.

If you use pnpm or yarn, the same dependency applies:

pnpm add securenow
# or
yarn add securenow
...

Step 2: Add the Module to nuxt.config.ts

Open nuxt.config.ts (or nuxt.config.js) and register the module:

export default defineNuxtConfig({
  modules: ['securenow/nuxt'],
});

That is the only change to nuxt.config.ts. When the dev or production server starts, you should see a short log line indicating the module loaded and the Nitro server plugin was registered — more on that under verification.

If you already have other modules (Pinia, UI libraries, etc.), append 'securenow/nuxt' to the existing array:

export default defineNuxtConfig({
  modules: ['@pinia/nuxt', 'securenow/nuxt'],
});

TypeScript: Nuxt picks up the module without extra @types — the package ships integration metadata compatible with Nuxt 3’s module resolution.

...

Step 3: Log In and Run init

SecureNow does not take its settings from .env variables. It reads .securenow/runtime.json in the project root (same level as nuxt.config.ts), and the CLI writes that file for you:

npx securenow login
npx securenow init

login opens the browser, where you sign up or log in and pick an application or create one; the app key and runtime API key are saved in .securenow/runtime.json (gitignored). init fills in the secure defaults and checks that securenow/nuxt is in your modules. The parts that matter here look like this:

{
  "apiKey": "snk_live_...",
  "app": { "key": "a1b2c3d4-e5f6-7890-abcd-ef1234567890", "name": "my-nuxt-app" },
  "config": {
    "logging": { "enabled": true },
    "capture": { "body": true }
  }
}
SettingPurpose
app.keyIdentifies your application in the SecureNow dashboard; it becomes the service name. Written by login.
apiKeyRuntime API key for telemetry ingestion and firewall sync. Secret: never commit it.

Production and hosted platforms: run npx securenow credentials runtime --env production and mount the file it writes as .securenow/credentials.json next to the .output server. Hosts that cannot mount a file take the same JSON in one secret environment variable, SECURENOW_CREDENTIALS (print it with --format env). That and SECURENOW_DISABLED=1 are the only environment variables the SDK reads.

...

Step 4: Start the App and Verify Traces Appear

Start the development server:

npx nuxt dev

Watch the terminal for lines similar to:

[securenow] Nuxt module loaded — server plugin registered
[securenow] pid=4242 appId="a1b2c3d4-…" instance="https://ingest.securenow.ai" apiKey=set credentials=…/.securenow/runtime.json → service.name=a1b2c3d4-… instance.id=a1b2c3d4-…
[securenow] OTel SDK started → https://ingest.securenow.ai/v1/traces

If you see the SDK start message, apiKey=set and your app key as service.name, the pipeline is live.

Generate traffic:

  • Open the app in the browser (SSR will emit spans).
  • Hit an API route if you have one, e.g. GET /api/health.
  • Use curl if you prefer:
curl -i http://localhost:3000/
curl -i http://localhost:3000/api/your-endpoint

Confirm in the product:

npx securenow status
npx securenow traces

You should see recent traces for your service. For a fuller view, open the SecureNow web app in the browser and filter by your app.

...

Optional Configuration in .securenow/runtime.json

The module takes no options in nuxt.config.ts: a securenow: { ... } block there is ignored, and the build prints a warning if you set one. Settings live under config in .securenow/runtime.json, like every other SecureNow integration. Common keys:

{
  "config": {
    "capture": { "body": true, "maxBodySize": 10240, "sensitiveFields": [] },
    "logging": { "enabled": true },
    "runtime": { "noUuid": null }
  }
}

config.capture.body

When true (the default), mutating requests can include body payloads in telemetry (JSON, form-urlencoded, GraphQL, etc.). Sensitive fields are redacted using built-in rules; you can extend redaction with config.capture.sensitiveFields (a list of field names). Large bodies are skipped based on config.capture.maxBodySize (default 10240 bytes).

It gives you forensic detail for abuse investigations; set it to false if a project does not need that.

config.logging.enabled

When true (the default), console.log, console.info, console.warn, console.error, and console.debug are forwarded as OpenTelemetry log records and correlated with active spans. The module loads the same runtime as the Express flow, so there is no separate console instrumentation to add.

config.runtime.noUuid

Leave it at its default (null, meaning auto): when the credentials hold an app key, every process reports under that exact service name, so multiple instances in production show up as one logical service, which makes dashboards and alerts easier to reason about. Set true or false only for advanced routing needs.

Environment variables

For CI or hosts where you only control env vars, the SDK reads exactly two:

EnvEffect
SECURENOW_CREDENTIALSThe runtime credentials JSON (raw or base64), printed by npx securenow credentials runtime --env production --format env. Takes precedence over credential files.
SECURENOW_DISABLED=1Turns SecureNow off for that process (for example in tests).

SECURENOW_CAPTURE_BODY, SECURENOW_LOGGING_ENABLED, SECURENOW_NO_UUID, SECURENOW_MAX_BODY_SIZE and the other old SECURENOW_* variables are ignored. An alternative OTLP base URL goes in the file as config.otel.endpoint.

...

What Gets Traced Automatically

You do not need to wrap each handler. The Nitro server plugin and OpenTelemetry stack record:

  • All Nitro server handler requests — including dynamic API routes under /server/api (or your configured structure), server middleware, and SSR page requests that execute on the server.
  • HTTP semantics — method, path, status code, and duration.
  • Client IP — with proxy-aware resolution when X-Forwarded-For or similar headers are present (depends on your deployment; configure trusted proxies on the platform when applicable).
  • Headers — User-Agent, Referer, Origin, Host, and security-relevant auth/cookie/CSRF context where available.
  • Request IDs and correlation — when present, so you can tie logs and traces together across services.

With config.capture.body on (the default), mutating methods include redacted body snippets where allowed by size and content type.

With config.logging.enabled on (the default), your application logs show up alongside traces for the same request, which dramatically shortens incident triage.

...

Deployment

Node.js server (Docker, PM2, bare metal)

Build and run the standard Nitro output:

npx nuxt build
node .output/server/index.mjs

Put the production credentials next to the server: npx securenow credentials runtime --env production writes .securenow/credentials.production.json; mount or copy it as .securenow/credentials.json. No extra preload flags are required — the module loads with Nuxt. Without the module, start the same output with node -r securenow/register .output/server/index.mjs (under PM2, use node_args: ['-r', require.resolve('securenow/register')] in ecosystem.config.cjs: a bare -r is resolved from the PM2 daemon's folder in cluster mode).

Vercel

Add one secret, SECURENOW_CREDENTIALS (printed by npx securenow credentials runtime --env production --format env), in Project → Settings → Environment Variables for Production and Preview, then redeploy. Vercel runs your server in a Node-compatible runtime for SSR; tracing targets that server path. This path has not been tested end to end yet, and the firewall has not been verified on Vercel serverless functions.

Cloudflare / Netlify / other hosts

SecureNow runs inside a Node.js process, so edge runtimes (Cloudflare Workers, Netlify Edge Functions) are not supported. On a host that runs the Nitro output as a Node server, such as Fly.io, Render, Railway or Heroku, set SECURENOW_CREDENTIALS in the provider dashboard if you cannot mount the credentials file. If your deployment splits edge vs Node, confirm where Nuxt executes your API routes and SSR — the Node part is where SecureNow will see traffic.

...

Using the CLI to View Traces

After you log in once:

npx securenow login

List recent traces (uses your default app if configured):

npx securenow traces

Set a default application to avoid passing IDs every time:

npx securenow config set defaultApp YOUR_APP_ID

Other useful commands while debugging instrumentation:

CommandPurpose
npx securenow whoamiConfirm CLI auth
npx securenow statusHigh-level app / collector status
npx securenow traces show <traceId>Inspect one trace
npx securenow logsRecent log records if logging is enabled

The CLI is optional for sending telemetry — the module does that at runtime — but it is the fastest way to verify payloads without only relying on the browser.

...

Troubleshooting

No traces in the dashboard

  1. Confirm credentials — .securenow/runtime.json (in production, .securenow/credentials.json or SECURENOW_CREDENTIALS) must be present where nuxt dev or production node .output/server/index.mjs runs. The startup line says which credentials were used (credentials=...), and npx securenow doctor checks the config.
  2. Read startup logs — You should see [securenow] OTel SDK started and an OTLP URL. If the module loaded but the SDK did not start, check for errors immediately above.
  3. Network egress — From the machine or container, the OTLP endpoint must be reachable (firewall, corporate proxy, air-gapped CI). A quick test: curl -I to the host or run a one-off Node script that POSTs to /v1/traces (expect 405 or auth errors — anything but total connection failure).
  4. Wrong app — If you have several apps, verify the dashboard filter matches the service.name printed in the startup logs.

Module does not load

  • Ensure Nuxt 3 or 4 (nuxt >= 3.0.0) and securenow 8.24.0 or later: before 8.24.0 the module's plugin crashed the nuxt build server at startup.
  • Put 'securenow/nuxt' in modules, not the deprecated buildModules for Nuxt 3.
  • Delete .nuxt and node_modules/.cache and restart after major upgrades.

Bundling or externals errors

The module adds OpenTelemetry packages to Nitro externals. If you still see bundling errors, merge additional externals manually:

export default defineNuxtConfig({
  modules: ['securenow/nuxt'],
  nitro: {
    externals: {
      external: ['securenow', '@opentelemetry/api', '@opentelemetry/sdk-node'],
    },
  },
});

Adjust the list to match the error message — the package README lists the full recommended set.

Traces only in dev, not production

  • Credentials are often present in development but not in production — mount .securenow/credentials.json or set SECURENOW_CREDENTIALS for production too.
  • .securenow/runtime.json is gitignored, so it never reaches a build server or container on its own — use the production credentials file or the host's secret store.
  • With cluster mode or multiple replicas, every process reports under the same service name as long as the credentials hold the app key — no setting needed.

Sensitive data concerns

Body capture is on by default, with built-in redaction. If you worry about leakage, set config.capture.body to false in production and enable it only during incidents, or extend config.capture.sensitiveFields. Logs (config.logging.enabled) should avoid printing secrets in console.* — treat the log pipeline as security-sensitive.

...

Security Detections (What Happens After Traces Flow)

Once OTLP data reaches SecureNow, the platform can correlate traces with detection logic — for example unusual error rates on auth routes, suspicious patterns in parameters and bodies (when captured), and anomalous client behavior. Exact feature availability depends on your plan and configuration; the instrumentation goal is to give the backend enough structured context to reason about abuse without rewriting your Nuxt app.

...

Recap

StepActionRough time
1npm install securenowUnder a minute
2Add modules: ['securenow/nuxt']Seconds
3npx securenow login + npx securenow initOne minute
4nuxt dev and hit a page or APIOne minute
OptionalTune config.capture and config.logging in .securenow/runtime.jsonAs needed

That is the full “under two minutes” path for someone who already has a Nuxt project and credentials; add a few more minutes if you are also creating the SecureNow app and logging in for the first time.

...

Next Steps

  • Explore traces and issues in the SecureNow web dashboard for your app.
  • Set alert rules for critical paths (login, admin APIs, payment webhooks).
  • Use npx securenow traces during development to build intuition for what normal traffic looks like before you need it in an incident.
  • Read the package README on npm for the latest runtime settings and Nitro compatibility notes.

Happy shipping — and clear visibility into what your Nuxt server is actually doing.

Frequently Asked Questions

Do I need to wrap every API route or Nitro handler in custom middleware?

No. The securenow/nuxt module registers a Nitro server plugin that instruments server-side traffic automatically. You keep your existing routes, server middleware, and composables — no per-route boilerplate.

Does SecureNow trace client-side navigation and browser-only code?

The Nuxt integration focuses on server-side execution: Nitro handlers, SSR-rendered pages, and API routes. Client bundle code is not the primary signal for this module; security-relevant request metadata is captured where requests enter your server.

Can I use the same OTLP endpoint on Vercel, Cloudflare, and a plain Node server?

On a plain Node server, mount the production credentials file as .securenow/credentials.json. On a host that cannot mount a file, such as Vercel, set SECURENOW_CREDENTIALS (printed by npx securenow credentials runtime --env production --format env) instead; that path has not been tested end to end yet, and the firewall has not been verified on Vercel serverless functions. Edge runtimes such as Cloudflare Workers are not supported: SecureNow runs inside a Node.js process.

How do I avoid splitting traces across many random service names in production?

Nothing to set: when the credentials hold an app key, every process reports under that exact service name (config.runtime.noUuid defaults to auto). A securenow.noUuid option in nuxt.config.ts and the SECURENOW_NO_UUID variable are no longer read.

Recommended reading

Block an IP, a Range or One Route Without a Deploy (Node.js)

Block one IP, a CIDR range, or a single route and method in a Node.js app within seconds, with no code change: setup, scoping, CLI, MCP, verification and undo.

Oct 27
11 Signs Your AI-Built App Needs a Security Audit

Built your app with a coding agent? 11 warning signs it needs a security audit, each checkable in five minutes, and how to run the full audit yourself.

Oct 26
AI Security Audit Part 1: Set Up Your Agent to Audit Code

Part 1 of the AI security audit series: set up an AI coding agent to audit your app locally, connect SecureNow, and run your first threat-model pass.

Jul 24