| # Frontend - Open LLM Leaderboard π |
|
|
| React interface for exploring and comparing open-source language models. |
|
|
| ## π Architecture |
|
|
| ```mermaid |
| flowchart TD |
| Client(["User Browser"]) --> Components["React Components"] |
| |
| subgraph Frontend |
| Components --> Context["Context Layer<br>β’ LeaderboardContext<br>β’ Global State"] |
| |
| API["API Layer<br>β’ /api/leaderboard/formatted<br>β’ TanStack Query"] --> |Data Feed| Context |
| |
| Context --> Hooks["Hooks Layer<br>β’ Data Processing<br>β’ Filtering<br>β’ Caching"] |
| |
| Hooks --> Features["Features<br>β’ Table Management<br>β’ Search & Filters<br>β’ Display Options"] |
| Features --> Cache["Cache Layer<br>β’ LocalStorage<br>β’ URL State"] |
| end |
| |
| API --> Backend["Backend Server"] |
| |
| style Backend fill:#f96,stroke:#333,stroke-width:2px |
| ``` |
|
|
| ## β¨ Core Features |
|
|
| - π **Search & Filters**: Real-time filtering, regex search, advanced filters |
| - π **Data Visualization**: Interactive table, customizable columns, sorting |
| - π **State Management**: URL sync, client-side caching (5min TTL) |
| - π± **Responsive Design**: Mobile-friendly, dark/light themes |
|
|
| ## π Tech Stack |
|
|
| - React 18 + Material-UI |
| - TanStack Query & Table |
| - React Router v6 |
|
|
| ## π Project Structure |
|
|
| ``` |
| src/ |
| βββ pages/ |
| β βββ LeaderboardPage/ |
| β βββ components/ # UI Components |
| β βββ context/ # Global State |
| β βββ hooks/ # Data Processing |
| βββ components/ # Shared Components |
| βββ utils/ # Helper Functions |
| ``` |
|
|
| ## π Development |
|
|
| ```bash |
| # Install dependencies |
| npm install |
| |
| # Start development server |
| npm start |
| |
| # Production build |
| npm run build |
| ``` |
|
|
| ## π§ Environment Variables |
|
|
| ```env |
| # API Configuration |
| REACT_APP_API_URL=http://localhost:8000 |
| REACT_APP_CACHE_DURATION=300000 # 5 minutes |
| ``` |
|
|
| ## π Data Flow |
|
|
| 1. API fetches leaderboard data from backend |
| 2. Context stores and manages global state |
| 3. Hooks handle data processing and filtering |
| 4. Components render based on processed data |
| 5. Cache maintains user preferences and URL state |
|
|