This content originally appeared on DEV Community and was authored by viky
APIs don’t just connect systems.
They connect intent to outcome.
And yet, so many APIs still force us to think backwards — digging through REST resources just to figure out what we’re allowed to do.
It’s time for a shift.
It’s time for PACT — Procedural Actor-Centric Transport.
🤝 What Is PACT?
PACT is an actor-first, action-oriented API design philosophy that structures your API around who’s making the call and what they want to do.
Instead of browsing resources and reverse-engineering permissions like in REST, PACT APIs answer the question:
"I’m a User, Vendor, or Admin — what can I do right now?"
It’s intuitive, explicit, and designed for clarity.
đź§ How It Works
In PACT, API methods are named and organized like this:
User.SignIn()
User.GetProfile()
Vendor.UploadInvoice()
Admin.CreateReport()
It reads like a sentence.
It’s predictable.
It’s testable.
It’s permission-aware by design.
Each role (actor) gets its own command surface — its PACT — and the system enforces what each actor can and cannot do.
🔍 Why Not REST?
Let’s compare:
Question
REST
PACT
Who can call this?
Look at docs or scopes
It’s in the namespace
What action is this?
Verb + resource (maybe)
Explicit procedure
How is access controlled?
Middleware / policies
Baked into the method map
Can I discover my available actions?
Not directly
Yes — it's your PACT surface
🛠️ Built for Real Systems
PACT shines when:
You have clearly defined roles (user, admin, partner, etc.)
You want to separate concerns cleanly
You hate digging through bloated REST docs
You’re building a permission-sensitive product (e.g. admin portals, multi-tenant systems)
✨ Bonus: It Scales Cleanly
PACT supports role hierarchies effortlessly:
anonymous < user < admin
Anonymous can only call Anonymous.SignIn(), Anonymous.Register()
Users can access everything anonymous can, plus User.*
Admins can call Admin.* and everything below
No overloading routes. No schema gymnastics.
You grow your system like a tree, not like a spaghetti bowl.
🗣️ Final Word: Make a PACT with Your Users
Design your APIs the way users think:
"I am someone. I want to do something."
That’s a PACT.
This content originally appeared on DEV Community and was authored by viky

viky | Sciencx (2025-10-18T06:24:56+00:00) 🔥 Introducing PACT: A Better Way to Design APIs That Think Like Users. Retrieved from https://www.scien.cx/2025/10/18/%f0%9f%94%a5-introducing-pact-a-better-way-to-design-apis-that-think-like-users/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.