Your business is a collection of actions. A user signs up. A customer makes a purchase. A team member resolves a ticket. These simple interactions, or "verbs," are the fundamental building blocks of your entire operation. But where does the logic for these actions live?
If you're like most growing companies, the answer is "everywhere."
It's scattered across your frontend for validation, duplicated in your backend for execution, buried in a microservice for notifications, and forked into a serverless function for analytics. This scattered approach is a recipe for chaos. It leads to inconsistencies, bugs, and a system that's incredibly difficult to maintain, audit, and evolve.
What if you could treat your business operations like any other piece of critical infrastructure? What if you could define them as clean, auditable, and executable code? This is the core principle behind Business-as-Code, and it’s the future of building scalable, reliable applications.
Consider a seemingly simple action: a user following another user on your platform. The business rules might look like this:
In a traditional architecture, this logic is fragmented. Your frontend prevents self-follows. Your primary API writes to the database and updates caches. A separate notification service is called. A serverless function listens for database events to update analytics.
When you need to add a new step—say, adding the new follow to a user's activity feed—where do you make the change? Do you have to update multiple services? How do you ensure the entire process succeeds or fails as a single transaction? This fragmentation is the source of technical debt and operational fragility.
Verbs.do introduces a powerful paradigm shift: define your business actions as declarative, executable code. Instead of scattering your logic, you centralize it into a "Verb."
A Verb is a standardized, code-based definition of a specific business action. It clearly specifies the actor (the subject), the entity being acted upon (the object), and the sequence of side effects that must occur upon execution.
Let's translate our "Follow" action into a Verb using the Verbs.do SDK:
import { Verb } from 'verbs.do';
// Define a 'Follow' action in your system
const follow = new Verb({
name: 'Follow',
subject: { type: 'User', description: 'The user who is following.' },
object: { type: 'User', description: 'The user being followed.' },
effects: [
{ type: 'createEdge', from: 'subject', to: 'object', label: 'follows' },
{ type: 'notify', user: 'object.id', message: '`{subject.name}` started following you.' }
]
});
// Now, any part of your system can execute this action
await follow.execute({ subjectId: 'user-123', objectId: 'user-456' });
In this single, declarative object, we've defined the entire business action.
This single piece of code is now your single source of truth for what it means to "Follow" someone in your system.
By adopting a Business-as-Code approach with Verbs, you move from chaos to clarity. This unlocks several powerful advantages.
When your core business logic is defined as code, it's no longer an abstract concept spread across your codebase. It's a concrete asset. You can version it in Git, review changes in pull requests, and maintain a perfect audit trail. Instead of asking "what happens when a user follows someone?", you can simply read the Verb definition. This centralizes your business logic, making it transparent and manageable.
Once defined, a Verb can be executed through a simple API call from anywhere in your stack. Whether the action is triggered by your frontend, a mobile app, an admin dashboard, or a scheduled job, the execution is identical.
await follow.execute({ subjectId: 'user-123', objectId: 'user-456' });
This single line guarantees that the same rules, validations, and effects are applied every single time. You eliminate the risk of different clients implementing the same business action in slightly different ways.
Verbs are designed as composable building blocks. The simple Follow action is powerful on its own, but the true potential is unlocked when you chain them together. The effects of one Verb can trigger the execution of another, allowing you to build complex, automated business processes from simple, reusable components.
Imagine a PublishArticle Verb. Its effects could trigger other Verbs like:
This creates a powerful, event-driven system often referred to as an agentic workflow, where Verbs act as autonomous agents that react to business events and execute the appropriate logic.
Stop chasing business logic through a maze of microservices and frontend components. It's time to elevate your business operations to first-class citizens in your architecture. By defining your actions as code with Verbs.do, you create a system that is more reliable, easier to audit, and infinitely more scalable.
Ready to translate your operations into powerful, executable verbs? Visit Verbs.do to learn more and start defining your first action today.