This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Tech-quotes is a static API for tech-related quotes, powered by GitHub Pages. The project uses TypeScript and generates static JSON files for quotes and authors that are served via GitHub Pages.
npm testRuns ESLint on TypeScript files and performs type checking with tsc. No separate unit tests exist.
npm run buildRemoves the dist folder and executes the build script using Node.js with tsx loader. This generates all static JSON files, HTML files, and OpenAPI specifications.
- Single source of truth: All quotes are defined in a TypeScript array of
RawQuoteobjects - Each quote contains:
text,authorName,authorDescription, and optionalauthorWikiURL - The file exports TypeScript interfaces:
RawQuote,Quote,Author,AuthorWithQuotes,AuthorDescription
The build script transforms the raw quote data into a static API structure:
- Directory Creation: Creates
dist/,dist/quotes/, anddist/authors/directories - Quote Processing:
- Generates individual JSON files for each quote (
quotes/{id}.json) - Creates
quotes/all.jsonwith all quotes - Creates
quotes/stats.jsonwith metadata
- Generates individual JSON files for each quote (
- Author Processing:
- Aggregates quotes by author
- Generates individual JSON files for each author (
authors/{author-id}.json) - Creates
authors/all.jsonwith all author IDs - Creates
authors/stats.jsonwith metadata
- Additional Files:
- Copies and converts OpenAPI spec from YAML to JSON
- Creates
index.html(redirects to GitHub repo) - Creates
404.html
- Slug Generation: Author IDs are created using
slugifywith lowercase and strict mode - URL Construction: Base URL is configurable via
BASE_URLenvironment variable (defaults to GitHub Pages URL) - Type Safety: Full TypeScript typing throughout with strict mode enabled
To add a new quote:
- Edit
src/quotes.ts - Append a new object to the
quotesarray following theRawQuoteinterface - Ensure
authorDescriptionmatches one of the allowedAuthorDescriptiontypes - Run
npm run test && npm run buildto validate and regenerate the API - Commit changes
- TypeScript: Uses NodeNext module resolution, ESNext target, strict mode enabled
- ESLint: Extends
standard-with-typescriptconfiguration - Node Version: The project uses ES modules (
"type": "module"in package.json) - Module Loader: Uses
--import tsxfor running TypeScript files directly
The build generates a GitHub Pages-compatible static site in dist/:
dist/
├── index.html (redirects to GitHub)
├── 404.html
├── openapi.yml
├── openapi.json
├── quotes/
│ ├── stats.json
│ ├── all.json
│ ├── 0.json
│ ├── 1.json
│ └── ...
└── authors/
├── stats.json
├── all.json
├── {author-slug}.json
└── ...