Express + TypeScript
Minimal Express + TypeScript integration with ServerDevTools.
See everything that happened during a backend request. Inspect request/response data, execution flow, outgoing HTTP calls, database operations, errors, and timings from one local dashboard.
npm install server-devtools
Mount the middleware in your existing Node.js application and open its dashboard at /_devtools.
Add the developer instrumentation package to your project. Supported OpenTelemetry database instrumentation is included.
Create and start your own initialization file, then preload it before your application starts. Choose any filename and location.
Import that same instance in your application, mount its middleware, and open /_devtools to inspect requests.
Inspect method, route and path parameters, query parameters, request headers and body, and response headers, body, and status.
Follow middleware, handlers, database operations, and outbound calls within a request.
Inspect MongoDB, PostgreSQL, and MySQL (`mysql2`) operations and their timing inside the request trace.
Inspect outbound native Node.js HTTP/HTTPS and fetch/Undici calls, including request and response headers and bodies.
Inspect request-associated errors with available message, type, and stack information.
See duration across the request execution tree and compare operation timings.
ServerDevTools runs inside your Node.js application, instruments backend activity, persists inspection history to SQLite, and serves its dashboard from your existing HTTP server without requiring a separate ServerDevTools web server.
/_devtools
// server-devtools.ts
import ServerDevTools from "server-devtools";
export const devtools = new ServerDevTools({
auth: {
username: process.env.SERVER_DEVTOOLS_USERNAME!,
password: process.env.SERVER_DEVTOOLS_PASSWORD!,
},
encryption: {
key: process.env.SERVER_DEVTOOLS_ENCRYPTION_KEY!,
},
getCurrentUser: (req) => req.user,
});
await devtools.start();
// src/main.ts
import { createServer } from "node:http";
import { devtools } from "../server-devtools";
const server = createServer((req, res) => {
devtools.middleware(req, res, () => {
res.statusCode = 404;
res.end("Not found");
});
});
server.listen(3000);
tsx watch --import ./server-devtools.ts src/main.ts
// server-devtools.ts
import ServerDevTools from "server-devtools";
export const devtools = new ServerDevTools({
auth: {
username: process.env.SERVER_DEVTOOLS_USERNAME!,
password: process.env.SERVER_DEVTOOLS_PASSWORD!,
},
encryption: {
key: process.env.SERVER_DEVTOOLS_ENCRYPTION_KEY!,
},
getCurrentUser: (req) => req.user,
});
await devtools.start();
// src/main.ts
import express from "express";
import { devtools } from "../server-devtools";
const app = express();
app.use((req, res, next) => devtools.middleware(req, res, next));
app.get("/users/:id", async (req, res) => {
res.json({ id: req.params.id, name: "John Doe" });
});
app.listen(3000);
tsx watch --import ./server-devtools.ts src/main.ts
// server-devtools.js
const ServerDevTools = require("server-devtools");
const devtools = new ServerDevTools({
auth: {
username: process.env.SERVER_DEVTOOLS_USERNAME,
password: process.env.SERVER_DEVTOOLS_PASSWORD,
},
encryption: {
key: process.env.SERVER_DEVTOOLS_ENCRYPTION_KEY,
},
getCurrentUser: (req) => req.user,
});
globalThis.__serverDevtools = devtools;
void (async () => {
await devtools.start();
})();
// tsconfig.json
{
"compilerOptions": {
"allowJs": true
}
}
NODE_OPTIONS='--import ./server-devtools.js' nest start --watch
// src/main.ts
import { NestFactory } from "@nestjs/core";
import { AppModule } from "./app.module";
import { ServerDevToolsNestInterceptor } from "server-devtools/nestjs";
import ServerDevTools from "server-devtools";
declare global {
var __serverDevtools: ServerDevTools | undefined;
}
async function bootstrap() {
const devtools = globalThis.__serverDevtools;
if (!devtools) {
throw new Error(
"ServerDevTools was not preloaded. Start Nest with NODE_OPTIONS='--import ./server-devtools.js'.",
);
}
const app = await NestFactory.create(AppModule);
app.use((req, res, next) => devtools.middleware(req, res, next));
app.useGlobalInterceptors(
new ServerDevToolsNestInterceptor(),
);
await app.listen(3000);
}
bootstrap();
Start from a working integration or use it as a reference for your own application.
Minimal Express + TypeScript integration with ServerDevTools.
Minimal NestJS integration with the recommended ServerDevTools preload setup.
When an endpoint fails or slows down, see the HTTP request, full execution path, database queries, external network calls, and errors correlated together.
console.log("here 1")
http://localhost:3000/_devtools
Planned capabilities, not available yet:
Trace Redis operations alongside the rest of a request.
Store ServerDevTools data through user-configured storage instead of only the default local SQLite file.
Free and open source. Embed the inspector in your Node.js application and inspect activity in development, staging, or deployed environments.