# Commanded

Use Commanded to build your own Elixir applications following the [CQRS/ES]( pattern.

Provides support for:

- Command registration and dispatch.
- Hosting and delegation to aggregates.
- Event handling.
- Long running process managers.

Commanded provides a solid technical foundation for you to build on. It allows you to focus on modelling your domain, the most important part of your app, creating a better application at a faster pace.

You can use Commanded with one of the following event stores for persistence:

- [EventStore]( - Elixir library using Postgres for persistence.
- [EventStoreDB]( - a stream database built for Event Sourcing.
- [In-memory event store]( - included for test use only.

Please refer to the [CHANGELOG]( for features, bug fixes, and any upgrade advice included for each release.

Requires Erlang/OTP v21.0 and Elixir v1.9 or later.


### Supporting Commanded

You can help support Commanded by helping to fund its ongoing development, new features, and releases.

- [Become a GitHub sponsor](
- [View sponsors & backers](

#### Sponsors

[![Alembic]( "Alembic")](


- [Changelog](
- [Wiki](
- [What is CQRS/ES?](
- [Frequently asked questions](
- [Getting help](
- [Latest published Hex package]( & [documentation](

MIT License

[![Build Status](]( [![Join the chat at](](


> This README and the following guides follow the `master` branch which may not be the currently published version.
> [Read the documentation for the latest published version of Commanded on Hex](

### Overview

- [Getting started](guides/
- [Choosing an event store](guides/
  - [PostgreSQL-based EventStore](guides/
  - [Greg Young's Event Store](guides/
- [Using Commanded](guides/
  - [Aggregates](guides/
    - [Example aggregate](guides/
    - [`Commanded.Aggregate.Multi`](guides/
    - [Aggregate state snapshots](guides/
  - [Commands](guides/
    - [Command handlers](guides/
    - [Command dispatch and routing](guides/
      - [Define aggregate identity](guides/
      - [Multi-command registration](guides/
      - [Dispatch timeouts](guides/
      - [Dispatch consistency guarantee](guides/
      - [Dispatch returning execution result](guides/
      - [Aggregate lifespan](guides/
      - [Composite command routers](guides/
    - [Middleware](guides/
      - [Example middleware](guides/
    - [Composite command routers](guides/
  - [Events](guides/
    - [Domain events](guides/
    - [Event handlers](guides/
      - [Consistency guarantee](guides/
    - [Upcasting events](guides/
  - [Process managers](guides/
    - [Example process manager](guides/
  - [Supervision](guides/
  - [Serialization](guides/
    - [Default JSON serializer](guides/
    - [Configuring JSON serialization](guides/
    - [Decoding event structs](guides/
    - [Using an alternative serialization format](guides/
    - [Customising serialization](guides/
  - [Read model projections](guides/
- [Deployment](guides/
  - [Single node deployment](guides/
  - [Multi node cluster deployment](guides/
  - [Multi node, but not clustered deployment](guides/
- [Testing with Commanded](guides/
- [Used in production?](#used-in-production)
- [Example application](#example-application)
- [Learn Commanded in 20 minutes](#learn-commanded-in-20-minutes)
- [Choosing an event store provider](guides/
- [Tooling](
- [Contributing](#contributing)
- [Need help?](#need-help)


## Used in production?

Yes, see the [companies using Commanded](

## Example application

[Conduit]( is an open source, example Phoenix 1.3 web application implementing the CQRS/ES pattern in Elixir. It was built to demonstrate the implementation of Commanded in an Elixir application for the [Building Conduit]( book.

## Learn Commanded in 20 minutes

[Watch Bernardo Amorim introduce CQRS and event sourcing]( at Code Beam SF 2018. Including a tutorial on how to implement an Elixir application using these concepts with Commanded.

## Contributing

Pull requests to contribute new or improved features, and extend documentation are most welcome.

Please follow the existing coding conventions, or refer to the [Elixir style guide](

You should include unit tests to cover any changes. Run `mix test` to execute the test suite.

### Contributors

Commanded exists thanks to the following people who have contributed.

<a href=""><img src="" width="890" /></a>

- [Adil Yarulin](
- [Alexandre de Souza](
- [Andrey Akulov](
- [Andrzej Sliwa](
- [Ben Smith](
- [Benjamin Moss](
- [Bernardo Amorim](
- [Brenton Annan](
- [Chris Brodt](
- [Chris Martin](
- [Christophe Juniet](
- [Danilo Silva](
- [Dave Lucia](
- [David Carlin](
- [Damir Vandic](
- [Danni Friedland](
- [Ernesto](
- [Fernando Mendes](
- [Florian Ebeling](
- [Henry Hazan](
- [JC](
- [Joan Zapata](
- [João Thallis](
- [John Wilger](
- [Joseph Lozano](
- [Kian-Meng Ang](
- [Kok J Sam](
- [Leif Gensert](
- [Luís Ferreira](
- [Marcelo Dominguez](
- [Matt Doughty](
- [Matthew Boehlig](
- [Michael Herold](
- [Miguel Palhas](
- [Nigel Thorne](
- [Olafur Arason](
- [Paolo Laurenti](
- [Patrick Detlefsen](
- [Phil Chen](
- [Raphaël Lustin](
- [Štefan Ľupták](
- [Tobiasz Małecki](
- [Willy Wombat](
- [Yordis Prieto](
- [Yuri de Figueiredo](
- [Zven](

## Need help?

Please [open an issue]( if you encounter a problem, or need assistance. You can also seek help in the [Gitter chat room]( for Commanded.

For commercial support, and consultancy, please contact [Ben Smith](