JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 26
  • Score
    100M100P100Q50958F
  • License CC-BY-NC-4.0

Asynchronous route-level analytics for Express.js. Tracks latency, request data, and errors. MongoDB + BullMQ + Redis.

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

License: CC BY-NC 4.0

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