ReqScope is a local API request tracing tool for Node.js and Express.
It helps you inspect:
- request duration
- slow internal steps
- failed flows
- request/response body preview
- request/response headers
- sensitive field masking
- raw trace JSON
- cURL reproduction
- endpoint summaries
When an API request is slow or fails, logs are often not enough.
ReqScope shows what happened inside the request:
POST /login 182ms
findUserByEmail 140ms
createAccessToken 40msSo you can quickly answer:
- Which step was slow?
- Which step failed?
- What request body came in?
- What response went out?
- Can I reproduce this request as cURL?
npm i @abdiev003/reqscopeimport express from "express";
import { reqscope, reqscopeErrorHandler, traceStep } from "@abdiev003/reqscope";
const app = express();
app.use(express.json());
app.use(
reqscope({
enabled: process.env.NODE_ENV !== "production",
slowRequestThreshold: 300,
slowStepThreshold: 100,
endpointPrefix: "/__reqscope",
maxPreviewSize: 5000,
maxTraces: 100,
sensitiveFields: ["password", "token", "secret"],
}),
);
app.post("/login", async (req, res, next) => {
try {
const user = await traceStep("findUserByEmail", async () => {
return db.user.findUnique({
where: {
email: req.body.email,
},
});
});
const token = await traceStep("createAccessToken", async () => {
return createToken(user);
});
res.json({
user,
token,
});
} catch (error) {
next(error);
}
});
app.use(reqscopeErrorHandler());
app.use(
(
error: unknown,
_req: express.Request,
res: express.Response,
_next: express.NextFunction,
) => {
res.status(500).json({
message: error instanceof Error ? error.message : "Unknown error",
});
},
);
app.listen(3000);ReqScope exposes trace data from your app:
GET /__reqscope/traces
GET /__reqscope/clearThe dashboard is currently available from the repository during MVP development.
git clone https://github.com/YOUR_USERNAME/reqscope.git
cd reqscope
npm install
npm run dev:dashboardBy default, the dashboard connects to:
http://localhost:3000You can change it with:
VITE_REQSCOPE_API_URL=http://localhost:4000| Option | Type | Default | Description |
|---|---|---|---|
enabled |
boolean |
NODE_ENV !== "production" |
Enables or disables ReqScope. Disabled by default in production. |
slowRequestThreshold |
number |
300 |
Marks a request as slow when total duration exceeds this value in ms. |
slowStepThreshold |
number |
100 |
Marks a traced step as slow when duration exceeds this value in ms. |
endpointPrefix |
string |
/__reqscope |
Prefix for internal ReqScope endpoints. |
sensitiveFields |
string[] |
common secrets | Fields to redact from previews. |
maxPreviewSize |
number |
5000 |
Maximum serialized preview size. |
maxTraces |
number |
100 |
Maximum number of traces stored in memory. |
ReqScope redacts sensitive keys by default:
password
token
secret
authorization
cookie
set-cookie
api_key
access_token
refresh_tokenExample:
{
"email": "ali@example.com",
"password": "[REDACTED]"
}You can add custom fields:
reqscope({
sensitiveFields: ["email", "phone"],
});Install dependencies:
npm installRun the example API:
npm run dev:exampleRun the dashboard:
npm run dev:dashboardBuild the SDK:
npm run build -w packages/sdkcurl http://localhost:3000/curl http://localhost:3000/slowcurl http://localhost:3000/errorcurl -X POST http://localhost:3000/login \
-H "Content-Type: application/json" \
-H "Authorization: Bearer super-secret-token" \
-d '{"email":"ali@example.com","password":"secret123"}'ReqScope is currently an MVP focused on local development.
Supported:
- Express
- manual step tracing with
traceStep - local in-memory traces
- local dashboard
Not yet supported:
- production storage
- authentication
- team sharing
- NestJS/Fastify/Django integrations
- automatic ORM tracing