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).
backend ruleP1stack specificStack: NestJS / TypeScript
architectureencapsulationmodulesseparation-of-concerns
Do not access another module's repository directly; go through its service
Injecting another module's repository couples modules to each other's data layer; call that module's service instead to preserve encapsulation.
PR: hegnar-shareholders-ws · org-mining-hist-2026-06Created: Jun 18, 2026
Bad example
Old codetypescript
| 1 | constructor( |
| 2 | @InjectRepository(BellsheepInstrument) |
| 3 | private bellsheepInstrumentRepo: Repository<BellsheepInstrument>, |
| 4 | ) {} |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetypescript
| 1 | constructor( |
| 2 | private bellsheepInstrumentService: BellsheepInstrumentService, |
| 3 | ) {} |
Explanation (EN)
Objašnjenje (HR)