seyoungcho's profile
SeyoungCho@seyoungcho•Jul 27
6.5K
Post cover image

Ship the policy, not the code

From jayfreestone.com•Jul 27•4m read time

When a business rule must be enforced on both the backend and frontend, duplicating logic leads to inevitable drift. Three strategies are explored: sharing code (risky across separate deployments or different languages), shipping the decision (backend returns computed allowed actions like `allowedActions: ['CANCEL']` so the frontend renders state rather than re-deriving it), and shipping the policy (serializing rules via tools like CASL or JSON Schema so only a stable evaluator is shared, not the volatile business logic). The recommendation is to always share something — preferably as data — rather than letting the same invariant live in two places.

175.1K Impressions6 Comments
seyoungcho's user avatar
SeyoungCho
@seyoungcho
Joined Aug 29. 2024
6.5K

Would you recommend this post?

Copy link
WhatsApp
Facebook
X
New Squad
  • © 2026 Daily Dev Ltd.
  • Guidelines
  • Explore
  • Tags
  • Sources
  • Squads
  • Leaderboard