Files
digital-psychology/.ai/architecture.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

55 lines
1.4 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Architecture
Go 包边界(冻结):[architecture/go-services.md](architecture/go-services.md)
Domain / ERD[domain/domain-map.md](domain/domain-map.md) · [domain/erd.md](domain/erd.md)
## Allowed call graph
```
UI (user-h5 / mini-program)
→ packages/sdk
→ API Handler
→ Service
→ Repository
→ Database
```
## Forbidden
- Handler → Database (skip Service/Repository)
- UI → Database
- UI direct `fetch` to raw URLs (must use `@yuxingu/sdk` or `src/api` thin wrapper)
- Service importing Handler
- Circular package imports
- Giant `utils` / `common` dump packages
## Monorepo map
| Path | Role |
|---|---|
| `apps/api` | Only backend |
| `apps/user-h5` | Primary client (Vue3+TS) |
| `apps/mini-program` | Scaffold only until tasked |
| `apps/admin-h5` | Deferred |
| `packages/sdk` | Multi-platform HTTP client |
| `packages/types` | Shared TS types |
| `packages/utils` | Pure helpers |
| `packages/ui` | Design tokens |
| Root HTML / `server.py` | Legacy — do not extend |
## Feature flow (mandatory when adding a feature)
```
API route + handler
→ service
→ repository (if persistence)
→ migration (if schema change)
→ SDK / types update
→ UI page or component
→ test for money/scoring/auth paths
→ OpenAPI touch if public API changed
→ self-review
```
Missing migration or skipping service layer = incomplete.