RKix Storage Center hiện là ứng dụng TypeScript full-stack nhẹ gồm React frontend, Express backend và lớp lưu trữ JSON mô phỏng.
Browser
│
▼
React + Vite UI (src/)
│ fetch /api/*
▼
Express server (server.ts)
├─ Project API
├─ Storage Tree API
├─ Backup API
├─ Archive API
├─ System stats/logs/notifications API
└─ Gemini AI Assistant API
│
▼
Local JSON runtime store (data_store.json)
src/main.tsx: bootstrap React app.src/App.tsx: shell UI chính, state management phía client và các thao tác gọi API.src/components/DashboardStats.tsx: widget thống kê dashboard.src/types.ts: kiểu dữ liệu dùng chung cho project, storage, backup, notification, audit log và archive.src/index.css: Tailwind CSS v4 theme tokens, font và style nền tảng.
server.tskhởi tạo Express app, đọc.env, mount JSON middleware và phục vụ API.- Khi
NODE_ENVkhông phải production, server dùng Vite middleware để hỗ trợ HMR/dev transform. - Khi production, server phục vụ static asset từ
dist.
- Dữ liệu mặc định nằm trong constants của
server.ts. - Runtime state được ghi vào
data_store.jsonbằngsaveDb(). - Không dùng
data_store.jsonnhư nguồn dữ liệu production dài hạn. Khi nâng cấp thật, nên thay bằng PostgreSQL + object storage tương thích S3/MinIO.
- Frontend gọi endpoint
/api/projectsđể lấy danh sách project. - Người dùng tạo project từ UI.
- Server validate tên project, tạo metadata, đồng bộ node tương ứng trong storage tree.
- Server ghi audit log, notification và lưu lại state.
- Frontend refresh dữ liệu hoặc cập nhật state để hiển thị kết quả.
- Tách API route ra các module riêng khi
server.tstiếp tục tăng kích thước. - Thêm schema validation cho request body (ví dụ Zod) trước khi triển khai production.
- Tách seed data thành file riêng để dễ test và reset dữ liệu.
- Thêm test tự động cho helper xử lý storage tree và API critical path.
- Thay JSON store bằng database có migration khi dữ liệu cần bền vững.