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

@remcostoeten/ingestion

v0.1.0

Published

Self-hosted analytics ingestion service for Remco Analytics

Readme

@remcostoeten/ingestion

Self-hosted analytics ingestion for Remco Analytics. Deploy as a separate project — do not install in your Next.js app unless you accept a larger serverless bundle.

Recommended setup (Tier 1)

my-next-app/              analytics-api/  (separate Vercel project)
├── @remcostoeten/analytics   ├── @remcostoeten/ingestion
└── POST → analytics-api...   └── DATABASE_URL + IP_HASH_SECRET

Install

npm install @remcostoeten/ingestion hono drizzle-orm @neondatabase/serverless zod ua-parser-js

Peer dependencies must be installed in the analytics-api project.

Vercel handler

// api/index.ts
export { default } from "@remcostoeten/ingestion/vercel";

Custom server

import { createIngestionApp } from "@remcostoeten/ingestion";

const ingestion = createIngestionApp();
app.route("/", ingestion);

Environment variables

| Variable | Required | Purpose | | --- | --- | --- | | DATABASE_URL | Yes | Neon Postgres connection string | | IP_HASH_SECRET | Yes in production | Min 32 chars, IP hashing salt | | ORIGIN_ALLOWLIST | No | Comma-separated allowed origins (empty = all origins allowed) | | INGEST_SECRET | For server tracking | Bearer token for server-to-server requests | | INTERNAL_IP_HASHES | No | Comma-separated IP hashes flagged as internal traffic |

Request authorization

Ingestion accepts two request sources:

| Source | How it authenticates | | --- | --- | | Browser (<Analytics />, trackEvent) | Origin header checked against ORIGIN_ALLOWLIST | | Server (trackServerEvent, createServerTrack) | Authorization: Bearer <INGEST_SECRET> header |

Set the same INGEST_SECRET value on both the ingestion service and your app server (as INGEST_SECRET, never NEXT_PUBLIC_INGEST_SECRET). The @remcostoeten/analytics/server SDK reads it from env and attaches it automatically.

In production, restrict browser origins:

ORIGIN_ALLOWLIST=https://your-app.vercel.app

Migrations

DATABASE_URL=postgres://... npx drizzle-kit up:pg --config node_modules/@remcostoeten/ingestion/drizzle.config.ts

Or from a checkout of this monorepo:

cd packages/ingestion && bun run db:migrate

Endpoints

| Method | Path | Purpose | | --- | --- | --- | | GET | /health | Health check | | POST | /e | Ingest event (SDK default) | | POST | /e/batch | Batch ingest up to 100 events (offline queue flush) | | POST | /ingest | Ingest event (alias) | | POST | /ingest/batch | Batch ingest (alias) | | GET | /metrics | Request metrics | | GET | /admin/stats | Admin statistics | | POST | /admin/cleanup | Data retention cleanup |

Point the SDK at your deployment base URL:

NEXT_PUBLIC_ANALYTICS_URL=https://analytics-api.yourdomain.com