This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
jsgrids (https://jsgrids.statico.io/) is a searchable, curated reference site for JavaScript spreadsheet and data grid libraries. It aggregates metadata from GitHub, NPM, Package Phobia, and npms.io to help developers compare ~80 grid libraries across different frameworks (React, Vue, Angular, Svelte, etc.).
# Development server with Turbopack
pnpm dev
# Production build (fetches all API data)
pnpm build
# Start production server
pnpm start- Entry point:
app/page.tsx- Server Component that callsgetLibraries()at build/request time - Data source: 80+ YAML files in
/datadirectory (e.g.,react-data-grid.yml,ag-grid.yml) - Processing pipeline (
lib/libraries.ts):- Parse all YAML files
- Validate with Zod schemas (
ImportedYAMLInfo→AugmentedInfo→ReadonlyLibraryInfo) - Enrich each library with external API data (GitHub stats, NPM downloads, package sizes, quality scores)
- Return type-safe
LibraryInfo[]array to client
The getLibraries() function fetches from 4 external APIs:
- GitHub API - Stars, forks, open issues, contributors (requires
GITHUB_TOKENenv var) - NPM API - Weekly download counts (requires
NPM_TOKENenv var) - Package Phobia API - Publish and install sizes
- npms.io API - Quality score, maintenance score, dependency count
Fetching strategy (lib/fetcher.ts):
- Throttled at 1 request per second (1000ms) for non-npm APIs (GitHub, Package Phobia, npms.io)
- NPM API throttled at 1 request per minute (60s) with dynamic backoff on 429 errors (increases by 60s per 429)
- Retries with exponential backoff (3 retries, 3s min timeout)
- 24-hour filesystem cache in
.next/cache/jsgrids/(survives Vercel builds) - Authentication via GitHub/NPM tokens for increased rate limits
- Graceful degradation: API failures logged but don't break build
-
State management: Zustand store (
lib/store.ts) - minimal, flat store with 6 filterssort: Popularity, GitHub stars, or NPM downloadsframework: Single framework filter (React, Vue, etc.)features: Multi-select feature filter (Set)license: License type filterviewMode: "cards" or "table" view togglesearch: Text search filter
-
Main UI component:
components/IndexPage.tsx(client component)- Receives server-fetched
LibraryInfo[]as props FilterBarcomponent applies filters usinguseMemofor performance- Renders either card grid or table view based on
viewMode
- Receives server-fetched
YAML Schema (validated by Zod):
title: React Data Grid
homeUrl: https://github.com/Comcast/react-data-grid
githubRepo: Comcast/react-data-grid # Format: owner/repo
npmPackage: react-data-grid # NPM package name
license: MIT License
frameworks:
react: true
vue: false
# ... supports 10 frameworks total
features:
editable: true
virtualization: true
typescript: true
# ... 30+ features defined in lib/features.tsRuntime TypeScript Types:
ImportedYAMLInfo- Raw YAML data after parsingAugmentedInfo- After adding computed fieldsReadonlyLibraryInfo/LibraryInfo- Final enriched data with API stats
30+ grid features defined in lib/features.ts with:
- Display title
- Description
- Importance flag (highlights when missing:
maintained,openSource,typescript) - Categories for filtering
Uses shadcn/ui components in components/ui/:
button.tsx,card.tsx,checkbox.tsx,select.tsx,popover.tsx,tooltip.tsx,table.tsx- Built on Radix UI primitives
- Styled with Tailwind CSS using class-variance-authority
Card.tsx- Library card with framework icons, feature badges, and statsFilterBar.tsx- Main filter controls (framework picker, feature selector, sort dropdown)MultiItemPicker.tsx/SingleItemPicker.tsx- Reusable filter componentsTableView.tsx- Minimal table layout for/listpage
- Create
data/library-name.ymlwith required fields (see schema above) - Run
pnpm buildto validate YAML and fetch API data - Library will appear automatically on next page load
- Add feature definition to
lib/features.ts:export const features = { newFeature: { title: "Display Title", description: "Feature description", important: false, // Set true to highlight when missing }, };
- Add feature to YAML schema in
lib/libraries.ts(ImportedYAMLInfo type) - Update existing library YAML files as needed
- Build time: Extended to 300s on Vercel due to ~80 libraries × 4 API calls each
- API rate limits: Use GitHub/NPM tokens in production to increase limits
- Caching: Filesystem cache prevents repeated API calls during development
- Memoization: Card components and filter computations use React.memo/useMemo
- Throttling:
- Non-npm APIs: 1 request per second (1000ms)
- NPM API: 1 request per minute (60s) with dynamic backoff on 429 errors
Required for production builds:
GITHUB_TOKEN=ghp_xxx # Personal access token for GitHub API
NPM_TOKEN=npm_xxx # NPM registry token- Imports: Use
@/path alias (configured in tsconfig.json) - File naming: PascalCase for components, camelCase for utilities
- Styling: Tailwind utilities + shadcn/ui components
- Server/Client boundary: Mark interactive components with "use client"
- Type safety: All YAML validated with Zod, strict TypeScript mode enabled