npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@tracelet/express

v0.0.3

Published

Express middleware for Tracelet

Downloads

359

Readme

@tracelet/express

Express middleware and API docs UI for Tracelet.

Overview

This package wires Tracelet into an Express app: request logging, optional file logging, and the Tracelet docs UI (API Explorer + Logs). It depends on @tracelet/core and @tracelet/ui.

Install

npm install @tracelet/express
# or
yarn add @tracelet/express

Peer dependency: Express ^4 or ^5.

Usage

Call tracelet() with your Express app and options. Call it before your routes so the middleware runs for every request.

import express from "express";
import { tracelet } from "@tracelet/express";
import cors from "cors";

const app = express();
app.use(express.json());
app.use(cors());

tracelet({
  app, // required
  environment: "local", // optional
  logFilePath: "./logs/tracelet.log", // optional
  debug: true, // optional
  traceletDocOptions: {
    uiBasePath: "/docs", // optional
    docFilePath: "./tracelet-doc.json", // optional
  },
});

// Your routes
app.use("/users", userRoutes);
app.listen(3000);

Options

| Option | Default | Description | |--------|---------|-------------| | app | — | Express Application instance. Required. | | environment | undefined | "local" or null. Not passing value means your code is deployed. | | logFilePath | "tracelet.log" | Path to the log file. The Logger writes to this file and the docs UI GET /logs reads from it. | | debug | false | Enable debug logging. | | traceletDocOptions.uiBasePath | "/tracelet-docs" | Base path for the docs UI. Set e.g. "/docs" to serve at /docs. | | traceletDocOptions.docFilePath | "tracelet.doc.json" | Path to a JSON file with route meta for the API Explorer. | | meta | null | TraceletMeta[] for route meta instead of/in addition to a doc file. |

What gets mounted

  • UI – The built @tracelet/ui app is served at uiBasePath (default: /tracelet-docs, or e.g. /docs if you set traceletDocOptions.uiBasePath).
  • Routes metaGET {uiBasePath}?json=true returns route list for the Explorer.
  • AuthPOST {uiBasePath}/auth and GET {uiBasePath}/check-auth when auth is configured.
  • LogsGET {uiBasePath}/logs?limit=50&page=1&type=all&level=all&search=... when logFilePath is set.

The middleware runs on every request to create the request-scoped logger and skips the docs UI path so asset requests are not logged.

Class-based usage

You can also use the class and call start() yourself:

import { TraceletExpress } from "@tracelet/express";

const t = new TraceletExpress({
  app, // required
  logFilePath: "./logs/app.log", // optional
  traceletDocOptions: { uiBasePath: "/docs" }, // optional
  environment: "local", // optional
  debug: false, // optional
});
t.start();

Exports

  • tracelet – Function: tracelet(options) registers middleware and doc routes on options.app. Same as traceletExpress.
  • TraceletExpress – Class: constructor + start() for the same behavior.
  • traceletDoc, createLogsRouter – Used internally; can be used for custom mounting.

License

MIT