# File Map — Who Owns What ## apps/api ``` apps/api/ cmd/server/ # main only: wire deps, start HTTP internal/ handler/ # HTTP bind/unbind, validate input, call service interfaces service// # business rules, transactions orchestration repository/ # SQL / DB access only model/ # DB structs / domain structs (no HTTP types leakage preferred) middleware/ # auth, request id, recovery helpers config/ # env config pkg/ # small reusable libs (e.g. response envelope) migrations/ # schema versions ``` ### Forbidden placements | Wrong | Right | |---|---| | SQL in `handler/` | `repository/` | | gin.Context in `repository/` | keep HTTP out of repo | | Business unlock rules only in UI | `service/` + persist | | Fat `pkg/utils` | domain package or focused pkg | ## apps/user-h5 ``` src/ pages/ # route screens components/ # reusable UI api/ # thin wrappers → @yuxingu/sdk stores/ # pinia hooks/ # composables router/ layouts/ assets/ ``` No raw `fetch` in `pages/`. ## packages | Package | Owns | |---|---| | `sdk` | HTTP client + adapters | | `types` | Shared TS domain types | | `utils` | Pure helpers | | `ui` | CSS tokens | ## .ai/ Rules, ADR, patterns, examples, playbooks, checklists. Not runtime code. ### .ai/product/ & .ai/domain/ | Path | Owns | |---|---| | `product/feature-map.md` | 愈心谷 L0/L1/L2 + MVP 标记 | | `product/cece-feature-map.md` | 测测竞品合并 Feature Tree | | `domain/domain-map.md` | Bounded contexts / aggregates / ER | | `domain.md` | Ubiquitous terms only | ### .ai/design/ | Path | Owns | |---|---| | `design-system.md` | Tokens, color, type, spacing, motion, voice | | `component-catalog.md` | Allowed reusable UI components | | `platform/*.md` | H5 / mini-program / website / Flutter limits | Runtime CSS tokens: `packages/ui/src/tokens.css` (must stay aligned with design-system). ## apps/docs/ Product / business docs (not engineering rules): | Path | Owns | |---|---| | `README.md` | Reading order | | `analysis/` | Competitor teardowns | | `prd-mvp.md` | MVP scope & acceptance | | `business-model.md` | Revenue layers | | `product-roadmap.md` | Phased vertical slices | | `adr/` | Optional business-facing ADRs | Engineering standards live in `.ai/` only; `apps/docs/standards/*` is deprecated. ## Legacy (do not extend) Root `yuxingu.html`, `pages/`, `css/`, `js/`, `server.py`.