How farazkelhini/stack-pulse works
Purpose and entry points
StackPulse measures technology adoption and co-occurrence across a rolling, eligible sample of public JavaScript/TypeScript GitHub repositories. It has two operational surfaces: a Next.js analytics site/API and a scheduled data pipeline. Web entry routes are src/app/page.tsx, src/app/search/page.tsx, and src/app/technology/[slug]/page.tsx; automation starts in .github/workflows/daily-pipeline.yml.
Data model and persistence
PostgreSQL is the system of record for tracked repositories, technology detections, snapshots, trends, and pairings. Prisma centralizes schema, migrations, client lifecycle, and initial technology seeding:
• prisma/schema.prisma
• prisma/migrations/20260618140954_init/migration.sql
• prisma/seed.ts
• src/lib/prisma.ts
The technology dictionary is seeded from repository-owned data (data/technologies.json), establishing the controlled vocabulary used by matching and analytics.
Ingestion: GitHub discovery and detection
The crawler discovers eligible GitHub repositories, reads package metadata, matches dependencies/tools against the technology dictionary, and upserts repository-to-technology links. GitHub GraphQL API access is encapsulated separately from matching and crawl orchestration:
• src/scripts/crawl.ts
• src/lib/github.ts
• src/lib/matcher.ts
A maintenance refresh updates existing repository links so the sample remains a 30-day rolling window:
• scripts/refresh.ts
• src/scripts/crawl.ts
This boundary requires GITHUB_TOKEN; crawl batching, retry, duration, and transaction controls are environment-configured.
Analytics pipeline
Post-ingestion stages precompute read models rather than calculating statistics at request time. Pairings use Jaccard co-occurrence; snapshots preserve daily adoption; trends derive change metrics from snapshot history:
• src/scripts/aggregate.ts
• src/scripts/snapshot.ts
• src/scripts/trends.ts
The scheduled workflow applies migrations, crawls, refreshes, runs these stages, then exports. It is intended to be idempotent/resumable, with ingestion/database failures critical and later analytics allowed to degrade:
• .github/workflows/daily-pipeline.yml
• scripts/full_recompute.ts
Dataset publication
Database-derived public artifacts are generated into committed static JSON, enabling consumption without a running app or database:
• src/scripts/export.ts
• public/datasets/technologies.json
• public/datasets/repositories.json
• public/datasets/pairings.json
Exports are schema-validated before the workflow commits them; README summary content is also pipeline-updatable through src/scripts/update-readme.ts.
Serving layer and UI boundary
Next.js 15 Route Handlers are the single data-access interface for both React Server Component pages and external consumers; pages intentionally do not query Prisma directly. Representative API resources include search, trends, technology detail, categories, and pairings:
• src/app/api/search/route.ts
• src/app/api/technology/[slug]/route.ts
• src/app/api/trending/route.ts
• src/app/api/pairings/top/route.ts
UI pages compose API-backed dashboards and charts:
• src/app/technology/[slug]/page.tsx
• src/components/tech-detail/TechDashboard.tsx
• src/components/TrendChart.tsx
Runtime, deployment, and protections
The runtime is Node.js 20+, TypeScript, Next.js/React, and Tailwind; production targets Vercel with hosted PostgreSQL 16+. GitHub Actions requires database and GitHub credentials. API rate limiting uses Vercel KV/Upstash Redis when configured and no-ops locally:
• .env.example
• src/lib/rate-limit.ts
• src/lib/logger.ts
Main entry points: daily-pipeline.yml Daily pipeline · crawl.ts Crawl orchestration · route.ts Route Handlers · export.ts Dataset export
Components 18
Scheduled pipeline
Daily GitHub Actions workflow refreshes the dataset.
- Daily pipeline · Orchestrates migration, ingestion, analytics, and export.
.github/workflows/daily-pipeline.yml - Crawl orchestration · Discovers eligible repositories and upserts detections.
src/scripts/crawl.ts - Rolling-window refresh · Refreshes existing repository links for the 30-day sample.
scripts/refresh.ts - GitHub GraphQL · Uses GITHUB_TOKEN to fetch repositories and package metadata.
src/lib/github.ts - Technology matcher · Matches package tools and dependencies to the controlled vocabulary.
src/lib/matcher.ts
Data and analytics
PostgreSQL is the authoritative operational store.
- Technology dictionary · Controlled vocabulary for matching and analytics.
data/technologies.json - Prisma data layer · Owns schema, migrations, client lifecycle, and seeding.
prisma/schema.prisma - PostgreSQL · Stores repositories, detections, snapshots, trends, and pairings.
- Pairing aggregation · Precomputes Jaccard technology co-occurrence.
src/scripts/aggregate.ts - Daily snapshots · Preserves daily adoption values.
src/scripts/snapshot.ts - Trend derivation · Derives change metrics from snapshot history.
src/scripts/trends.ts - Dataset export · Validates and generates public database-derived JSON.
src/scripts/export.ts - Published datasets · Committed technology, repository, and pairing datasets.
public/datasets/technologies.json
Serving and UI
Route Handlers isolate pages from Prisma.
- Route Handlers · Single data-access interface for pages and external consumers.
src/app/api/search/route.ts - Analytics pages · Dashboard, search, and technology-detail routes.
src/app/technology/[slug]/page.tsx - Technology dashboard · Composes technology detail and trend visualizations.
src/components/tech-detail/TechDashboard.tsx - API rate limiting · No-ops locally when Redis is not configured.
src/lib/rate-limit.ts - Vercel runtime · Runs the Node.js Next.js application.
Connections 26
- Daily pipeline → Prisma data layer: migrates and seeds
- Daily pipeline → Crawl orchestration: runs
- Daily pipeline → Rolling-window refresh: runs
- Daily pipeline → Pairing aggregation: runs
- Daily pipeline → Daily snapshots: runs
- Daily pipeline → Trend derivation: runs
- Daily pipeline → Dataset export: runs
- Prisma data layer → PostgreSQL: maps and connects
- Technology dictionary → Prisma data layer: seeds technologies
- Crawl orchestration → GitHub GraphQL: fetches metadata
- Crawl orchestration → Technology matcher: detects technologies
- Technology dictionary → Technology matcher: defines vocabulary
- Crawl orchestration → PostgreSQL: upserts repositories and links
- Rolling-window refresh → Crawl orchestration: reuses crawl logic
- Pairing aggregation → PostgreSQL: reads detections; writes pairings
- Daily snapshots → PostgreSQL: writes adoption history
- Trend derivation → PostgreSQL: reads snapshots; writes trends
- Dataset export → PostgreSQL: reads derived data
- Dataset export → Published datasets: writes validated JSON
- Route Handlers → PostgreSQL: queries read models
- Analytics pages → Route Handlers: consumes
- Technology dashboard → Route Handlers: uses API-backed data
- Analytics pages → Technology dashboard: renders
- Route Handlers → API rate limiting: guards requests
- Vercel runtime → Route Handlers: hosts
- Vercel runtime → Analytics pages: hosts