Giao diện
Core
Thư mục packages/core chứa thư viện nền của Digiforce. Phần handbook này ưu tiên tài liệu hóa core trước khi đi sâu từng plugin.
Kiến trúc tổng thể
Thứ tự đọc gợi ý
| # | Tài liệu | Nội dung chính |
|---|---|---|
| 1 | Bản đồ gói | Tên package, vai trò, sơ đồ phụ thuộc |
| 2 | Luồng dữ liệu & request | Pipeline request từ client → repository, merge params |
| 3 | Server - Application | Vòng đời app, init/load/start/stop/install/upgrade, middleware stack |
| 4 | Client - Application | SPA runtime, plugin client, provider chain, WebSocket |
| 5 | Database - Collection & Repository | ORM, filter parser, repository workflow |
| 6 | Resourcer & Actions | Resource, action, middleware chain, handler registration |
| 7 | DataSourceManager | Multi data source, default actions, introspector |
| 8 | Engine ACL | Role, resource, action, snippet, fixed params |
| 9 | Auth & AuthManager | JWT, authenticator, skipCheck, public action |
| 10 | FAQ | Câu hỏi thường gặp khi làm việc với core |
Đọc theo nhu cầu
- Mới bắt đầu: đọc 1 → 2 → 3 → 4 để nắm tổng quan.
- Backend developer: tập trung 3 → 5 → 6 → 7 → 8 → 9.
- Frontend developer: tập trung 4 rồi quay lại 2 để hiểu API.
- Security review: đọc 8 → 9 → 2 (phần policy).
Tham chiếu từng package
Mỗi gói trong packages/core/ có trang tham chiếu API riêng - xem sidebar mục Tham chiếu gói.
Runtime
| Package | Mô tả |
|---|---|
@digiforce-nc/server | Application Koa, lifecycle, middleware, plugin, gateway |
@digiforce-nc/client | Application React SPA, routing, schema, provider chain |
@digiforce-nc/database | ORM Sequelize: Database, Collection, Repository, Migration |
@digiforce-nc/resourcer | ResourceManager, Resource, Action - URL → handler |
@digiforce-nc/data-source-manager | Multi data source, per-source pipeline, introspector |
@digiforce-nc/acl | Authorization engine: role, snippet, fixedParams |
@digiforce-nc/auth | Authentication: AuthManager, JWT, auth types |
@digiforce-nc/actions | Built-in CRUD actions (list, get, create, update, destroy…) |
@digiforce-nc/cache | CacheManager, Cache, BloomFilter, Counter |
@digiforce-nc/logger | Winston logging, request logger, transports |
Support
| Package | Mô tả |
|---|---|
@digiforce-nc/cli | CLI commands: dev, start, install, upgrade, pm |
@digiforce-nc/lock-manager | Distributed lock, pluggable adapters |
@digiforce-nc/telemetry | OpenTelemetry metrics & traces |
@digiforce-nc/sdk | APIClient, Resource, Auth, Storage adapters |
@digiforce-nc/evaluators | Formula/math/string evaluators |
@digiforce-nc/utils | Shared utilities: Toposort, Registry, merge, crypto… |
Tooling
| Package | Mô tả |
|---|---|
@digiforce-nc/build | Build tool (Rollup/RSBuild) cho monorepo |
@digiforce-nc/app | Bootstrap entry point - Gateway startup |
create-digiforce-nc-app | Scaffolding tool tạo project mới |
@digiforce-nc/devtools | Dev utilities: plugin index, RSBuild alias |
@digiforce-nc/test | Test harness: server, client, e2e, vitest |
@digiforce-nc/snowflake-id | 53-bit distributed ID generator |
@digiforce-nc/ui-core | UI core: RunJS, widgets, view scopes |
@digiforce-nc/shared | Shared: getValuesByPath, variable-usage |
@digiforce-nc/ai | AI manager: tools, skills, bots, MCP, documents |
Trọng tâm đọc sâu
| File | Trọng tâm |
|---|---|
03-server-application.md | Lifecycle thật (init/load/start/stop/install/upgrade) + middleware order + plugin manager integration |
04-client-application.md | Constructor flow, plugin/route/websocket lifecycle, providers + API interaction |
05-database-collection-repository.md | Parser filter/options, EagerLoadingTree, repository workflow chi tiết |
06-resourcer-actions-context.md | Parse request, action chain, pre-action middleware theo topo |
07-data-source-manager.md | Binding data source → resource → repository, default action map, introspector |
08-acl-engine.md | Mô hình role/resource/action, snippet, fixed params, phân biệt engine vs plugin-acl |
09-auth-auth-manager.md | Auth strategy, JWT lifecycle, skipCheck, public action, interaction với ACL |