# Pagerless for Node.js

> One import at the top of your entry file covers any Node server. Framework hooks add the errors your framework catches itself.

URL: https://pagerless.dev/integrations/nodejs
Updated: 2026-10-22

## Set up

```bash
npm i pagerless
```

```js
import "pagerless/auto"; // first line of your server entry
```

Set `PAGERLESS_KEY` (your ingest key from the Pagerless app) in your host's environment. Without it the SDK does nothing, so local dev stays quiet.

CommonJS: `require("pagerless/auto")`. Or start it in code: `require("pagerless").init({ service: "api" })`.

## What it catches

- Uncaught exceptions and unhandled promise rejections (your process still exits as before; Pagerless flushes for up to 2 seconds first).
- Status and latency for every route of any `node:http` server, using the route pattern when your framework provides one.
- Failing calls to other services: 5xx, 429 and network errors from fetch, axios, got and the Stripe SDK. Stripe, PayPal, OpenAI, Anthropic, Supabase, Neon, Resend, Twilio and others are tagged by name.
- A heartbeat every 60 seconds, so a silent app wakes you after 5 minutes.
- A deploy marker when the release is known (Vercel, Railway, Render, Heroku, Fly, Cloudflare and GitHub commit variables are read automatically).

## Framework hooks

- [Next.js](https://pagerless.dev/integrations/nextjs): One line in `instrumentation.ts` covers pages, layouts, route handlers, server actions and middleware, on Node and the edge.
- [Nuxt](https://pagerless.dev/integrations/nuxt): One server plugin hooks Nitro's `error` hook: API routes, server rendering and middleware.
- [SvelteKit](https://pagerless.dev/integrations/sveltekit): Export `handleError` from your hooks
- [Astro](https://pagerless.dev/integrations/astro): One middleware export, or the integration in `astro.config`
- [Remix and React Router](https://pagerless.dev/integrations/remix): Export `handleError` from the server entry
- [Express](https://pagerless.dev/integrations/express): One error handler after your routes
- [Fastify](https://pagerless.dev/integrations/fastify): One call registers an `onError` hook.
- [Koa](https://pagerless.dev/integrations/koa): Add it as the first middleware
- [NestJS](https://pagerless.dev/integrations/nestjs): One line after `NestFactory.create`, or register the exception filter yourself.
- [Hono](https://pagerless.dev/integrations/hono): One middleware right after `new Hono()`, on every runtime Hono runs on.
- [tRPC](https://pagerless.dev/integrations/trpc): One adapter option
- [Bun](https://pagerless.dev/integrations/bun): The same one import as Node
- [Deno](https://pagerless.dev/integrations/deno): One import from npm
- [Electron](https://pagerless.dev/integrations/electron): Main-process crashes, crashed renderers and GPU or child processes, grouped into problems you can act on.
- [React Native and Expo](https://pagerless.dev/integrations/react-native): JS errors and fatal crashes from your app, sent within 1.5 seconds of a fatal one, with an in-memory queue for when the phone is offline.

## Report things yourself

```js
import { capture, event } from "pagerless";

try {
  await chargeCard(order);
} catch (err) {
  capture(err, { route: "POST /checkout", tags: { plan: "pro" } });
  throw err;
}

event({ title: "Refund queue backed up", severity: "tell" });
```

## Settings

| Variable | Default |
| --- | --- |
| `PAGERLESS_KEY` | Required. Without it the SDK is off. |
| `PAGERLESS_SERVICE` | Your host's service name, else package.json name, else `app` |
| `PAGERLESS_ENV` | `VERCEL_ENV`, `RAILWAY_ENVIRONMENT_NAME` or `NODE_ENV`, else `production` |
| `PAGERLESS_RELEASE` | The commit from your host's variables |
| `PAGERLESS_DISABLED=1` | Turns it off |

## Questions

### Which Node versions?

Node 18.19 or newer, ESM or CommonJS.

### Will it slow my app?

Events are counted and grouped in memory and sent in batches in the background. Requests are never held up waiting for Pagerless.
