Step 1.

Define rich, type‑safe domain model

Describe commands, events, and state of entities using Protobuf.

// A command to create a new task.
message CreateTask {
    TaskId id = 1;
    string name = 2 [(required) = true];
    string description = 3;
}
...
// A new task has been created.
message TaskCreated {
    TaskId id = 1;
    string name = 2 [(required) = true];
    string description = 3;
}
...
// Task Aggregate state.
message Task {
    TaskId id = 1;
    string name = 2 [(required) = true];
    string description = 3;
    DeveloperId assignee = 4;
}

Step 2.

Generate the code for all tiers and multiple languages

Java, JavaScript, and C++ are currently supported, with more languages to come soon.

Generate code

Step 3.

Code business logic in straight and testable way

Focus on the business logic rather than “plumbing”. A Command will be delivered to only one Aggregate. Projections will get all Events they need. ProcessManagers will cover more complex scenarios. Storage, message delivery, and other environment matters are isolated from the main code.

final class TaskAggregate
    extends Aggregate<TaskId, Task, TaskVBuilder> {
    ...
    @Assign
    TaskCreated handle(CreateTask cmd, CommandContext ctx) {
        return TaskCreated
                .newBuilder()
                .setId(cmd.getId())
                .setName(cmd.getName())
                .setOwner(ctx.getActor())
                .build();
    }
    ...
}
final class TaskProjection
    extends Projection<TaskId, TaskItem, TaskItemVBuilder> {
    ...
    @Subscribe
    void on(TaskCreated e) {
        getBuilder().setId(e.getId())
                    .setName(e.getName())
    }

    @Subscribe
    void on(TaskCompleted e, EventContext ctx) {
        getBuilder().setWhenDone(ctx.getTimestamp());
    }
}

Step 4.

Easily deploy to Google Cloud or a custom environment

In-memory and JDBC-based storage implementations allow to implement and test the core logic quickly. Adopt your application to selected deployment environment(s) with a few lines of code.

Evolve your domain model

Why Spine

Code Generation

The code is automatically generated for all the languages of your project, as you update the model. Forget about missed hashCode() or equals().

Built-in Validation

Constrains defined in a business model are automatically checked for commands, events, and entity states.

Develop faster, with better results

Thanks to CQRS and Event-Driven Architecture, you can arrange clear work separate. More experienced developers work on the core domain and the write-side. The read–side and UI are created by the rest of the team.

Clear API

Concepts known from the DDD books right are right in the code. Aggregate, Projection, ProcessManager, Repository. Ever guessed how to cook a BoundedContext? Guess no more.

Type Safety

Should you need CustomerId or WorkEstimate value, you get it within seconds, for multiple languages. And it all comes with binary storage format, and automatic Json support.

Open for Business Changes

Add and remove fields while keeping binary compatibility with older code; handle new opportunities with oneof, natively provided by Protobuf. Build new Projections on the whole event history of the system.

Promoted Immutability

All the data types are immutable, which makes it easy to cache and share. Mutations are performed only in response to incoming messages via clearly defined cycles.

Choice of Storage and Deployment Platforms

The framework promotes writing storage- and platform-agnostic code. You can start with JDBC and later switch to Google Cloud Platform Datastore by changing few lines of code.

Permissive Apache License

Use freely in closed-source projects. You are welcome to contribute to improving the framework.

Want to learn more?

Get started by learning concepts and exploring example applications.