Skip to content

About

Next.js developer tool to search and compare npm packages side by side — downloads, bundle size and GitHub stats. Built with TypeScript, Tailwind CSS, shadcn/ui and TanStack Query.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

DevCompare

CI

DevCompare is a developer tool for comparing npm packages side by side. Search any package to explore its weekly downloads, bundle size, GitHub activity and metadata — or pick two packages and get a full head-to-head breakdown with a verdict to help you decide.

🔗 Live Demo: https://npm-comparator-ten.vercel.app/


Tech Stack

Next.js TypeScript Tailwind CSS shadcn/ui Recharts TanStack Query Zustand Framer Motion Jest


Features

  • 🔍 Package search — real-time npm search with debounced input
  • 📦 Package page — version, description, bundle size, downloads, GitHub stats and metadata, including scoped packages like @types/node
  • ⚖️ Side-by-side comparison — compare two packages with a visual stats table and a weighted verdict (popularity, community, bundle size and maintenance activity)
  • 📈 Download history — weekly downloads over the last 12 months, powered by Recharts
  • 💾 Persistent selection — the packages picked for comparison survive a reload
  • 🔗 Shareable links — dynamic Open Graph images for every package and comparison, plus sitemap and robots.txt
  • 🌗 Light / Dark mode — theme toggle with shadcn + Tailwind
  • 📱 Responsive — mobile-first layout throughout
  • ⚡ Server Components by default — data is fetched and cached on the server; client components only where interaction is required

Data Sources

DevCompare aggregates data from four public APIs — no API key required:

API Usage
registry.npmjs.org Latest version manifest and search (publish date)
api.npmjs.org Daily downloads for the last year (totals and chart)
bundlephobia.com/api Bundle size (minified + gzip)
api.github.com Stars, forks, open issues and last push

Responses are cached for an hour with the Next.js data cache. Optional sources (downloads, bundle size, GitHub) time out after 8s, so a slow API shows up as missing data instead of blocking the page.


Design

  • Component library: shadcn/ui
  • Theme: Soft Pop via tweakcn
  • Design tokens: Tailwind CSS 4 CSS variables used throughout

Project Structure

src/
├── app/                  # routes (App Router)
│   ├── api/search/       # npm search proxy used by the search dialog
│   ├── api/og/           # Open Graph images for packages and comparisons
│   ├── compare/          # /compare?a=<pkg>&b=<pkg>
│   ├── package/[...name] # /package/<name>, catch-all so scoped names work
│   ├── sitemap.ts, robots.ts, opengraph-image.tsx, icon.tsx
│   └── error.tsx, not-found.tsx
├── components/
│   ├── ui/               # shadcn/ui primitives
│   ├── layout/           # header, footer, container, section
│   ├── home/ package/ compare/ search/   # page-specific components
│   ├── global/           # floating compare bar, scroll helpers
│   ├── og/               # Open Graph card layout
│   └── shared/           # error and status states, icons
├── services/
│   ├── api/              # one module per external API
│   └── queries/          # combine the APIs into page data
├── lib/                  # pure helpers: verdict, routes, github urls, formatting
├── features/search/      # search hook and client service
├── store/                # zustand store for the compare selection
├── hooks/ providers/ types/ config/

Getting Started

# Install dependencies
npm install

# (optional) configure environment variables
cp .env.example .env.local

# Run development server
npm run dev

Open http://localhost:3000 in your browser.

Environment variables

Variable Required Description
GITHUB_TOKEN No GitHub token (no scopes needed). Raises the GitHub API limit from 60 to 5000 requests/hour — recommended in production.
NEXT_PUBLIC_SITE_URL No Public URL used for canonical links, Open Graph images and the sitemap. Defaults to the live demo.

Scripts

Command Description
npm run dev Start the development server
npm run build / npm start Production build and server
npm run lint ESLint (lint:fix to auto-fix)
npm run typecheck TypeScript without emitting
npm test Jest test suite (test:watch for watch mode)

Lint, typecheck and tests run on every push and pull request via GitHub Actions.


License

MIT

About

Next.js developer tool to search and compare npm packages side by side — downloads, bundle size and GitHub stats. Built with TypeScript, Tailwind CSS, shadcn/ui and TanStack Query.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages