Giao diện
Tổng quan Kiến trúc hệ thống
TÓM TẮT
BoxMe Forecast v10 sử dụng kiến trúc 4 lớp: Data Sources → Database (Supabase) → ML Engine (Python/FastAPI) → Frontend (React/Vite). Frontend và Backend đều kết nối trực tiếp vào Supabase.
Sơ đồ kiến trúc tổng thể
Deployment Architecture
| Component | Platform | URL/Endpoint | Chi phí |
|---|---|---|---|
| Frontend SPA | Cloudflare Pages | scoring.boxme.tech | Free |
| ML Backend API | Railway | FastAPI server | ~$5/mo |
| Database | Supabase | Managed PostgreSQL | Free → $25/mo |
| LLM Provider | DeepSeek API | External API | Pay-per-use |
| CI/CD (cron) | GitHub Actions | Weekly training | Free (2000 min/mo) |
Data Access Patterns
THIẾT KẾ QUAN TRỌNG
Frontend đọc trực tiếp từ Supabase (transactions, forecasts) để có real-time data. Python backend ghi ML results vào Supabase và chỉ được invoke on-demand hoặc qua cron.
Tech Stack Chi tiết
Frontend
| Thành phần | Technology | Version |
|---|---|---|
| Framework | React | 19.x |
| Language | TypeScript | 5.8 |
| Build Tool | Vite | 6.x |
| Charts | Recharts | 3.x |
| State Management | TanStack Query | 5.x |
| Routing | React Router DOM | 7.x |
| i18n | i18next + react-i18next | 23.x / 14.x |
| Icons | Lucide React | Latest |
| Excel Export | xlsx (SheetJS) | 0.18 |
| DB Client | @supabase/supabase-js | 2.39 |
Backend
| Thành phần | Technology | Version |
|---|---|---|
| Framework | FastAPI | Latest |
| ML Model | LightGBM | Latest |
| Data Processing | pandas + NumPy | Latest |
| Feature Engineering | scikit-learn | Latest |
| LLM Integration | DeepSeek API | Custom client |
| DB Client | supabase-py | Latest |
| Runtime | Python | 3.11 |
Infrastructure
| Thành phần | Technology |
|---|---|
| Frontend Hosting | Cloudflare Pages |
| Backend Hosting | Railway |
| Database | Supabase (PostgreSQL) |
| CI/CD | GitHub Actions |
| DNS/CDN | Cloudflare |
File Map — Các file quan trọng nhất
| File | Dòng code | Chức năng |
|---|---|---|
forecast_engine/src/core/model.py | ~800 | Two-stage segmented DemandForecastModel |
forecast_engine/src/core/pipeline.py | ~710 | ML pipeline orchestrator |
forecast_engine/src/core/features.py | ~407 | Feature engineering (40+ features) |
forecast_engine/src/core/backtester.py | ~837 | Walk-forward backtesting |
forecast_engine/src/automl/self_improver.py | ~658 | LLM-based self-improvement |
forecast_engine/src/automl/orchestrator.py | ~379 | AutoML state machine |
src/services/modules/forecast/forecastEngine.ts | ~800+ | Frontend forecast engine |
src/services/modules/workforce/workforcePlanningEngine.ts | ~1270 | 5-layer workforce planner |
src/services/modules/config/configRegistry.ts | ~900+ | Centralized config management |
src/App.tsx | 133 | Main routing (33 routes) |
Tài liệu liên quan
- Luồng dữ liệu — Sequence diagrams chi tiết
- Quyết định thiết kế — ADRs và trade-offs
- Cơ sở dữ liệu — Schema chi tiết