From 11c6c746347193bb8ad3830c66df8ace9d82b534 Mon Sep 17 00:00:00 2001 From: xiong Date: Wed, 29 Jul 2026 15:42:23 +0800 Subject: [PATCH] =?UTF-8?q?feat(docs):=20=E6=B7=BB=E5=8A=A0=20TIKU=20Backe?= =?UTF-8?q?nd=20=E5=BD=93=E5=89=8D=E6=8A=80=E6=9C=AF=E6=9E=B6=E6=9E=84?= =?UTF-8?q?=E5=9B=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 + docs/assets/tiku-backend-architecture.svg | 236 ++++++++++++++++++++++ 2 files changed, 238 insertions(+) create mode 100644 docs/assets/tiku-backend-architecture.svg diff --git a/README.md b/README.md index f92b6df..0f57511 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,8 @@ 题库 SaaS 的正式后端。项目已收敛到 ASP.NET Core + EF Core + PostgreSQL,本仓库是后续开发的唯一目标后端。架构决策见 [ADR 0001](docs/adr/0001-authoritative-dotnet-backend.md)。 +![TIKU Backend 技术架构图](docs/assets/tiku-backend-architecture.svg) + ## 架构边界 - 旧 NestJS / Supabase 仓库只作为业务行为和接口清单参考,不作为运行时依赖。 diff --git a/docs/assets/tiku-backend-architecture.svg b/docs/assets/tiku-backend-architecture.svg new file mode 100644 index 0000000..797c191 --- /dev/null +++ b/docs/assets/tiku-backend-architecture.svg @@ -0,0 +1,236 @@ + + TIKU Backend 当前技术架构图 + TIKU Backend 是 ASP.NET Core 模块化单体。API、Worker 和 DbMigrator 共享 Application 契约、Infrastructure 实现以及 PostgreSQL、Redis、RabbitMQ 和外部服务。 + + + + + + + + + + + + TIKU Backend 当前技术架构 + ASP.NET Core 模块化单体 · Application 定义契约与上下文 · Infrastructure 提供业务、持久化和 Provider 实现 + + + 访问端 + + + + + P + 平台管理端 + /platform-admin 静态原型 + 平台账号 · SaaS 运营 + + + + T + 租户管理端 + 内容与业务运营 + 租户 Realm · RBAC + + + + H5 + 学员端 + H5 / 小程序 / App + 学习 · 题库 · 商城 + + + + + 外部回调 + 微信 / 支付通知 + 签名校验 · 幂等处理 + + + HTTP 接入与安全管线 + + + + + API + Tiku.Api + ASP.NET Core Controller API + OpenAPI / Scalar · 静态文件 + + + 请求管线(按执行顺序) + 1 日志 / 异常 / Forwarded Headers / HTTPS + 2 Static / Routing / CORS + 3 可信 Host 租户解析 / Browser CSRF + 4 JWT / 认证分区限流 / Rate Limiter + 5 CurrentPrincipal / Authorization / Feature + + + Controller 边界 + 平台 SaaS 管理 · 租户后台 + 题库内容学习 · 商城增长 + 认证运行时 · 支付回调 · 后台任务 + + + + + + HTTPS + + + 模块化单体业务核心 + + + + Tiku.Application:契约与执行上下文 + 用例接口 / Provider 接口 · TenantContext · CurrentUser + 仅引用 Domain;不包含 EF Core 与第三方 SDK + + + Tiku.Domain:领域模型 + Identity · Tenant · Catalog · QuestionBank · Content + Learning · Commerce · Growth · Operations · Platform + + + Tiku.Infrastructure:当前业务实现与适配器 + + + 平台底座 + 身份认证 + 租户 / 域名 + RBAC / Feature + SaaS / 审计 + + + 教育业务 + 分类 / 内容 + 题库 / 视频 + 学习 / 分数线 + 档案 / 资源 + + + 交易增长 + 订单 / 支付 + 积分 / 推荐 + CRM / 佣金 + 平台账务 + + + 调用契约 + + 引用 + + + 实现 Application 接口并操作 Domain + + + 独立运行入口 + + + + + W + Tiku.Worker + 域名 DNS / TLS 生命周期 + SaaS 订阅生命周期 + Feature 用量校准 + 后台任务租约执行 + RabbitMQ 消费者 + + + + DB + Tiku.DbMigrator + EF Core Migrate + Development Seed + 平台管理员安全引导 + + + 共享组合方式 + Application + Infrastructure + + + + + + 数据、消息与外部服务 + + + + + PG + PostgreSQL + EF Core 实体 / Identity / AuthSession + 业务数据 / BackgroundJob / Outbox + Query Filter · 写入拦截 · 数据库 Guard + + + + R + Redis + 安全状态与失效广播 + 分布式缓存 + Production 必需 + + + + MQ + RabbitMQ + MassTransit + EF Outbox + 安全状态 / 后台任务消息 + API 发布 · Worker 消费 + + + 对象存储 + Alibaba Cloud OSS + 预签名上传 / 资源访问 + IObjectStorageService + + + 通信与支付 + 阿里云短信 · 微信 OAuth + 微信支付 · 支付宝 + 租户级配置与加密 Secret + + + 域名基础设施 + DNS 所有权校验 + HTTP 网关开通 + 自定义域名生命周期 + + + + + + + + + + + + 项目依赖方向:Api → Application + Infrastructure | Worker → Application + Infrastructure | DbMigrator → Infrastructure | Infrastructure → Application + Domain + Contracts | Application → Domain +