3.8 KiB
3.8 KiB
CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Development Commands
Common Commands
npm run dev- Start development server (runs both frontend and backend concurrently)npm run server- Start backend server onlynpm run build- Build for production (TypeScript compilation + Vite build)npm run lint- Run ESLint on TypeScript filesnpm run test- Run tests with Vitestnpm run preview- Preview production build
Development Workflow
- Use
npm run devfor full-stack development - Backend runs on port 3001, frontend on port 3000
- Frontend proxies API calls to backend via
/apiroutes
Architecture Overview
Full-Stack Structure
This is a GitHub Actions monitoring dashboard with a React frontend and Express backend that communicates with GitHub's API.
Frontend (React + TypeScript + Vite)
- Modern React with TypeScript and Tailwind CSS
- Context providers for theme and settings management
- Component-based architecture with clean separation of concerns
- API communication handled through dedicated service classes
Backend (Express + TypeScript)
- RESTful API server with CORS enabled
- GitHub API integration with token-based authentication
- Live configuration reloading with file watching
- Graceful shutdown handling
Key Components
Frontend Structure:
src/App.tsx- Main app with context providerssrc/components/Dashboard.tsx- Main dashboard componentsrc/contexts/- Theme and settings context providerssrc/services/api.ts- Frontend API client using Axiossrc/types/github.ts- TypeScript interfaces for GitHub API
Backend Structure:
server/index.ts- Express server with API routesserver/config.ts- Configuration management with live reloadingserver/github.ts- GitHub API service integration
Configuration System
- Primary config in
config.json(created fromconfig.example.json) - Live configuration reloading via file watching
- Environment variable fallbacks for deployment
- Validation for required GitHub tokens and repository configs
- Optional cache timeout configuration (defaults to 5 minutes)
API Endpoints
GET /api/health- Health checkGET /api/config- Repository configurationGET /api/workflow-runs- Latest workflow runs from all reposGET /api/repository/:owner/:repo/workflow-runs- Repository-specific runsGET /api/rate-limit- GitHub API rate limit statusGET /api/cache/stats- Cache statisticsDELETE /api/cache- Clear cache
GitHub Integration
- Uses GitHub Personal Access Tokens for authentication
- Requires
repoandactions:readpermissions - Fetches workflow runs from multiple repositories
- Supports both public and private repositories
Rate Limiting and Caching
- Parallel Processing: API requests are made in parallel with intelligent rate limiting
- Smart Caching: Responses are cached with configurable TTL (defaults to 5 minutes)
- Rate Limit Monitoring: Tracks and respects GitHub's rate limits with automatic waiting
- Controlled Concurrency: Maximum 10 concurrent requests with 10 requests/second limit
- Cache Management: Provides API endpoints to view cache statistics and clear cache when needed
Development Notes
Configuration Setup
- Copy
config.example.jsontoconfig.json - Add GitHub Personal Access Token with required permissions
- Configure repositories to monitor
- Server automatically reloads when config changes
TypeScript Configuration
- Strict TypeScript enabled with comprehensive type checking
- Vite bundler with React plugin
- Separate tsconfig for Node.js server code
Testing
- Vitest for unit testing
- Run tests with
npm run test
Build Process
- TypeScript compilation followed by Vite build
- Production build outputs to
dist/ - Server code compiled separately