Centralize Props/domain types (or update rule)
Problem¶
.cursor/rules/030-coding-best-practices.mdc mandates that all interfaces/types live under types/. Real-world layout:
- LMS: 8 files under
apps/lms/src/types/plus aschemas/Zod tree; ~39 component files still declareinterface …Propsinline. - CMS: 3 files under
apps/cms/src/types/, with most domain types inapps/cms/src/lib/validations/,apps/cms/src/lib/widgets/types.ts,apps/cms/src/lib/rbac/types.ts, etc. — re-exported viaapps/cms/src/types/index.ts.
The rule is partially followed in spirit (single re-export point) but inconsistent in letter. Either we tighten practice or we update the rule.
Proposal¶
This is a decision ticket with two acceptable outcomes; pick one in-ticket before implementation:
Resolved as Option B — update the rule and app AGENTS.md; no mass Props migration.
Option A — Tighten practice¶
- Move LMS component
Propsinterfaces into per-featuretypes/subtrees (e.g.apps/lms/src/components/admin/types.ts). - Re-export from
apps/lms/src/types/index.tsfor the cross-cutting set. - Keep
schemas/as the source of truth for Zod-inferred types; document inapps/lms/AGENTS.md.
Option B — Update the rule (chosen)¶
- Amend
.cursor/rules/030-coding-best-practices.mdcto acknowledge thattypes/is the re-export aggregator and that source-of-truth types may live next to their owning module (schemas/,lib/validations/,lib/rbac/, etc.). - Add a short policy: component-local
Propsinterfaces are allowed when they have no off-component consumers; sharedPropsmust live in atypes/module.
Either option ends with a single concise paragraph in each app's AGENTS.md describing where to put a new type.
Acceptance criteria¶
- Decision recorded in this ticket's notes log.
- Either: relevant files moved (Option A) or rule + AGENTS.md updated (Option B).
-
npm run checkpasses.
Out of scope¶
- Refactoring the Zod schema tree itself.
- Generating types from migrations.
- Mass migration of inline
*Propsinterfaces.
Notes / decisions log¶
- 2026-05-24: Ticket created from monorepo audit; option to be chosen before work begins.
- 2026-05-25: Option B — flat per-app
types/as shared import surface; schema-owned domain (lib/validations/,schemas/cms/); colocatedFooPropsunless reused; cross-app contracts in workspace packages; Kysely shapes indb/types.ts. Updated.cursor/rules/030-coding-best-practices.mdc,apps/cms/AGENTS.md,apps/lms/AGENTS.md.