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: universal
architecturedryclient-serversingle-source-of-truth
Filter once on the backend rather than duplicating filter logic on the client
Pass the selection (e.g. list of fields) to the backend and let it filter, instead of replicating the same conditional filtering in both the client payload builder and the server.
PR: hegnar-journalist-boost · org-mining-2026-06Created: Jun 17, 2026
Bad example
Old codetypescript
| 1 | // client strips fields |
| 2 | const payload = pick(form, selectedFields); |
| 3 | await action(payload); |
| 4 | // server strips them AGAIN with the same rules |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetypescript
| 1 | // client just sends intent; server owns the filtering |
| 2 | await action({ ...form, fieldsToPush: selectedFields }); |
Explanation (EN)
Objašnjenje (HR)