Quick start
Install the peekinside package, attach it to your app, and open the dashboard.
Install#
npm install peekinside
PeekInside needs Node.js 18 or later.
Attach it to your app#
import express from 'express';
import PeekInside from 'peekinside';
const app = express();
PeekInside.attach(app);
app.use(express.json());
// ...your routes
app.listen(3000);
Start your app as usual. PeekInside prints the link to its dashboard:
[peekinside] Requests from orders-api: http://localhost:7335/p/orders-api-1a2b3c4d
Middleware order doesn't matter: request bodies are captured as your app reads them.
Send a test error#
To check the setup before your app breaks on its own, run this in your app's folder:
npx peekinside test
It sends one error the way your app would, to the local dashboard, or to PeekInside Cloud when PEEKINSIDE_API_KEY is set (in the environment, .env or .env.local), and prints where to see it.
Koa, Fastify and native http#
PeekInside.attach(koaApp); // new Koa()
PeekInside.attach(fastify); // Fastify(), before fastify.listen()
PeekInside.attach(server); // http.createServer(...)
Servers created with http.createServer(app) are detected automatically.
NestJS#
import { NestFactory } from '@nestjs/core';
import PeekInside from 'peekinside';
import { AppModule } from './app.module';
async function bootstrap() {
const app = await NestFactory.create(AppModule);
PeekInside.attach(app); // before app.listen()
await app.listen(3000);
}
bootstrap();
It works the same on Express and on Fastify (new FastifyAdapter()), with Nest 10 and later. Requests are recorded with their route and controller method (/orders/:id, OrdersController.findOne). Errors your exception filters answer count as handled; the ones Nest answers itself with a 500 (and logs as ExceptionsHandler) as unhandled; 4xx exceptions such as NotFoundException aren't recorded. Lines written with Nest's Logger go to the Logs page, and @nestjs/schedule methods to the Jobs page, failures included.
A worker made with NestFactory.createApplicationContext() sets up its scheduled jobs while it is created, so create PeekInside first:
const peekInside = new PeekInside();
const worker = await NestFactory.createApplicationContext(WorkerModule);
peekInside.attachTo(worker);
Hono#
import { serve } from '@hono/node-server';
import { Hono } from 'hono';
import PeekInside from 'peekinside';
const app = new Hono();
PeekInside.attach(app); // anywhere before serve()
app.get('/users/:id', (c) => c.json({ id: c.req.param('id') }));
serve({ fetch: app.fetch, port: 3000 });
Requests are recorded with the route that answered them (/users/:id), whether PeekInside is attached before your routes and middleware or after them. Errors your app.onError() handler (or a sub-app's) answers count as handled; the ones Hono answers itself with a 500 as unhandled. PeekInside records Hono apps on Node.js, served by @hono/node-server. The app's port shows in the dashboard from its first request.
TypeScript and CommonJS#
Type definitions ship with the package:
import PeekInside, { type PeekInsideOptions } from 'peekinside';
const options: PeekInsideOptions = { project: 'orders-api', ignorePaths: ['/health', /^\/metrics/] };
PeekInside.attach(app, options);
They use the Node.js types from @types/node, which TypeScript projects for Node.js already have.
PeekInside is an ES module. CommonJS apps load it with require() on Node.js 20.19+ and 22.12+:
const { default: PeekInside } = require('peekinside');
TypeScript compiled to CommonJS can keep import PeekInside from 'peekinside', with esModuleInterop (on by default with "module": "nodenext").
Next#
- Open the local dashboard and look around: using the dashboard explains filters and shortcuts.
- When your app runs on a server, connect it to PeekInside Cloud.