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

@~lyre/guest

v0.1.0

Published

Anonymous-visitor tracking for SvelteKit + Drizzle + Postgres. UUID cookie, pluggable GeoIP, merge-on-signup. Lets you attribute pre-signup activity (assessments, chats) to the authenticated user once they create an account.

Readme

@lyre/guest

Anonymous-visitor tracking for SvelteKit + Drizzle + Postgres. Mints a guest_uuid cookie on first visit, writes a guests row with the request context (IP, user-agent, referrer, language), and exposes a mergeGuestIntoUser helper you call from your auth signIn / signUp hooks so the pre-auth history (assessment answers, advisor chats, etc.) is attributed to the user once they create an account.

Install

pnpm add @lyre/guest drizzle-orm

Quick start

// 1. include the schema in your Drizzle client
import { guests } from '@lyre/guest/schema';
// re-export from your schema barrel

// 2. wire the hook into your SvelteKit chain
// src/hooks.server.ts
import { sequence } from '@sveltejs/kit/hooks';
import { createGuestHook } from '@lyre/guest';
import { db } from '$lib/server/db';

const handleGuest = createGuestHook({
  db,
  // Optional: pluggable GeoIP resolver. Leave undefined and geo fields stay null.
  geoIpResolver: async (ip) => {
    // call your maxmind / ipapi / ipinfo client; return null on failure
    return null;
  }
});

export const handle = sequence(handleParaglide, handleGuest, handleAuth);

In your sign-in / sign-up actions, attach the guest history to the new user:

import { mergeGuestIntoUser, readGuestUuid } from '@lyre/guest';

const guestUuid = readGuestUuid({ cookies: event.cookies, headers: event.request.headers });
if (guestUuid && session?.user?.id) {
  await mergeGuestIntoUser(db, { guestUuid, userId: session.user.id });
}

What's in event.locals.guest

After the hook runs, every request has the resolved Guest row available:

event.locals.guest = {
  id, uuid, userId,                                    // identity
  ip, userAgent, referrer, currentUrl, previousUrl,    // request context
  country, countryCode, region, city, postalCode,      // optional geo (if resolver set)
  latitude, longitude, timezone, currencyCode,
  language,
  createdAt, updatedAt
};

Design

  • No dummy user rows. Unlike some patterns, @lyre/guest does NOT create a placeholder User record for every visitor. Identity belongs to your auth system; this package only stores anonymous history.
  • Pluggable GeoIP. The package ships no provider — you choose maxmind, ipapi, ipinfo, etc. Failure is non-blocking; geo fields stay null.
  • Throttled writes. Repeat-visit updates (current_url, previous_url) are throttled to one write per minute per visitor by default; tunable via throttleMs.

License

MIT