@mushi-mushi/node
Server-side SDK for Node.js apps — forward unhandled exceptions, attach HTTP error-handler middleware to Express / Fastify / Hono / Koa, and tag every report with the route, request id, and user (when supplied).
Install
pnpm add @mushi-mushi/nodeBootstrap
server/instrumentation.ts
import { initMushi } from '@mushi-mushi/node'
initMushi({
projectId: process.env.MUSHI_PROJECT_ID!,
apiKey: process.env.MUSHI_API_KEY!,
// Optional — pin the region. Defaults to auto-routing.
region: 'us',
// Optional — capture every uncaughtException + unhandledRejection.
captureGlobals: true,
})Import this file once at the top of your server entry point, before any other module that might throw at import time.
Express
import express from 'express'
import { mushiErrorHandler } from '@mushi-mushi/node/express'
const app = express()
// …all your routes…
app.use(mushiErrorHandler()) // mount LAST so it sees every other routeFastify
import Fastify from 'fastify'
import { mushiPlugin } from '@mushi-mushi/node/fastify'
const app = Fastify()
await app.register(mushiPlugin)Hono
import { Hono } from 'hono'
import { mushiHonoMiddleware } from '@mushi-mushi/node/hono'
const app = new Hono()
app.onError(mushiHonoMiddleware())Programmatic submit
import { submitReport } from '@mushi-mushi/node'
await submitReport({
description: 'Refund webhook returned 500',
severity: 'high',
category: 'bug',
metadata: { invoiceId, attempt },
})The Node SDK speaks the same wire protocol as the web SDK and shares classification quotas — server-thrown bugs and user-side bugs land in the same triage queue.
Last updated on