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 ruleP1universalStack: node
api-designpaginationresponse-shape
Return pagination metadata alongside paged results
Once an endpoint accepts limit/offset, include total/count metadata in the response so clients can drive pagination correctly.
PR: hegnar-ws · org-mining-2026-06Created: Jun 17, 2026
Bad example
Old codetypescript
| 1 | res.json(items); // limit/offset accepted but no total returned |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetypescript
| 1 | res.json({ items, total, limit, offset }); |
Explanation (EN)
Objašnjenje (HR)