Modern client–server application for CSV data analysis, modeling, and interactive visualizations.
lumina/
├── frontend/ # React/Vite frontend application
├── backend/ # Python FastAPI backend
└── README.md # This file
- Framework: React with Vite
- Language: TypeScript
- UI: Shadcn/ui components with Tailwind CSS
- API Client: Axios for backend communication
- Responsibilities:
- User interface rendering
- UI state management
- API communication with backend
- Framework: FastAPI (Python)
- Database: SQLite with SQLAlchemy ORM
- ML Libraries: Pandas, Scikit-learn, Plotly
- Responsibilities:
- File upload handling
- CSV data analysis
- Machine learning model training
- Data visualization generation
- REST API endpoints
- Node.js 18+ (for frontend)
- Python 3.8+ (for backend)
-
Backend Setup:
cd backend pip install -r requirements.txt python -m app.db.init_db # Initialize database python run.py # Start server
The API will be available at
http://127.0.0.1:8000 -
Frontend Setup:
cd frontend npm install npm run devThe frontend will be available at
http://localhost:5173
Once the backend is running, visit:
- Swagger UI:
http://127.0.0.1:8000/docs - ReDoc:
http://127.0.0.1:8000/redoc
This project was refactored from a frontend-heavy architecture to a modern client-server architecture:
- All business logic in React frontend (
frontend/src/utils/) - Supabase for database and file storage
- Direct database operations from frontend
- Client-side CSV parsing and analysis
- Business logic moved to Python backend (
backend/app/services/) - Local SQLite database with SQLAlchemy ORM
- REST API for frontend-backend communication
- Server-side file processing and analysis
- ✅ Project Restructuring: Created
frontend/andbackend/directories - ✅ Backend Scaffolding: Built FastAPI project with proper structure
- ✅ Business Logic Migration: Ported TypeScript logic to Python services
- ✅ API Endpoints: Created REST API for all operations
- 🔄 Frontend Refactoring: Updated components to use backend API
The frontend components now follow this pattern:
// Before: Direct business logic
import { CSVAnalyzer } from '@/utils/csvAnalysis';
const analyzer = new CSVAnalyzer();
await analyzer.analyzeCSV(fileId);
// After: API calls
import { analysisApi } from '@/api/analysis';
await analysisApi.startAnalysis(fileId);
const results = await analysisApi.getAnalysisResults(fileId);frontend/src/components/FileUpload.tsx✅ (Updated)frontend/src/components/analysis/DataProfileSection.tsx🔄 (Example provided)frontend/src/components/analysis/ModelSection.tsx(Needs refactoring)frontend/src/components/analysis/VisualizationSection.tsx(Needs refactoring)frontend/src/components/AnalysisDashboard.tsx(Needs refactoring)
- Remove Old Dependencies: Delete
frontend/src/utils/andfrontend/src/integrations/supabase/ - Update Components: Refactor remaining components to use API client
- Add Error Handling: Implement proper error handling for API calls
- Add Loading States: Show loading indicators during API operations
- Test Integration: Ensure frontend and backend work together seamlessly
POST /api/files/upload- Upload CSV fileGET /api/files/- List all filesGET /api/files/{file_id}- Get file detailsDELETE /api/files/{file_id}- Delete file
POST /api/analysis/{file_id}/analyze- Start analysisGET /api/analysis/{file_id}/results- Get analysis results
POST /api/models/{file_id}/train- Train modelGET /api/models/{file_id}/recommendations- Get recommendationsGET /api/models/{file_id}/models- List trained models
POST /api/visualizations/{file_id}/generate- Generate visualizationGET /api/visualizations/{file_id}/auto- Generate auto visualizations