@alikhan-devs/traceify
v1.0.0
Published
Intelligent request tracing middleware for Express.js with request IDs, performance insights, and structured logging
Maintainers
Readme
📡 Tracify
⚡ What is Tracify?
Tracify is a zero-config request tracing SDK for Express.js.
It helps you instantly understand:
- How long each request takes
- How much time is spent in DB operations
- What happens inside your request lifecycle
- Where bottlenecks are occurring
No setup. No external services. No dashboards to configure.
Just install and use.
🚀 Features
- 📡 Automatic request tracing
- ⏱ Total, DB, and processing time breakdown
- 🧠 Step-by-step request timeline
- 🖥 Built-in
/traceUI dashboard - 💾 Persistent storage (
.tracify/traces.json) - 🔍 Route-level performance insights
- 🧼 Safe logging with fallback protection
- ⚡ Works with any Express app
📦 Installation
npm install @alikhan-devs/tracify🧠 Quick Start
const express = require("express");
const tracify = require("@alikhan-devs/tracify");
const app = express();
app.use(express.json());
// Enable tracing (1 line)
app.use(tracify());
app.get("/users", async (req, res) => {
req.tracer.addStep("fetching users");
const users = await getUsersFromDB();
req.tracer.addStep("users fetched");
res.json(users);
});
app.listen(3000, () => {
console.log("Server running on http://localhost:3000");
console.log("Trace UI: http://localhost:3000/trace");
});🖥 Trace UI
Once enabled, open:
http://localhost:3000/traceYou will see:
- All API requests
- Execution timeline
- DB vs processing breakdown
- Slow request highlighting
- Request-by-request inspection
📊 Example Trace Output
{
"traceId": "7e556d045ed72e58",
"method": "GET",
"path": "/users",
"status": 200,
"totalTime": 18,
"dbTime": 12,
"processingTime": 6,
"steps": [
{ "label": "fetching users" },
{ "label": "users fetched" }
],
"timestamp": "2026-05-02T10:26:02.071Z"
}🧪 Tracer API
Inside routes:
Add step
req.tracer.addStep("validation started");DB timing
req.tracer.startTimer("db");
await User.find();
req.tracer.endTimer("db");⚙️ Configuration
app.use(tracify({
slowThreshold: 500, // ms threshold for slow request detection
}));📁 Persistent Storage
Traces are automatically saved to:
.tracify/traces.jsonThis means:
- Restart server → data still exists
- Debug history persists
- No external DB required
🔒 Security
Tracify is designed to be safe by default:
- No external network calls
- No data leaves your server
- Sensitive logs are automatically sanitized
- Can be disabled in production
🚫 Ignored Routes
Internal UI routes are automatically ignored:
/trace/trace/api.json
🧠 Why Tracify?
Most observability tools require:
- External dashboards
- API keys
- Setup complexity
- Paid plans
Tracify is different:
You install it, and it just works inside your app.
Perfect for:
- Developers
- Startups
- MVPs
- Internal tools
- Learning backend performance
🛣 Roadmap
- [ ] Real-time WebSocket streaming UI
- [ ] Route grouping (
/users/:id) - [ ] Performance percentiles (p50, p95)
- [ ] Distributed tracing support
- [ ] OpenTelemetry export
- [ ] Cloud dashboard (optional SaaS layer)
📄 License
MIT © Ali Khan
⭐ Support
If Tracify helped you:
- Star the repo
- Share it with developers
- Use it in your projects
