A demo/example project for the imaginary restaurant and order management. It is demonstrating the usage of fmodel-rust library.
It demonstrates how to run our unique domain and orchestrate it in an EventSourced/EventDriven way.
this blueprint is an outcome of the event-modeling process
This project is using Fmodel - Rust library. Find the documentation at https://docs.rs/fmodel-rust/latest/fmodel_rust/
fmodel-rust is:
- enabling functional and algebraic domain modeling with Rust programming language.
- inspired by DDD, EventSourcing and Functional programming communities, yet implements these ideas and
concepts in idiomatic Rust, which in turn makes our code
- less error-prone,
- easier to understand,
- easier to test,
- type-safe,
- memory-safe and
- thread-safe.
- enabling illustrating requirements using examples
- the requirements are presented as scenarios.
- a scenario is an example of the system’s behavior from the users’ perspective,
- and they are specified using the Given-When-Then structure to create a testable/runnable specification
- Given
< some precondition(s) / events >
- When
< an action/trigger occurs / commands>
- Then
< some post condition / events >
- Given
This project is using PostgreSQL powered event store, optimized for event sourcing and event streaming.
Fstore-SQL is enabling event-sourcing and pool-based event-streaming patterns by using SQL (PostgreSQL) only.
event-sourcing
data pattern (by using PostgreSQL database) to durably store events- Append events to the ordered, append-only log, using
entity id
/decider id
as a key - Load all the events for a single entity/decider, in an ordered sequence, using the
entity id
/decider id
as a key - Support optimistic locking/concurrency
- Append events to the ordered, append-only log, using
event-streaming
to concurrently coordinate read over a streams of events from multiple consumer instances- Support real-time concurrent consumers to project events into view/query models
- EventModeling - a method of describing systems using an example of how information has changed within them over time.
- EventSourcing
- CQRS
docker-compose up -d
cargo run
docker-compose down -v
Migration with the offline mode is enabled by:
- setting
SQLX_OFFLINE
environment variable to true in.env
file. - invoking
cargo sqlx prepare
to save query metadata to.sqlx
in the current directory. - checking this directory into version control
and an active database connection will no longer be needed to build your project.
Run the command below to install the sqlx-cli binary:
cargo install sqlx-cli
Push migration to the database
sqlx migrate run
to revert the latest migration:
sqlx migrate revert
Set SQLX_OFFLINE
environment variable to false in .env
file to disable offline mode.
Now your queries will be checked against the database at compile time!
Check the test.http!
Created with ❤️ by Fraktalio
Excited to launch your next IT project with us? Let's get started! Reach out to our team at [email protected]
to
begin the journey to success.