Files
digital-psychology/.ai/file-map.md
T
jackyu66gitandCursor 0f320e040b feat: P1 profile/portrait API and freeze local-dev environment
Add host-first environment contracts (Local vs CI vs Prod), deps-only
compose, and the Profile → Portrait → deep-access mock payment slice
with device identity and auto-migrate on API startup.

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

110 lines
3.0 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.
### 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/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`.