Rules Hub
Coding Rules Library
← Back to all rules
Rule priority, scope & exceptions
Use this to align rules with the senior-level structure (P0/P1/P2, scope, exceptions/tradeoffs).
fullstack ruleP1universalStack: typescript
typesdryapidata-modelling
Share one type across the client/server boundary instead of redefining it
Define a payload type once and import it on both sides; duplicated client and server types silently drift apart.
PR: hegnar-web · org-mining-2026-06Created: Jun 17, 2026
Bad example
Old codetypescript
| 1 | // client/interfaces/portfolio.ts |
| 2 | interface Portfolio { value: number; dailyChange: number; } |
| 3 | // server/services/portfolio.ts |
| 4 | interface Portfolio { value: number | null; dailyChange: number | null; } |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetypescript
| 1 | // shared/portfolio.ts |
| 2 | export interface Portfolio { value: number | null; dailyChange: number | null; } |
| 3 | // both client and server import from shared/portfolio |
Explanation (EN)
Objašnjenje (HR)