# `Decree`
[🔗](https://github.com/sparkle-space/decree/blob/v0.1.0/lib/decree.ex#L1)

Use Decree to build your own Elixir applications following the CQRS/ES pattern.

Provides support for:

- Defining applications (`Decree.Application`).
- Command registration and dispatch (`Decree.Commands.Router`).
- Hosting and delegation to aggregates (`Decree.Aggregates.Aggregate`).
- Event handling (`Decree.Event.Handler`).

Events persist in `Decree.Store`, the Postgres event store, which an application reaches
through `Decree.EventStore`.

# `aggregate_state`

```elixir
@spec aggregate_state(
  application :: Decree.Application.t(),
  aggregate_module :: module(),
  aggregate_uuid :: Decree.Aggregates.Aggregate.uuid(),
  timeout :: integer()
) :: Decree.Aggregates.Aggregate.state()
```

Retrieve aggregate state of an aggregate.

Retrieving aggregate state is done by calling to the opened aggregate,
or querying the event store for an optional state snapshot
and then replaying the aggregate's event stream.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
