# Legacy Code Cleanup This document tracks the removal of legacy frontend-only code that has been moved to the backend. ## ✅ Deleted Files ### LLM/AI Direct Calls - ❌ `services/geminiService.ts` - Replaced by `services/aiService.ts` (calls backend) - ❌ `lib/llm/` (entire directory) - No longer needed, backend handles LLM ### Business Logic - ❌ `lib/analytics.ts` - Analytics now come from backend API - ❌ `lib/analytics.test.ts` - Tests for removed analytics functions - ❌ `lib/organizationUtils.ts` - Similar organizations now from backend API - ❌ `lib/organizationUtils.test.ts` - Tests for removed utility ### Static Data - ❌ `data/proposals.ts` - Proposals now come from backend API ## 📝 Files Still Present (Documentation Only) These files are kept for reference but are no longer used in code: - `LLM_ABSTRACTION.md` - Documentation of the LLM abstraction (for backend reference) - `FRONTEND_SIMPLIFICATION.md` - Documentation of the simplification - `BACKEND_MIGRATION_REVIEW.md` - Review document ## 🔄 Migration Summary ### Before (Frontend-Only) - Direct LLM API calls with API keys in frontend - Business logic in frontend (matching, analytics, filtering) - Static data files - Client-side calculations ### After (Backend-Driven) - All AI/LLM calls go through backend API - All business logic on backend - All data from backend API - Frontend is "dumb" - just displays data and calls APIs ## Remaining Frontend Logic The following frontend logic is acceptable to keep: - ✅ UI state management (tabs, modals, form state) - ✅ Client-side filtering for UX (debouncing, instant feedback) - ✅ Client-side sorting for small datasets - ✅ Component composition and rendering - ✅ Routing and navigation - ✅ Theme and localization All business logic, calculations, and data persistence are now handled by the backend.