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: architecture
architecturedeployconsistency
Keep one codebase and deploy it to multiple environments
No separate repos or branches for 'local' vs 'cloud'—use config to change behavior per env.
Created: Feb 10, 2026
Bad example
Old codets
| 1 | // deploy.ts |
| 2 | // This pattern often leads to drift between environments. |
| 3 | export const isCloud = true; |
| 4 |
|
| 5 | export function getApiBaseUrl() { |
| 6 | return isCloud ? "https://api.prod.example.com" : "http://localhost:3000"; |
| 7 | } |
Explanation (EN)
Environment branching inside code encourages drift and makes it harder to reason about what runs in production.
Objašnjenje (HR)
Grananje po okruženju unutar koda stvara 'drift' i otežava razumijevanje što stvarno radi u produkciji.
Good example
New codets
| 1 | // deploy.ts |
| 2 | export function getApiBaseUrl() { |
| 3 | const url = process.env.API_BASE_URL; |
| 4 | if (!url) throw new Error("Missing API_BASE_URL"); |
| 5 | return url; |
| 6 | } |
Explanation (EN)
The same build can run anywhere. Only configuration changes between dev/staging/prod.
Objašnjenje (HR)
Isti build može raditi svugdje. Razlike između dev/staging/prod su samo u konfiguraciji.