# 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. ### Environment docs | Path | Owns | |---|---| | `environment.md` | Local vs CI vs Prod policy | | `development.md` | Host Go / Vite local rules | | `docker.md` | When Docker is / is not used | | `deployment.md` | Prod immutable images / CI | | `commands.md` | Copy-paste commands | Runtime compose for **deps only**: repo-root `docker-compose.dev.yml`. ### .ai/product/ & .ai/domain/ | Path | Owns | |---|---| | `product/lexicon.md` | 产品中文语言契约(最高优先级) | | `product/feature-design.md` | Feature Spec 强制规范 | | `product/feature-spec/` | 单功能详细设计(流程/规则/API/验收) | | `product/user-journey.md` | 转化路径 | | `product/page-tree.md` | H5 路由冻结 | | `product/feature-map.md` | 能力树 · 五 Tab 冻结 | | `product/ENGINEERING-FREEZE.md` | P1 真源索引 | | `playbooks/feature-spec.md` | Spec → 实现步骤 | | `domain/domain-map.md` + `erd.md` | Contexts + 表结构 | | `architecture/go-services.md` | Go 包边界 | | `domain.md` | Tech ↔ 用户名 | ### .ai/design/ | Path | Owns | |---|---| | `reverse-engineering-spec.md` | 竞品/成熟 App 逆向工程规范(STEP 1–18 · Evidence First) | | `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`.