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

remco-analytics

v0.0.1

Published

Private, first-party analytics platform with centralized ingestion, SDK, and dashboard. Cookie-free, GDPR-friendly, self-hosted on Neon Postgres.

Readme

Remco Analytics

Private, first-party analytics platform with centralized ingestion, SDK, and dashboard. Cookie-free, GDPR-friendly, self-hosted on Neon Postgres.

License: MIT TypeScript Tests Coverage


🎯 Status

Current Version: v0.1.0
Phase: M1 Complete ✅ → M2 In Progress

Milestones Progress

✅ M0: Bootstrap               100% Complete
✅ M1: Ingestion Service       100% Complete (v0.1.0)
⏳ M2: SDK Package             0% Not Started
⏳ M3: Dashboard               0% Not Started
⏳ M4: Quality & Polish        0% Not Started

Overall Progress: 40% (2/5 milestones)


✨ Features (M1 Complete)

🚀 Ingestion Service (Production Ready)

  • POST /ingest - Accept and validate analytics events
  • GET /health - Service health monitoring
  • GET /metrics - Deduplication statistics
  • Geographic extraction - Vercel + Cloudflare edge headers
  • IP hashing - SHA-256 with daily salt rotation
  • Bot detection - 40+ patterns (search engines, AI scrapers, headless browsers)
  • Event deduplication - Fingerprinting with in-memory cache
  • 105 tests passing - 95% code coverage

📊 Database (Neon Postgres)

  • 18-column events table - Comprehensive data capture
  • 8 strategic indexes - Optimized for analytics queries
  • Type-safe ORM - Drizzle with full TypeScript support
  • Migration system - Version-controlled schema changes

🔒 Privacy & Security

  • No HTTP cookies - Cookie-free tracking
  • No raw IPs stored - SHA-256 hashing with daily salt
  • GDPR compliant - Privacy-first design
  • Bot protection - Multi-method detection
  • Rate limiting - Duplicate prevention

🚀 Quick Start

Prerequisites

  • Bun v1.0+
  • Neon database account
  • Node.js 18+ (for deployment)

Installation

# Clone repository
git clone https://github.com/remcostoeten/analytics.git
cd analytics

# Install dependencies
bun install

# Set up environment
cp .env.example .env
# Add your DATABASE_URL and IP_HASH_SECRET to .env

# Run migrations
cd packages/db
bun run db:generate
bun run db:migrate

# Start development server
cd ../../apps/ingestion
bun run dev

Environment Variables

# Required
DATABASE_URL=postgresql://user:[email protected]/dbname
IP_HASH_SECRET=your-secret-minimum-32-characters-long

# Optional
DEDUPE_ENABLED=true
DEDUPE_TTL_MS=60000
NODE_ENV=production

📦 Project Structure

analytics/
├── apps/
│   ├── dashboard/          # Next.js dashboard (M3 - planned)
│   └── ingestion/          # Hono ingestion service (M1 - complete)
│       ├── src/
│       │   ├── handlers/   # Route handlers
│       │   ├── __tests__/  # Test files
│       │   ├── bot-detection.ts
│       │   ├── dedupe.ts
│       │   ├── geo.ts
│       │   ├── ip-hash.ts
│       │   └── validation.ts
│       └── package.json
├── packages/
│   ├── db/                 # Database schema & client
│   │   ├── src/
│   │   │   ├── schema.ts   # Drizzle schema
│   │   │   ├── client.ts   # DB connection
│   │   │   └── index.ts
│   │   └── migrations/     # Database migrations
│   ├── sdk/                # Analytics SDK (M2 - planned)
│   └── ox/                 # Oxlint & Oxfmt configs
├── docs/                   # Comprehensive documentation
│   ├── 00-spec.md through 14-implementation-roadmap.md
│   ├── M1-COMPLETE.md
│   └── QUICK-REFERENCE.md
├── DONE.md                 # Completed features
├── TODO.md                 # Planned features
├── IMPLEMENTATION-STATUS.md # Milestone tracker
├── SESSION-SUMMARY.md      # Development notes
└── cli.ts                  # Developer CLI tool

🧪 Testing

# Run all tests
bun test

# Run tests with coverage
bun test --coverage

# Run specific package tests
bun test apps/ingestion

# Watch mode
bun test --watch

# Type checking
bun run typecheck

# Linting
bun run lint

# Format check
bun run fmt:check

Current Test Stats:

  • 105 tests passing
  • 0 failures
  • 95% coverage
  • 230 assertions

📚 API Reference (M1)

POST /ingest

