# ream

[![Package Version](](
[![Hex Docs](](

REAM is an event-sourcing system.

The REAM server is a simple TCP server that's receiving events from aggregators which are
sending the event and a status update. The idea is:

- The Aggregator receives a command.
- The aggregator validates the command and generates:
    1. One or more events are generated by the aggregator and published into REAM.
    2. A modification in the state is performed in the aggregator and stored in REAM.
- Subscribers, mainly projectors receive the event.
- These subscribers perform a change in the schema and publish changes into projections.

Therefore we have three different but related storage:

- Events. It's getting events in different streams. We can create as many streams as we need.
- Aggregations. It's storing the state for the aggregators based on the last processed event for a specific stream.
- Projections. Stored the projections based on the information provided by the projectors.

The main idea is to provide an easy way for implementing aggregators and projectors to process the data we need in the way we need it.

## Quick start

gleam run   # Run the project
gleam test  # Run the tests
gleam shell # Run an Erlang shell

## Installation

If available on Hex this package can be added to your Gleam project:

gleam add ream

and its documentation can be found at <>.

## Architecture and Design

You can check the protocol [here](docs/ and how the storage is going to take place [here](docs/

## License

Apache License Version 2.0, see [LICENSE](LICENSE)

Copyright 2023 Altenwald

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
See the License for the specific language governing permissions and
limitations under the License.