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/sveltekit

v0.7.0

Published

LogTide SDK integration for SvelteKit — handle, handleError, handleFetch hooks

Readme


Features

  • handle hook — automatic request spans with trace context
  • handleError hook — capture unexpected errors with request context
  • handleFetch hook — propagate traceparent to server-side fetches
  • Client-side init — global error handler for the browser
  • W3C Trace Context propagation (traceparent)
  • Scope in event.locals — access trace context in load functions
  • Full TypeScript support with strict types

Installation

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

Quick Start

1. Server Hooks

// src/hooks.server.ts
import { logtideHandle, logtideHandleError, logtideHandleFetch } from '@logtide/sveltekit/server';

export const handle = logtideHandle({
  dsn: 'https://[email protected]',
  // Or use apiUrl + apiKey instead of dsn:
  // apiUrl: 'https://your-instance.com',
  // apiKey: 'lp_your_key',
  service: 'my-sveltekit-app',
  environment: 'production',
});

export const handleError = logtideHandleError();

export const handleFetch = logtideHandleFetch();

2. Client Hooks

// src/hooks.client.ts
import { initLogtide } from '@logtide/sveltekit/client';

initLogtide({
  dsn: 'https://[email protected]',
  // Or: apiUrl + apiKey instead of dsn
  service: 'my-sveltekit-app',
});

Server API

logtideHandle(options)

Creates a SvelteKit handle hook that:

  1. Extracts incoming traceparent header (or generates a new trace ID)
  2. Creates a span for the request (e.g. GET /dashboard)
  3. Stores the scope and span ID in event.locals
  4. Finishes the span with ok or error based on response status
  5. Injects traceparent into the response headers
import { logtideHandle } from '@logtide/sveltekit/server';

export const handle = logtideHandle({
  dsn: '...',
  service: 'my-app',
});

Locals available in load functions:

// In +page.server.ts or +layout.server.ts
export function load({ locals }) {
  // locals.__logtideScope  — the Scope object for this request
  // locals.__logtideSpanId — the current span ID
}

logtideHandleError()

Creates a SvelteKit handleError hook that captures unexpected errors with HTTP context and the request scope.

import { logtideHandleError } from '@logtide/sveltekit/server';

export const handleError = logtideHandleError();

logtideHandleFetch()

Creates a SvelteKit handleFetch hook that injects traceparent into server-side fetch requests, enabling distributed tracing across services.

import { logtideHandleFetch } from '@logtide/sveltekit/server';

export const handleFetch = logtideHandleFetch();

Client API

initLogtide(options)

Initialize LogTide on the client side. Installs GlobalErrorIntegration for unhandledrejection events.

import { initLogtide } from '@logtide/sveltekit/client';

initLogtide({
  dsn: '...',
  service: 'my-app',
});

Exports

// Main entry — re-exports server and client
import { logtideHandle, logtideHandleError, logtideHandleFetch, initLogtide } from '@logtide/sveltekit';

// Server-specific
import { logtideHandle, logtideHandleError, logtideHandleFetch } from '@logtide/sveltekit/server';

// Client-specific
import { initLogtide } from '@logtide/sveltekit/client';

License

MIT License - see LICENSE for details.

Links