Accept analytics events with validation and enrichment.

Request:

{
  "projectId": "example.com",
  "type": "pageview",
  "path": "/home",
  "referrer": "https://google.com",
  "visitorId": "uuid-here",
  "sessionId": "uuid-here",
  "ua": "Mozilla/5.0...",
  "lang": "en-US",
  "meta": { "custom": "data" }
}

Response (Success):

{ "ok": true }

Response (Duplicate):

{ "ok": true, "deduped": true }

GET /health

Health check endpoint for monitoring.

Response:

{ "ok": true }

GET /metrics

Deduplication performance statistics.

Response:

{
  "totalRequests": 1234,
  "duplicatesBlocked": 56,
  "cacheSize": 892,
  "hitRate": 4.54,
  "uptime": 3600000
}

📈 Performance

  • Ingestion latency: < 100ms p95 (typically ~50ms)
  • Throughput: 1000+ req/s per instance
  • Memory usage: < 100MB base
  • Database capacity: 1M+ events/month
  • Bundle size: Minimal (< 1MB for ingestion)

🔍 What's Next: M2 SDK Package

The next milestone is building the SDK package for easy integration.

Planned Features:

  • 📦 @remcostoeten/analytics npm package
  • ⚛️ React Analytics component (auto page tracking)
  • 🎯 track() function for custom events
  • 🆔 Visitor/session ID generation (localStorage/sessionStorage)
  • 🔒 Privacy controls (opt-out, DNT respect)
  • 📘 TypeScript types included
  • 📦 < 5KB gzipped bundle

Estimated Timeline: 2-3 weeks


📖 Documentation

Specifications (14 Documents)

Progress Tracking


🛠️ Tech Stack

Core

  • Runtime: Bun
  • Language: TypeScript (strict mode)
  • Database: Neon Postgres
  • ORM: Drizzle

Ingestion (M1)

  • Framework: Hono
  • Validation: Zod
  • Deployment: Vercel Serverless

SDK (M2 - Planned)

  • Framework: React
  • Build: tsup
  • Bundle: < 5KB gzipped

Dashboard (M3 - Planned)

  • Framework: Next.js 14 App Router
  • Styling: Tailwind CSS
  • Charts: Recharts

🤝 Contributing

This is a private project. Follow AGENTS.md for code conventions.

Git Workflow

# Create feature branch
git checkout develop
git checkout -b feature/M2-description

# Commit with conventional commits
git commit -m "feat(sdk): add Analytics component"

# Push and create PR
git push origin feature/M2-description

Commit Convention

type(scope): subject

Examples:
feat(sdk): add visitor ID generation
fix(ingestion): handle null visitor ID
test(sdk): add tracking tests
docs(readme): update quick start

📊 Stats

  • Code: 3,500+ lines of production code
  • Tests: 2,000+ lines of test code
  • Documentation: 7,000+ lines
  • Development Time: ~4 hours for M1
  • Files Created: 20+ source files
  • Test Coverage: 95%

🎉 Achievements (M1)

✅ Production-ready ingestion service
✅ 105 tests passing with 95% coverage
✅ Zero dependencies on external services
✅ Privacy-first design (no cookies, no raw IPs)
✅ Comprehensive bot detection (40+ patterns)
✅ Smart deduplication (prevents spam)
✅ Geographic data extraction (edge headers)
✅ Complete documentation
✅ Clean, maintainable codebase


📝 License

MIT © Remco Stoeten


🔗 Links

  • Repository: https://github.com/remcostoeten/analytics
  • Issues: https://github.com/remcostoeten/analytics/issues
  • Discussions: https://github.com/remcostoeten/analytics/discussions

🚀 Deployment

Vercel Deployment

  1. Fork or clone this repository
  2. Install Vercel CLI: npm i -g vercel
  3. Set environment variables in Vercel dashboard
  4. Deploy: vercel --prod

Environment Variables (Vercel)

DATABASE_URL=postgresql://...
IP_HASH_SECRET=your-secret-here

⚡ Quick Commands

# Development
bun run dev:ingestion      # Start ingestion server

# Testing
bun test                   # Run all tests
bun test --watch          # Watch mode
bun test --coverage       # With coverage

# Quality
bun run typecheck         # Type checking
bun run lint              # Linting
bun run fmt               # Format code

# Database
bun run db:generate       # Generate migration
bun run db:migrate        # Run migrations
bun run db:studio         # Open Drizzle Studio

# CLI Tool
bun cli.ts                # Interactive developer CLI

Built with ❤️ by Remco Stoeten