Documentation
Docs/Integrations/Node.js / NestJS

Node.js / NestJS Integration

Native support for Node.js, NestJS, Express, and Fastify.

The NxtOne Node.js agent automatically intercepts framework requests, database queries, and async call stacks for TypeScript/JavaScript servers.

1. Install Package

Install the appropriate package depending on whether you use TypeScript or JavaScript:

TypeScript (NestJS / Express)
bash
npm install @nxtone/agent-ts
JavaScript (Node.js / Express)
bash
npm install @nxtone/agent-js

2. Agent Initialization

For best results, you must initialize NxtOne at the **very first line** of your application's entry file (e.g. main.ts or index.js). This ensures the observation layer is active before any other packages are imported:

TypeScript / NestJS (main.ts)
typescript
import * as nxtone from '@nxtone/agent-ts'; // Initialize NxtOne before NestJS bootstrap nxtone.init({ apiKey: "nxt_live_abc123", projectId: "gateway-service" }); import { NestFactory } from '@nestjs/core'; import { AppModule } from './app.module'; async function bootstrap() { const app = await NestFactory.create(AppModule); await app.listen(3000); } bootstrap();
JavaScript / Express (index.js)
javascript
import nxtone from '@nxtone/agent-js'; nxtone.init({ apiKey: "nxt_live_abc123", projectId: "api-service" }); import express from 'express'; const app = express(); app.get('/api', (req, res) => { res.json({ ok: true }); }); app.listen(3000);

3. Configuration Options

The nxtone.init() option object supports:

  • apiKey: Your NxtOne API Key (can also be set via NXTONE_API_KEY env var).
  • projectId: The name of this service.
  • exclude: Array of file name patterns or folders to exclude from instrumentation.
NestJS / Express Interceptors: NxtOne hooks directly into the Node.js module resolution pipeline. It automatically wraps standard modules (like http, express, pg, mongodb, and redis) to construct complete database-to-API trace flows.
On This Page
What is NxtOne?Key FeaturesQuick StartInstall the agentAnnotate your applicationConfigure API keyConfiguration ReferenceAPI ExampleSupported StackLanguages & FrameworksNext Steps