Files
tiku-backend.net/docs/architecture/module-boundaries.md

2.2 KiB
Raw Blame History

模块边界与所有权

后端保持模块化单体、统一 PostgreSQL、独立 API/Worker。目录是团队所有权边界跨模块调用必须经过 Tiku.Application 合同。

依赖方向

Platform Core: Tenancy / Auth / Security
Catalog -> QuestionBanks -> Content / Assets -> Learning
Commerce -> Points / Growth
TenantAdmin / PlatformAdmin -> Application contracts or dedicated read models
Jobs -> queue / processor / operations + module job handlers
  • API Controller 不得引用 Tiku.InfrastructureTikuDbContext
  • 一个模块不得引用另一个模块的 Infrastructure 类型。
  • 跨模块查询使用 Application 查询合同;跨模块写入调用目标模块命令合同。
  • TikuDbContext 仍是统一事务入口,但 DbSet 按模块拆在 Persistence/Modules
  • EF Migration 与模型快照串行合并,由 CODEOWNERS 默认负责人复核。

子模块目录

  • TenantAdminDashboard、Classes、Students、Supervision、StudentEngagement、MembersAndAccess、SiteSettings、DomainsAndEngagement。
  • ContentQuestions、Vocabulary、Handbook、EducationCatalog、Scorelines、Videos、OperationContent、Imports。
  • LearningAnalytics、Answering、QuestionReview、WordLearning、PracticeSessions、Foundation。
  • CommerceOrders、Payments、Coupons、Refunds、Reconciliation、Adjustments、Points。
  • PlatformAdminDashboard、TenantProvisioning、TenantDomains、StaffAndAccess、AuditAndAlerts、Dunning、Operations。

Service 文件超过 500 行应在评审中说明原因,超过 800 行由架构测试阻止新增。现有聚合接口应逐步由子模块接口替代,不允许把新能力继续追加到聚合 Service。

API audience

  • /api/platform/*:平台控制面。
  • /api/tenant/*:租户管理后台。
  • /api/student/*:学生业务。
  • /api/public/*:匿名公开读取。
  • /api/system/*:健康与内部诊断。
  • /api/integrations/*:外部系统回调。

旧的 platform-admin、backoffice、tenant-admin、tenant-content 和 tenant-commerce 路由不再提供兼容入口。后端、OpenAPI 客户端和两个前端必须作为一个发布单元回滚或上线。