Giao diện
Request lifecycle
Trang này gom các chuỗi thực thi đầy đủ - từ user action hoặc lệnh vận hành xuống database / realtime - phục vụ debug runtime và đối chiếu với log. Nối tiếp Server architecture và Security model.
1) Read flow - đọc dữ liệu
User mở màn hình list/detail → client gọi API → server đi qua data source → resource → auth/ACL → repository → DB.
Debug tips:
- Sai collection / sai data → kiểm tra header
x-data-sourcevà mapping collection. - Thiếu record → kiểm tra
FilterParser, fixed params (ACL), filter phía client.
2) Write flow - ghi dữ liệu
Ghi qua POST / PUT / PATCH / DELETE. Chuỗi: chuẩn hóa params (pre-action) → ACL → repository → transaction → hooks.
Debug tips:
- 403 sau khi params đúng → kiểm tra ACL snippet, fixed params, role config.
- Validation error → xem pre-action, schema template.
- Side effect không chạy → kiểm tra model hooks (
beforeCreate,afterUpdate).
3) WebSocket - realtime
Client duy trì kết nối WebSocket để nhận trạng thái maintaining, thông báo, hoặc sự kiện refresh.
Debug tips:
- UI "đơ" hoặc không đồng bộ → kiểm tra kênh WS, payload auth, handler
maintaining/refreshphía client.
4) Install flow - cài đặt mới
5) Upgrade flow - nâng cấp
Thứ tự: core migration trước → plugin migration (theo dependency) → ghi version → restart.
6) Enable plugin flow
7) Data plane vs Control plane
| Plane | Khi nào | Ví dụ |
|---|---|---|
| Data plane | Mỗi request user | GET /api/users:list, POST /api/orders:create |
| Control plane | Cài đặt, nâng cấp, bật/tắt plugin | app install, app upgrade, enable plugin trong admin |
Lỗi lúc request → data plane (middleware, action, repository). Lỗi lúc khởi động / cài đặt → control plane (lifecycle, migration).
8) Debug checklist
| Triệu chứng | Hướng xem đầu tiên |
|---|---|
| Sai data source / sai collection | DataSourceManager, header x-data-source, mapping collection ↔ resource |
| 401 Unauthorized | AuthManager, bearer token, authenticator config |
| 403 Forbidden | ACL: role config, snippet, fixed params, availableActions |
| Query sai dữ liệu / thiếu record | FilterParser, OptionsParser, pre-action, filter phía client, fixed params |
| Ghi thất bại | Pre-action validate, ACL write permission, transaction, model hooks |
| UI không phản ánh trạng thái | WebSocket: maintaining, refresh, reconnect |
| Plugin mới không hiệu lực | Lifecycle: beforeLoad → load → install / upgrade → enable |
| Migration fail | Thứ tự: core migration trước plugin; kiểm tra dependency giữa plugins |
| Remote plugin client không load | API pm:listEnabled, network khi tải bundle, getPlugins() / add() |
Đọc tiếp
- Tổng quan hệ thống
- Server architecture
- Client architecture
- Security model - Auth + ACL chi tiết.
- Plugin architecture - lifecycle plugin.
- Core: Luồng dữ liệu & request