Node & Express
Use toNodeHandler to bridge a Node request/response pair to the fetch-native
handler.
Express and Connect
Mount the handler with app.use. Breadcrumb reads the original request URL, so
the mount path is preserved:
import express from "express";
import { toNodeHandler } from "@breadcrumb-sh/core/node";
import { bc } from "./breadcrumb";
const app = express();
app.use("/api/breadcrumb", toNodeHandler(bc));
Put your own auth middleware before this line, or use the authorize option.
Middleware here covers the whole mount, including /api/ingest/* and
/api/mcp, which authenticate with their own keys rather than a session — so
either exclude those paths or reach for authorize instead. See
Protecting the API.
Raw node:http
On a bare node:http server, match the path yourself and pass matching requests
to the handler:
import { createServer } from "node:http";
import { toNodeHandler } from "@breadcrumb-sh/core/node";
import { bc } from "./breadcrumb";
const handler = toNodeHandler(bc);
createServer((req, res) => {
if (req.url?.startsWith("/api/breadcrumb")) return handler(req, res);
// …the rest of your app
}).listen(3000);
Viewing the traces
This mounts the API. The dashboard is a React component, so
render it from whatever frontend this server backs, pointed at
api="/api/breadcrumb". If you have no React frontend, query the data directly
with bc.api.
Next steps
- Dashboard: mount the UI.
- Database & migrations: choose an adapter.
- Instrumenting: capture your first trace.