d82255bc5b6905119ac3068d4693883416acf4bb
aplp.frontend.react
Frontend (React) cho APLP — Adaptive Personal Learning Platform (learner application aplp-web).
React 19 + TypeScript + Vite · Client mỏng (thin client) gọi API của backend aplp.backend.web. Frontend không chứa business rules; mọi quyết định domain (mastery, progress, adaptive) đến từ backend.
Stack
| Lĩnh vực | Công nghệ |
|---|---|
| Framework | React 19 |
| Language | TypeScript |
| Build | Vite 8 |
| Routing | React Router 7 |
| HTTP client | Axios (wrapper tại src/api) |
| Server-state | TanStack Query |
| Client-state | Zustand |
| Styling | Tailwind CSS 4 |
| Lint | oxlint |
| Format | Prettier |
| Test | Vitest + Testing Library |
Quick Start
Prerequisite: Node.js 18+ (LTS khuyến nghị).
npm install
cp .env.example .env # chỉnh VITE_API_BASE_URL nếu cần
npm run dev # mở địa chỉ Vite (mặc định http://localhost:5173)
Backend chạy local để API hoạt động (xem docs/SETUP.md).
Scripts
| Lệnh | Mô tả |
|---|---|
npm run dev |
Dev server (Vite) |
npm run build |
Typecheck + production build |
npm run preview |
Preview production build |
npm run lint |
Lint (oxlint) |
npm run format / format:check |
Format bằng Prettier |
npm run typecheck |
Typecheck (tsc) |
npm test / test:watch |
Unit test (Vitest) |
Structure
src/
├── app/ # app entry, router, providers, layout, pages
├── api/ # api client (axios), token storage
├── features/ # feature modules (auth, learner, course, ...)
│ └── auth/ # api, components, hooks, pages, store
├── shared/ # shared components, hooks, config
└── types/ # shared types / DTO contracts
Chi tiết: docs/ARCHITECTURE.md, docs/CONVENTIONS.md.
Auth Flow
- Access token lưu in-memory (
src/api/tokenStorage.ts), không persist vào storage trình duyệt. - Refresh token do backend quản lý (HttpOnly cookie); client không chạm tới.
401→ api client tự gọi/auth/refreshrồi retry request gốc (không loop trên endpoint auth).- Route bảo vệ qua
ProtectedRoute(redirect/loginnếu chưa đăng nhập).
Chi tiết: docs/PHASES.md (Phase 0).
Documents
| Tài liệu | Mô tả |
|---|---|
| docs/PHASES.md | Công việc frontend theo từng phase APLP |
| docs/ARCHITECTURE.md | Kiến trúc: folder structure, data flow, auth |
| docs/CONVENTIONS.md | Coding conventions |
| docs/SETUP.md | Setup / khởi tạo dự án |
Backend: aplp.backend.spring — kế hoạch phase tổng thể: APLP-Project-Phases.md.
Status
Phase 0 (Foundation) — hoàn tất. Xem danh sách completion criteria tại docs/PHASES.md.
Languages
TypeScript
98.7%
HTML
1.2%