In the world of software development, we've all been there. A new feature requires a user to "follow" another user. The question immediately arises: where does this logic live?
Do you put it in the frontend, making it difficult to trigger from a backend process? Do you bury it in a monolithic backend, where it becomes tangled with a dozen other responsibilities? Do you create a new microservice, adding operational overhead for a single action? This scatter-shot approach leads to duplicated code, inconsistent behavior, and a nightmare of maintenance.
What if we could treat business actions—like "Follow," "Purchase," or "Comment"—as first-class citizens in our codebase? What if we could define them once, in a clear, declarative way, and execute them from anywhere?
This is the core idea behind Business-as-Code, a paradigm that transforms your operations into powerful, executable verbs.
At its heart, the concept is simple. A "Verb" is a declarative, code-based definition of an action that can be performed in your system. Instead of writing imperative code scattered across your application, you define the what and the who of an action, along with its specific side effects.
With a platform like Verbs.do, this becomes incredibly tangible. Let's look at how you would define a Follow action:
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' });
Let's break this down:
By codifying the action this way, the Follow logic is no longer an abstract concept hidden in your services. It's a concrete, version-controlled, and reusable asset.
Decoupling your business logic into Verbs isn't just a clever trick; it fundamentally improves how you build and maintain software.
By defining actions as Verbs, you create a single source of truth. The rules for what happens when a user follows another are no longer scattered across different services or codebases. They are defined once and can be executed, audited, and versioned just like any other piece of software. This guarantees consistency and dramatically reduces bugs caused by out-of-sync logic.
Verbs are powerful building blocks. The effects of one Verb can easily trigger another. Imagine a Purchase Verb. Its effects could trigger:
This composability allows you to construct complex, automated business processes from simple, self-contained actions. You're not just writing code; you're designing an agentic workflow where actions seamlessly connect to form sophisticated operational flows.
Once a Verb is defined, it's executable via a simple API call. This provides a single, unified interface for every core action in your business. Your frontend, backend, mobile app, and even third-party services can all use the same verb.execute() method. This abstraction simplifies client-side code and gives you a powerful layer for API automation.
A 'Verb' is a declarative, code-based definition of an action that can be performed in your system. It specifies the subject (who is acting), the object (what is being acted upon), required properties, and the side effects that occur upon execution.
By codifying actions into Verbs, you centralize your core business logic. Instead of being scattered across different services, rules are defined once and can be executed, audited, and versioned like any other piece of software, ensuring consistency and reliability.
Yes. Verbs are designed to be composable building blocks. The effects of one Verb can trigger another, allowing you to easily construct complex, automated business processes and agentic workflows from simple, reusable actions.
Once defined, a Verb can be executed through a simple API call from anywhere in your stack—frontend, backend, mobile app, or a third-party service. This provides a single, unified interface for all actions in your business.
The practice of separating business logic into reusable actions isn't new, but the tools to do it effectively have been missing. The "Actions as Code" paradigm offers a path away from tangled, monolithic architectures toward clean, manageable, and scalable systems.
By defining your business operations as Verbs, you're not just writing better code—you're creating a clear, executable map of how your business actually runs.
Ready to redefine your business operations? Visit Verbs.do to learn more and start translating your business logic into powerful, executable verbs.