Debugging Hono apps on Node.js
Every request your Hono app handles on Node.js, with the route that answered it, the error it threw, its database queries and its logs.
npm install peekinsidePeekInside shows what your Hono app does with each request: the route that answered it, the error it threw with your lines of code around it, the database queries it ran, the APIs it called and what it logged, in a dashboard on your machine. It's for Hono on Node.js, served by @hono/node-server.
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 });
serve() reads app.fetch when it's called, so attach PeekInside before it. Before or after your routes and middleware doesn't matter.
What you see for each request#
- The route that answered it, as you declared it (
/users/:id), with its parameters, including routes of sub-apps mounted withapp.route(). The Routes page groups requests by it. - The request and the response: headers, query, bodies (captured as your app reads them, with
c.req.json()or the rest) and status. - The error it threw, with its stack trace and your source lines, TypeScript included.
- Its database queries (pg, mysql2, Prisma, MongoDB, Mongoose, and Drizzle, Kysely or Knex on top of them), with slow queries and N+1 loops flagged; its outgoing calls through
fetchornode:http; and the lines it logged.
Hono errors#
Hono catches what a handler throws and passes it to an error handler. PeekInside sees each error there, whenever your app sets its handler, and says who answered it:
- An error your
app.onError()handler answers, or a sub-app's own handler, is recorded as handled, unless the handler throws it on. - An error Hono's default handler answers with a 500 is unhandled.
HTTPExceptions with a 4xx status are how your app answers bad requests, and aren't recorded.
Other runtimes and tests#
PeekInside runs on Node.js, so it records Hono apps served by @hono/node-server; Bun, Deno and Cloudflare Workers aren't supported. In your tests, app.request() runs exactly as usual, unrecorded.
In production#
The local dashboard is off when NODE_ENV is production. On your servers, the same line sends to PeekInside Cloud when PEEKINSIDE_API_KEY is set, encrypted end to end. The app's port shows in the dashboard from its first request.
Try it on your app
Install the package, add PeekInside.attach(app), and start your app as usual: it prints the link to its dashboard. Free, no account, and your data stays on your machine. On your servers, the same line reports to PeekInside Cloud once it has an API key.