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

@logtide/hono

v0.5.6

Published

LogTide SDK middleware for Hono — request tracing and error capture

Readme


Features

  • Automatic request spans for every incoming request
  • Error capture with full request context
  • W3C Trace Context propagation (traceparent in/out)
  • Breadcrumbs for HTTP requests
  • Scope access via c.get('logtideScope')
  • Works everywhere — Node.js, Bun, Deno, Cloudflare Workers
  • Full TypeScript support with strict types

Installation

npm install @logtide/hono
# or
pnpm add @logtide/hono
# or
yarn add @logtide/hono

Quick Start

import { Hono } from 'hono';
import { logtide } from '@logtide/hono';

const app = new Hono();

app.use('*', logtide({
  dsn: 'https://[email protected]',
  // Or use apiUrl + apiKey instead of dsn:
  // apiUrl: 'https://your-instance.com',
  // apiKey: 'lp_your_key',
  service: 'my-hono-api',
  environment: 'production',
}));

app.get('/hello', (c) => c.json({ message: 'Hello World' }));

export default app;

How It Works

The middleware runs on every request and:

  1. Extracts incoming traceparent header (or generates a new trace ID)
  2. Creates a span named after the request (e.g. GET /hello)
  3. Stores scope on the Hono context (c.set('logtideScope', scope))
  4. Calls next() to process the request
  5. Finishes the span with ok or error based on response status
  6. Injects traceparent into the response headers
  7. Captures errors thrown by handlers with full context

Accessing the Scope

Use c.get() to access the LogTide scope inside your handlers:

app.get('/users/:id', (c) => {
  const scope = c.get('logtideScope');
  const traceId = c.get('logtideTraceId');

  // Add custom breadcrumbs
  scope.addBreadcrumb({
    type: 'query',
    category: 'database',
    message: 'SELECT * FROM users WHERE id = ?',
    timestamp: Date.now(),
  });

  return c.json({ id: c.req.param('id') });
});

Configuration

All ClientOptions from @logtide/core are supported:

| Option | Type | Default | Description | |--------|------|---------|-------------| | dsn | string | required | DSN string: https://lp_KEY@host/PROJECT | | service | string | required | Service name for log attribution | | environment | string | — | Environment (e.g. production, staging) | | release | string | — | Release / version identifier | | debug | boolean | false | Enable debug logging | | tracesSampleRate | number | 1.0 | Sample rate for traces (0.0 to 1.0) |

See @logtide/core README for the full list of options.


Error Handling

Errors thrown by handlers are automatically captured with:

  • HTTP method and URL
  • Request span marked as error
  • Error serialized with stack trace
app.get('/boom', () => {
  throw new Error('Something broke');
  // Automatically captured by LogTide middleware
});

For 5xx responses (e.g. from Hono's error handler), the middleware also logs an error entry.


Exports

import { logtide } from '@logtide/hono';
import type { LogtideHonoOptions } from '@logtide/hono';

License

MIT License - see LICENSE for details.

Links