--- 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.