Files
digital-psychology/.ai/file-map.md
T
jackyu66gitandCursor dd94e57277 docs: freeze YuXinGu lexicon, journey, and P1 engineering sources
Establish product language contract, user journey with dual growth engines,
ERD/OpenAPI/Go boundaries, and H5 routes (/profile, /portrait, /relation,
/membership) before P1 implementation.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-02 16:12:10 +08:00

98 lines
2.6 KiB
Markdown

# 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/<domain>/ # 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/lexicon.md` | 产品中文语言契约(最高优先级) |
| `product/user-journey.md` | 转化路径 |
| `product/page-tree.md` | H5 路由冻结 |
| `product/feature-map.md` | 能力树 · 五 Tab 冻结 |
| `product/ENGINEERING-FREEZE.md` | P1 真源索引 |
| `domain/domain-map.md` + `erd.md` | Contexts + 表结构 |
| `architecture/go-services.md` | Go 包边界 |
| `domain.md` | Tech ↔ 用户名 |
### .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`.