spark-server/.cursor/rules/module-layers.mdc
zhr ae9a71034d feat: implement Spark IM V3 modular monolith
Add HTTP /v1 MVC, TCP send path, groups with server-side member-avatar collage, object-storage upload, and friends/favorites around the architecture-v3 layout.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-17 19:52:11 +08:00

20 lines
818 B
Plaintext

---
description: Module layering — entity, model, logic. One GORM file per table.
globs: internal/module/**/*.go
alwaysApply: false
---
# Module layers
Each business module under `internal/module/{biz}` is three packages:
| Layer | Path | Owns |
|-------|------|------|
| entity | `{biz}/entity` | Domain structs, message payload types, no I/O |
| model | `{biz}/model` | One Go file per MySQL table (GORM + COMMENT tags), Redis adapters |
| logic | `{biz}/logic` | One file per **function** (profile, login, send, inbox sync). Not one file per table. |
`logic` must not import `model`. Wire implementations in `internal/bootstrap`. Auth has no tables (entity + logic only).
Message `content` is serialized JSON **bytes** in a BLOB. Never persist a raw string. Media is an object-storage key, never file bytes.