Package Exports
- traxx
- traxx/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (traxx) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
π traxx
A minimal, production-ready route analytics toolkit for Express.js.
Tracks every request β latency, status codes, request metadata, and errors β and stores it asynchronously in MongoDB using BullMQ + Redis.
Built for SaaS platforms, internal tools, and teams who care about visibility without bloat.
π¦ Features
- β Tracks route method, status code, latency, timestamp
- π Captures request details: body, params, query
- π§΅ Captures error stack + message (if request fails)
- βοΈ Asynchronous writes via BullMQ (Redis)
- π§± MongoDB model access for custom queries
π§ͺ Installation
npm install traxxβοΈ Quick Start
const express = require("express");
const Traxx = require("traxx");
const app = express();
const traxx = new Traxx({
mongoUri: process.env.MONGO_URI,
redisUri: process.env.REDIS_URI,
});
// Enable tracking middleware without any custom fields
app.use(traxx.middleware());
// if needed to add any custom fields for tracking purpose, like the tenantId
app.use((req, res, next) => traxx.middleware({tenantId: req.body.tenantId})(req, res, next))
// Example route
app.get("/shop/:id", (req, res) => {
res.json({ status: true, shop: req.params.id });
});
//Start the server and initialize the traxx
const port = process.env.PORT || 8080;
const server = app.listen(port, async () => {
await traxx.init(); // Connect to Mongo + Redis
console.log(`Listening on port ${port}...`);
});
π What Gets Tracked
| Field | Description |
|---|---|
route |
Full URL path without query string |
method |
GET, POST, etc. |
statusCode |
Final response status |
latency |
ms, calculated via process.hrtime() |
timestamp |
ISO string |
requestBody |
Parsed req.body |
requestParams |
From req.params |
requestQuery |
From req.query |
customFields |
Anything that you pass in the middleware() |
Each request is stored as its own document β no pre-aggregation, full raw logs for full custom analytics.
π§± Access the MongoDB Model
Need to build your own dashboard or metrics?
const Log = traxx.model();//get the model instance
const recent = await Log.find().sort({ timestamp: -1 }).limit(50);π§ Why Traxx?
- Built for modern Express apps
- Tracks everything you need, nothing you donβt
- Async, performant, and ready for production
π¨βπ» Author
Made with π» by boopathi-srb
π License
CC-BY-NC-4.0