Architecture Overview

Stack

LayerTechnology
FrontendNext.js 14 (App Router)
DatabasePostgreSQL (Supabase)
CacheRedis (Upstash)
AuthNextAuth.js + GitHub OAuth
HostingVercel
PaymentsRazorpay
EmailResend

Data Flow

User: npx depgraph check
         │
         ▼
CLI reads package.json / package-lock.json
         │
         ▼
POST /api/scan  ← Auth: API key or session
         │
         ▼
Check Redis cache (24hr TTL per package)
   HIT  → return cached scores
   MISS → fetch signals in parallel:
           GitHub API (commits, contributors, issues)
           npm registry (downloads, metadata)
           OSV.dev (CVE data)
         │
         ▼
Score engine computes health score (0–100)
         │
         ▼
Store in PostgreSQL + Redis
         │
         ▼
Return scored report → CLI (terminal output) or Dashboard (web)

Caching Strategy

DataTTLKey pattern
Package score24hpkg:score:npm:{name}
GitHub signals6hgithub:repo:{owner}:{repo}
npm metadata12hnpm:meta:{name}
OSV data24hosv:npm:{name}
Full scan report1hscan:report:{lockfileHash}

Rate Limits

  • GitHub API: 5,000 req/hr (authenticated) — queue pauses at <100 remaining
  • npm registry: no auth required, generous limits
  • OSV.dev: free, no auth

Deployment

  • Web: Vercel (auto-deploys from main)
  • Cron: Vercel Cron — GET /api/cron/daily-tasks at 08:00 UTC daily
  • Environment: See .env.example for all required variables