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

apity

v1.0.12

Published

Simple request logging middleware for Express. Sends logs to Apity Router. Includes server metrics collection (CPU, Memory).

Downloads

1,309

Readme

apity

Simple request logging middleware for Express. Sends logs to Apity Router.

Installation

npm install apity

Quick Start

import express from 'express';
import { apityLogger } from 'apity';

const app = express();

app.use(express.json());
app.use(apityLogger({ appId: 'your-app-uuid' }));

// Your routes...
app.get('/api/users', (req, res) => {
  res.json({ users: [] });
});

app.listen(3000);

Configuration

apityLogger({
  // Required
  appId: string,       // UUID from Apity Router Master DB

  // Optional
  routerUrl?: string,          // Router URL (default: https://router.apity.io)
  ignorePaths?: string[],      // Paths to skip (default: ['/health', '/', '/favicon.ico'])
  sensitiveHeaders?: string[], // Additional headers to mask (default includes: authorization, cookie, x-api-key)
  sensitiveFields?: string[],  // Additional body fields to mask (default includes: password, token, secret)
  silent?: boolean,            // Suppress error logs (default: false)
  debug?: boolean,             // Enable debug logging (default: false)
  enableMetrics?: boolean,     // Enable server metrics collection (CPU, Memory) (default: false)
  metricsInterval?: number     // Metrics collection interval in seconds (default: 30)
});

Server Metrics

Enable automatic collection of server metrics (CPU, Memory):

app.use(apityLogger({
  appId: 'your-app-uuid',
  enableMetrics: true,        // Enable metrics collection
  metricsInterval: 30,        // Collect every 30 seconds
}));

Metrics are automatically sent to the router and stored in the server_metrics table. See Client Metrics Setup for details.

What Gets Logged

Database (metadata)

  • HTTP method, path, status code
  • Duration (ms)
  • User ID & username (if authenticated)
  • Client IP, device type, OS, app version
  • Query & path parameters
  • Request/response sizes
  • Error flag

S3 (full log)

  • Complete request (headers, body)
  • Complete response (headers, body)
  • Truncated if too large (10KB request, 50KB response)

Debug Mode

Enable debug logging to see what's happening:

app.use(apityLogger({
  appId: 'your-app-uuid',
  debug: true
}));

Output:

[apity] 🚀 Logger initialized
[apity]    App ID: your-app-uuid
[apity]    Router URL: https://router.apity.io
[apity]    Ignore paths: /health, /, /favicon.ico
[apity] 📥 Incoming request: GET /api/users
[apity] 📤 Response sent: GET /api/users → 200 (45ms)
[apity] 📤 Sending log to https://router.apity.io/api/v1/logs
[apity]    Method: GET /api/users
[apity]    Status: 200, Duration: 45ms
[apity] ✅ Log sent successfully (120ms)

Features

Non-blocking - Logs are sent asynchronously after response
Auto-masking - Sensitive data (passwords, tokens) automatically hidden
User-Agent parsing - Extracts device type, OS, app version
TypeScript - Full type definitions included
Zero config - Works out of the box with sensible defaults
Debug mode - Verbose logging for troubleshooting

Environment Variables

You can use environment variables for the app ID:

app.use(apityLogger({
  appId: process.env.APITY_APP_ID!
}));
# .env
APITY_APP_ID=your-uuid

License

MIT