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 ruleP2universalStack: node
configperformanceenvironmentrequest-handlers
Compute environment-derived config once, not on every request
Resolve values that come from environment/config at startup, not recomputed inside per-request handlers.
PR: hegnar-web · org-mining-hist-2026-06Created: Jun 19, 2026
Bad example
Old codejavascript
| 1 | app.get('/issue', (req, res) => { |
| 2 | const host = process.env.NODE_ENV === 'prod' ? prod : dev; // every request |
| 3 | }); |
Explanation (EN)
Objašnjenje (HR)
Good example
New codejavascript
| 1 | const host = resolveHost(); // once at startup |
| 2 | app.get('/issue', (req, res) => { ... }); |
Explanation (EN)
Objašnjenje (HR)