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: JavaScript/TypeScript
fetchurlsconfigenvironments
Use relative URLs for same-origin API requests
When the API lives on the same origin as the app, fetch with a relative path so it works across environments without configuration.
PR: hegnar-zephr-components · org-mining-hist-2026-06Created: Jun 19, 2026
Bad example
Old codetypescript
| 1 | fetch(`${this.url}/check-nickname?nickname=${nickname}`); |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetypescript
| 1 | fetch(`/check-nickname?nickname=${encodeURIComponent(nickname)}`); |
Explanation (EN)
Objašnjenje (HR)