优化结构

This commit is contained in:
Yvan
2026-08-20 21:46:52 +08:00
parent 23bc29ce0f
commit 63dbb4cfbc
78 changed files with 767 additions and 1082 deletions
+10 -1
View File
@@ -13,7 +13,12 @@ internal/conf/ Config proto; generated by `make config`.
internal/server/ HTTP/gRPC server wiring.
internal/service/ Transport adapters; one file per resource.
internal/biz/ Domain models, usecases, repo interfaces, errors.
internal/data/ Repo implementations and storage clients.
internal/data/ Repo implementations, database clients, migrations.
internal/initialize/ First-install and configuration orchestration.
internal/integration/ External I/O adapters: cache, email, payment, storage.
internal/logging/ Application logging infrastructure.
internal/security/ Security mechanisms such as admin JWT handling.
internal/utils/ Stateless, internal-only helper packages.
```
## Layering & dependency rules
@@ -43,6 +48,10 @@ owns the PO; `service` is a pass-through that converts at its boundary.
never `data`. The repo interface declared here is the inversion seam.
- `data` imports `biz` to implement the repo interface. Never `service`,
never DTOs.
- `integration` implements external I/O boundaries and may import `biz` and
provider SDKs. It is not a utility layer.
- `utils` contains stateless helpers only. It must not own clients, watchers,
repositories, runtime configuration, or provider SDK lifecycles.
- `cmd` is the only place that wires all layers via Wire.
A change crossing these arrows the wrong way is a layering bug; fix the