Skip to content

amitgoesbrr/pkgx

Repository files navigation

pkgx

Search and explore npm and PyPI packages from a single interface — download trends, version history, GitHub stars, and more.

License: MIT

Features

  • Multi-registry search — npm and PyPI in one place
  • Package analytics — download stats, version history, trend charts
  • GitHub stars — live star counts pulled from the GitHub API
  • Redis caching — in-flight deduplication and graceful degradation when Redis is unavailable
  • Rybbit analytics — optional, privacy-friendly; supports self-hosted instances
  • Dark/light mode — system-aware theme toggle
  • Typesafe — strict TypeScript + Zod validation at all API boundaries
  • Extensible — add new registries with a single adapter file

Tech Stack

Layer Technology
Framework Next.js 16 (App Router, RSC)
Runtime Bun
UI shadcn/ui (Maia style, emerald theme)
Styling Tailwind CSS v4
Charts Recharts
Cache Redis (ioredis)
Analytics Rybbit (optional, self-hosted or cloud)
Validation Zod
Font JetBrains Mono

Getting Started

Prerequisites

  • Bun >= 1.0
  • Docker (for Redis) or any Redis instance

Setup

# Clone
git clone https://github.com/amitgoesbrr/pkgx.git
cd pkgx

# Install dependencies
bun install

# Copy and edit environment variables
cp .env.example .env.local

# Start Redis (skip if you have an external Redis URL)
docker compose up -d

# Start dev server
bun dev

Open http://localhost:3000.

Environment Variables

Copy .env.example to .env.local and fill in the values.

Variable Required Default Description
REDIS_URL Yes redis://localhost:6379 Redis connection URL. Use rediss:// for TLS (e.g. Upstash).
NEXT_PUBLIC_RYBBIT_SITE_ID No Rybbit site ID. Leave empty to disable analytics.
NEXT_PUBLIC_RYBBIT_SCRIPT_URL No https://app.rybbit.io/api/script.js Rybbit script URL. Override for self-hosted instances.
GITHUB_TOKEN No GitHub personal access token. Raises rate limit from 60 to 5 000 req/hr.
PACKAGE_CACHE_TTL No 3600 Cache TTL in seconds for package detail responses.
STATS_CACHE_TTL No 3600 Cache TTL in seconds for download stats responses.
SEARCH_CACHE_TTL No 900 Cache TTL in seconds for search results.

Project Structure

app/              — Pages and API routes
components/       — UI components (shadcn + custom)
lib/              — Core utilities, cache, registry adapters
hooks/            — React hooks
types/            — TypeScript type definitions

Adding a New Registry

  1. Create types in types/<registry>.ts
  2. Implement RegistryAdapter in lib/registries/<registry>.ts
  3. Register in lib/registries/index.ts
  4. Add config entry to lib/constants.ts

License

MIT

About

Search and explore npm & PyPI packages from a single interface — download trends, version history, and GitHub stars.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors