Skip to content

Load GitHub tools.json file locally#86

Merged
mre merged 3 commits intomainfrom
phase1/data-layer-modernization
Feb 18, 2026
Merged

Load GitHub tools.json file locally#86
mre merged 3 commits intomainfrom
phase1/data-layer-modernization

Conversation

@mre
Copy link
Member

@mre mre commented Feb 18, 2026

Avoid fetching the tools files via the network; they don't change often anyway and it's fine to do a rebuild.

mre added 3 commits February 6, 2026 17:36
This commit introduces build-time static data generation, replacing runtime
GitHub API calls for tools data. Key changes:

## New Build System
- Added scripts/build-data.ts: Fetches and consolidates tools data from
  static-analysis and dynamic-analysis repos at build time
- Added prebuild hook in package.json to run build-data before next build
- Data is stored in data/tools.json, data/tags.json, data/tool-stats.json,
  and data/tag-stats.json (all gitignored as they're generated)

## New Static Data Utilities
- utils/static-data.ts: Core utility for reading pre-built static data
- utils/tools.ts: Simplified tools API using static data
- utils/tools-with-votes.ts: Merges tools with votes data
- utils/firebase-votes.ts: Simplified Firebase votes fetching
- utils/tags.ts: Tags utility using static data
- utils/filters.ts: Filtering utility (moved from utils-api)
- utils/stats.ts: View statistics utility

## Updated Pages
- pages/index.tsx: Uses new static data utilities
- pages/tool/[slug].tsx: Uses new static data utilities
- pages/tag/[slug].tsx: Uses new static data utilities

## Build/Deploy Updates
- Dockerfile: Removed manual tools.json download (now handled by build-data)
- deploy.yml: Updated to hash generated data files for cache busting

## Benefits
- No runtime GitHub API calls for tools data
- Faster page generation (data is pre-fetched)
- Simplified data flow
- Old utils-api code preserved for backwards compatibility

Note: API routes and old utils-api code are preserved for now. The /tools
page still uses API routes which will be addressed in Phase 2 with
InstantSearch integration.
This commit introduces build-time static data generation, replacing runtime
GitHub API calls for tools data. Key changes:

## New Build System
- Added scripts/build-data.ts: Fetches and consolidates tools data from
  static-analysis and dynamic-analysis repos at build time
- Added prebuild hook in package.json to run build-data before next build
- Data is stored in data/tools.json, data/tags.json, data/tool-stats.json,
  and data/tag-stats.json (all gitignored as they're generated)

## New Static Data Utilities
- utils/static-data.ts: Core utility for reading pre-built static data
- utils/tools.ts: Simplified tools API using static data
- utils/tools-with-votes.ts: Merges tools with votes data
- utils/firebase-votes.ts: Simplified Firebase votes fetching
- utils/tags.ts: Tags utility using static data
- utils/filters.ts: Filtering utility (moved from utils-api)
- utils/stats.ts: View statistics utility

## Updated Pages
- pages/index.tsx: Uses new static data utilities
- pages/tool/[slug].tsx: Uses new static data utilities
- pages/tag/[slug].tsx: Uses new static data utilities

## Build/Deploy Updates
- Dockerfile: Removed manual tools.json download (now handled by build-data)
- deploy.yml: Updated to hash generated data files for cache busting

## Benefits
- No runtime GitHub API calls for tools data
- Faster page generation (data is pre-fetched)
- Simplified data flow
- Old utils-api code preserved for backwards compatibility

Note: API routes and old utils-api code are preserved for now. The /tools
page still uses API routes which will be addressed in Phase 2 with
InstantSearch integration.
This commit introduces build-time static data generation, replacing runtime
GitHub API calls for tools data. Key changes:

## New Build System
- Added scripts/build-data.ts: Fetches and consolidates tools data from
  static-analysis and dynamic-analysis repos at build time
- Added prebuild hook in package.json to run build-data before next build
- Data is stored in data/tools.json, data/tags.json, data/tool-stats.json,
  and data/tag-stats.json (all gitignored as they're generated)

## New Repository Classes (lib/repositories/)
- ToolsRepository: Singleton for accessing tools data with caching
- TagsRepository: Singleton for accessing tags and descriptions
- StatsRepository: Singleton for tool/tag view statistics
- VotesRepository: Singleton for Firebase votes fetching
- ToolsFilter: Fluent filter class for querying tools by various criteria

## Updated Pages
- pages/index.tsx: Uses StatsRepository and VotesRepository
- pages/tool/[slug].tsx: Uses ToolsRepository and VotesRepository
- pages/tag/[slug].tsx: Uses TagsRepository, ToolsRepository, and ToolsFilter

## Build/Deploy Updates
- Dockerfile: Removed manual tools.json download (now handled by build-data)
- deploy.yml: Updated to hash generated data files for cache busting
- tsconfig.json: Added @lib/* path alias

## Benefits
- No runtime GitHub API calls for tools data
- Faster page generation (data is pre-fetched)
- Idiomatic TypeScript with proper class-based repositories
- Singleton pattern ensures data is loaded once and cached
- Old utils-api code preserved for backwards compatibility

Note: API routes and old utils-api code are preserved for now. The /tools
page still uses API routes which will be addressed in Phase 2 with
InstantSearch integration.
@mre mre merged commit ab76a33 into main Feb 18, 2026
2 checks passed
@mre mre deleted the phase1/data-layer-modernization branch February 18, 2026 20:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Comments