refactor: consolidate backend into modular monolith

This commit is contained in:
2026-07-30 15:37:31 +08:00
parent 30fd159041
commit 7a73dcbd12
55 changed files with 20409 additions and 1728 deletions

View File

@@ -1,6 +1,6 @@
<svg xmlns="http://www.w3.org/2000/svg" width="1600" height="1080" viewBox="0 0 1600 1080" role="img" aria-labelledby="title desc">
<title id="title">TIKU Backend 当前技术架构图</title>
<desc id="desc">TIKU Backend 是 ASP.NET Core 模块化单体。API、Worker 和 DbMigrator 共享 Application 契约、Infrastructure 实现以及 PostgreSQL、Redis、RabbitMQ 和外部服务。</desc>
<desc id="desc">TIKU Backend 是 ASP.NET Core 模块化单体。API 承载 HTTP 与后台 Hosted ServiceDbMigrator 负责迁移,运行时依赖 PostgreSQL、Redis 和外部服务。</desc>
<defs>
<marker id="arrow" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="7" markerHeight="7" orient="auto">
<path d="M0 0L10 5L0 10Z" fill="#334155"/>
@@ -148,18 +148,18 @@
<text class="edge-label" x="844" y="418">实现 Application 接口并操作 Domain</text>
<!-- Processes -->
<text class="group-title" x="1318" y="129">独立运行入口</text>
<text class="group-title" x="1318" y="129">单体后台处理与迁移</text>
<rect class="group" x="1310" y="145" width="250" height="570" rx="4"/>
<rect class="node-green" x="1336" y="180" width="198" height="192" rx="6"/>
<circle class="badge" cx="1368" cy="211" r="18"/>
<text class="badge-text" x="1368" y="211">W</text>
<text class="node-title" x="1398" y="207">Tiku.Worker</text>
<text class="badge-text" x="1368" y="211">BG</text>
<text class="node-title" x="1398" y="207">API Hosted Services</text>
<text class="node-text" x="1354" y="242">域名 DNS / TLS 生命周期</text>
<text class="node-text" x="1354" y="269">SaaS 订阅生命周期</text>
<text class="node-text" x="1354" y="296">Feature 用量校准</text>
<text class="node-text" x="1354" y="323">后台任务租约执行</text>
<text class="node-text" x="1354" y="350">RabbitMQ 消费者</text>
<text class="node-text" x="1354" y="350">与 HTTP 共用 API 进程</text>
<rect class="node-amber" x="1336" y="408" width="198" height="144" rx="6"/>
<circle class="badge" cx="1368" cy="439" r="18"/>
@@ -177,7 +177,7 @@
<path class="edge-dash" d="M1336 480H1242"/>
<!-- Data and external systems -->
<text class="group-title" x="48" y="773">数据、消息与外部服务</text>
<text class="group-title" x="48" y="773">数据与外部服务</text>
<rect class="group" x="40" y="790" width="1520" height="212" rx="4"/>
<rect class="node-violet" x="70" y="826" width="270" height="138" rx="6"/>
@@ -185,24 +185,24 @@
<text class="badge-text" x="105" y="859">PG</text>
<text class="node-title" x="139" y="854">PostgreSQL</text>
<text class="node-text" x="92" y="892">EF Core 实体 / Identity / AuthSession</text>
<text class="node-text" x="92" y="917">业务数据 / BackgroundJob / Outbox</text>
<text class="node-text" x="92" y="917">业务数据 / BackgroundJob / Session</text>
<text class="node-tiny" x="92" y="944">Query Filter · 写入拦截 · 数据库 Guard</text>
<rect class="node-violet" x="372" y="826" width="205" height="138" rx="6"/>
<circle class="badge" cx="407" cy="859" r="20"/>
<text class="badge-text" x="407" y="859">R</text>
<text class="node-title" x="441" y="854">Redis</text>
<text class="node-text" x="394" y="892">安全状态与失效广播</text>
<text class="node-text" x="394" y="917">分布式缓存</text>
<text class="node-text" x="394" y="892">安全频控</text>
<text class="node-text" x="394" y="917">Feature / Output Cache</text>
<text class="node-tiny" x="394" y="944">Production 必需</text>
<rect class="node-violet" x="609" y="826" width="225" height="138" rx="6"/>
<circle class="badge" cx="644" cy="859" r="20"/>
<text class="badge-text" x="644" y="859">MQ</text>
<text class="node-title" x="678" y="854">RabbitMQ</text>
<text class="node-text" x="631" y="892">MassTransit + EF Outbox</text>
<text class="node-text" x="631" y="917">安全状态 / 后台任务消息</text>
<text class="node-tiny" x="631" y="944">API 发布 · Worker 消费</text>
<text class="badge-text" x="644" y="859">JOB</text>
<text class="node-title" x="678" y="854">PostgreSQL 任务租约</text>
<text class="node-text" x="631" y="892">即时任务 / RunAfter</text>
<text class="node-text" x="631" y="917">SKIP LOCKED / 重试</text>
<text class="node-tiny" x="631" y="944">API Hosted Service 执行</text>
<rect class="node-blue" x="866" y="826" width="205" height="138" rx="6"/>
<text class="node-title" x="890" y="856">对象存储</text>
@@ -232,5 +232,5 @@
<!-- Project dependency direction -->
<rect class="boundary" x="40" y="1025" width="1520" height="38" rx="4"/>
<text class="boundary-text" x="61" y="1050">项目依赖方向Api → Application + Infrastructure Worker → Application + Infrastructure DbMigrator → Infrastructure Infrastructure → Application + Domain + Contracts Application → Domain</text>
<text class="boundary-text" x="61" y="1050">项目依赖方向Api → Application + Infrastructure DbMigrator → Infrastructure Infrastructure → Application + Domain Application → Domain</text>
</svg>

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB