← knowledge.oriz.in

Package isolation rule — every external service wraps in a typed package

architecture architecturepackagesisolationswap-costrule

Package isolation rule — every external service wraps in a typed package

Concept

Every external service the family uses must sit behind a typed @chirag127/<name> package. Swapping providers is then a package version bump in each consumer, not a per-site rewrite. The rule applies on both sides of the network boundary: client-side wraps (Firebase, contact form) and server-side route folders (Razorpay, reCAPTCHA, Resend) follow the same shape.

How it works

Why this shape

Free tiers change. Razorpay's free webhooks could become metered overnight; Web3Forms could rate-limit a domain. The package boundary is the cheap insurance: every consumer pins a version, the wrapper exposes a stable shape, and the swap is one PR per package, not one PR per site times the number of sites.

It also means the shape of the code doesn't depend on which provider won the bake-off this year. Sites import a typed <ContactForm>, not "Web3Forms". The thing the application code knows about is the abstraction; the provider is a config detail.

Cross-refs