Node.js
Generic server-side integration. @nreactive/core auto-captures
uncaughtException, unhandledRejection, process warnings, and outbound
HTTP failures the moment you call init(). Works on Node ≥ 20 with zero
runtime dependencies.
AI-assisted setup
Paste the prompt below into Claude Code, Cursor, Copilot, or Codex — your agent will detect your package manager, install the dependency, create the observability module, and rewire your entry file.
You are adding the @nreactive/core SDK to this Node.js project. nreactive is a production error-monitoring service that opens AI-generated pull requests to fix the errors it catches.
Do the following with the project's existing package manager (detect it from the lockfile: package-lock.json → npm, pnpm-lock.yaml → pnpm, yarn.lock → yarn, bun.lockb → bun):
1. Install the package @nreactive/core.
2. Create "src/observability/nreactive.ts" (or ".js" if the project is plain JavaScript) that imports init from @nreactive/core and calls it with { appId: process.env.NREACTIVE_APP_ID, environment: process.env.NODE_ENV, release: process.env.APP_VERSION }. Export nothing — the module is used for its import side effect.
3. In the server entry file (commonly src/index.ts, src/server.ts, or the "main" field of package.json), add import "./observability/nreactive"; as the VERY FIRST import — before any other import including framework code.
4. Add NREACTIVE_APP_ID= to .env.example (create it if missing) and document it in the README's environment-variables section. The user obtains their App ID from https://nreactive.com/dashboard/apps.
5. If the project uses Express or Fastify, stop and recommend @nreactive/express or @nreactive/fastify instead — they provide per-request context.
6. Restart the process and throw a test error (e.g. setTimeout(() => { throw new Error("nreactive test"); }, 100)) to confirm events appear in the dashboard.
Do not invent additional configuration. The defaults already capture uncaughtException, unhandledRejection, process warnings, and outbound HTTP failures.Manual setup
Get your App ID
Sign in and grab your App ID from the Apps page. It looks
like app_ab12cd34ef. Export it as NREACTIVE_APP_ID so the SDK can read
it from process.env.
Install
pnpm add @nreactive/coreOr npm install @nreactive/core / yarn add @nreactive/core / bun add @nreactive/core.
Wire it up
Create src/observability/nreactive.ts so init runs as a side effect when
imported:
import { init } from "@nreactive/core";
init({
appId: process.env.NREACTIVE_APP_ID!,
environment: process.env.NODE_ENV,
release: process.env.APP_VERSION,
});Then import it first in your entry file — before any other import:
import "./observability/nreactive";
// ...the rest of your appThat's it. Manual capture is always available:
import { captureException } from "@nreactive/core";
captureException(new Error("payment failed"), "critical", {
tags: { feature: "checkout" },
user: { id: "u_42" },
});Verify
Restart the process and trigger an error:
setTimeout(() => {
throw new Error("nreactive test");
}, 100);Within a few seconds the event shows up on the Errors page of your dashboard.
Using Express or Fastify? You'll get richer per-request context (method, url, request ID, user) from @nreactive/express or @nreactive/fastify.