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 ruleP1project specificStack: node
architectureservice-layerdryapi
Keep a single point of contact with the backend API
Route API calls through one layer (services or API routes), not both, so request/response logic is not duplicated.
PR: hegnar-forum-web · org-mining-hist-2026-06Created: Jun 20, 2026
Bad example
Old codets
| 1 | // component calls /api/create-thread directly AND a service also calls the backend |
| 2 | await fetch('/api/create-thread', { method: 'POST', body }); |
Explanation (EN)
Objašnjenje (HR)
Good example
New codets
| 1 | // one service method is the single entry point |
| 2 | await ForumService.createThread(payload); |
Explanation (EN)
Objašnjenje (HR)