Thalo is an event-sourcing framework for building large scale systems

Overview

Thalo logo

Thalo

Event sourcing framework for building microservices.

Crates.io Docs.io License Pull Requests Welcome Stargazers Last Commit Discord

Overview

Thalo is an event-sourcing framework for building large scale systems based on the following patterns:

It's designed to be modular with additional crates implementing most functionality.

Official Crates

Core

  • thalo - Core framework.
  • thalo-testing - Test utils for thalo apps.
  • thalo-macros - Macros for implementing traits. This can be enabled in the core crate with the macros feature flag.

Event stores

Event streams

What is Event Sourcing & CQRS

Event sourcing is a way of storing data as an immutable sequence of events. Events are facts that occured in your system and cannot be undone.

Put simply, event sourcing is: f(state, event) -> state

Rather than the traditional state-oriented approach, your data consists of small events which occur in your system, and your models can be built by replaying these events one by one to compute read models.

A common example of event sourcing is accounting. Your bank balance is the sum of all your transactions (aka events). Another example you're likely familiar with that uses event sourcing is Git scm.

What are the benefits?

  • Scalability

    Event sourced systems can operate in a very loosely coupled parallel style which provides excellent horizontal scalability and resilience to systems failure.

  • Time Travel

    By storing immutable events, you have the ability to determine application state at any point in time.

  • 100% Accurate Audit Logging

    With event sourcing, each state change corresponds to one or more events, providing 100% accurate audit logging.

  • Expressive Models

    Events are first class objects in your system and show intent behind data changes. It makes the implicit explicit.

  • Separation of Concerns

    Commands and queries in your system are independent of eachother. This allows them to be scaled & developed independently.

What are the down sides?

As with anything in the tech world, everything is about tradeoffs. There are some reasons not to use event sourcing in your system including:

  • Eventual Consistency: With the separation of concerns comes eventual consistency in your system, meaning your data may not be up to date immediately, but eventually will become consistent.

  • High Disk Usage: With all events being stored forever, disk usage will grow overtime. Though there are solutions to this such as snapshotting.

  • Event Granularity: Sometimes it can be difficult to judge an appropriate size for events. Having them too small may not provide enough data, while large events may slow down your system.

Resources

Here are some useful resources on event sourcing & CQRS:

Why

With Rust being a younger language than most, the ecosystem is lacking Event Sourcing & CQRS frameworks. Many of which are abandoned, or just not feature rich. Thalo aims to provide a backbone and some core crates to build robust event sourced systems.

ESDL - Event-sourcing Schema Definition Language

Defining aggregates, commands and events are recommended to be done in the ESDL schema language.

This allows for more readable aggregate definitions and provides code generation to generate events, command trait and custom types compatible with Thalo.

An example of an .esdl can be found in examples/bank-account/bank-account.esdl.

Examples

Examples include:

  • bank-account: a bank account aggregate built with an ESDL schema file.
  • protobuf: a gRPC client & server for sending syncronous commands.

All examples can be seen in the examples directory.

Getting Help

As Thalo is in pre-release, the API is not stable yet. If you'd like to get started using Thalo, you can checkout the examples directory, or chat with us on our Discord server.

Contributing

๐ŸŽˆ Thanks for your help improving the project! We are so happy to have you! As we don't currently have a contributing guide, you can ping us on the Discord server or open an issue for any questions/discussions.

Release Schedule

Thalo doesn't follow a fixed release schedule, but as the project is in pre-release and active development, you can expect commits on a near daily basis, and version updates evey few days.

License

This project is licensed under the MIT OR Apache-2.0 license.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in Thalo by you, shall be licensed as MIT, without any additional terms or conditions.

You might also like...
A rust web framework with safety and speed in mind.

darpi A web api framework with speed and safety in mind. One of the big goals is to catch all errors at compile time, if possible. The framework uses

A web framework for Rust.

Rocket Rocket is an async web framework for Rust with a focus on usability, security, extensibility, and speed. #[macro_use] extern crate rocket; #[g

A super-easy, composable, web server framework for warp speeds.

warp A super-easy, composable, web server framework for warp speeds. The fundamental building block of warp is the Filter: they can be combined and co

Grape is a REST-like API framework for Ruby
Grape is a REST-like API framework for Ruby

Grape is a REST-like API framework for Ruby. It's designed to run on Rack or complement existing web application frameworks such as Rails and Sinatra by providing a simple DSL to easily develop RESTful APIs. It has built-in support for common conventions, including multiple formats, subdomain/prefix restriction, content negotiation, versioning and much more.

Thruster - An fast and intuitive rust web framework

A fast, middleware based, web framework written in Rust

A full-featured and easy-to-use web framework with the Rust programming language.

Poem Framework A program is like a poem, you cannot write a poem without writing it. --- Dijkstra A full-featured and easy-to-use web framework with t

Perseus is a blazingly fast frontend web development framework built in Rust with support for major rendering strategies

Perseus is a blazingly fast frontend web development framework built in Rust with support for major rendering strategies, reactivity without a virtual DOM, and extreme customizability

Seed is a Rust front-end framework for creating fast and reliable web apps with an Elm-like architecture.
Seed is a Rust front-end framework for creating fast and reliable web apps with an Elm-like architecture.

Seed is a Rust front-end framework for creating fast and reliable web apps with an Elm-like architecture.

Experiments with Rust CRDTs using Tokio web application framework Axum.

crdt-genome Synopsis Experiments with Rust CRDTs using Tokio web application framework Axum. Background Exploring some ideas of Martin Kleppmann, part

Comments
  • Is it possible to access the created_at date of an event in apply()?

    Is it possible to access the created_at date of an event in apply()?

    Forgive me if the answer to this question is obvious, I'm a beginner when it comes to Rust.

    I'm looking at moving an event-sourced system using Laravel (via spatie/laravel-event-sourcing) to Rust, but there are differences between the libraries.

    Is it possible to access the event metadata, particularly the date the event was created, inside of the aggregate's apply function?

    opened by PJKerrigan 4
  • Thalo eventstoredb

    Thalo eventstoredb

    Initial PR for event-store-db support in thalo. I won't make it an official PR until I get a chance to test drive this in my test app repository https://github.com/Shearerbeard/event-sourcing-pizza-delivery-demo-rs.

    • [x] It would be nice if we could have event ids support usize as well as Uuid. ESDB prefers and supports Uuid by default rather than just storing the sequence as a key - with some more advanced features in ESDB this could be a problem eventually @tqwewe I may differ to your guidance here
    • [x] EventStore.load_events_by_id is going to be really inefficient in ESDB and maybe isn't needed for any general use case other than manual debugging - in that case it might be easier to just use database tooling to inspect events
    • [x] I'll be getting some confirmation from the ESDB team to make sure that the 2.0.0-alpha is the best current rust driver to be using - the 1.0.0 release is getting old and isn't as fleshed out
    • [x] Example usage in README.md
    • [x] Integrate into https://github.com/Shearerbeard/event-sourcing-pizza-delivery-demo-rs to test functionality and chase potential bugs
    • [x] possibly plug into a fork of the /examples app and make sure it works there too
    enhancement 
    opened by Shearerbeard 4
  • open_account should check initial_balance for Negative Or Zero Amount as well

    open_account should check initial_balance for Negative Or Zero Amount as well

    I looked at the example. It's straightforward. Well done. In bank_account.rs, I noticed you did some Negative or Zero Amount checks for withdraw and deposit, but I believe you should be doing the same for open_account as well. Thank you.

    opened by omac777 2
Releases(0.5.0)
Sauron is an html web framework for building web-apps. It is heavily inspired by elm.

sauron Guide Sauron is an web framework for creating fast and interactive client side web application, as well as server-side rendering for back-end w

Jovansonlee Cesar 1.7k Dec 26, 2022
Rust / Wasm framework for building client web apps

Yew Rust / Wasm client web app framework Documentation (stable) | Documentation (latest) | Examples | Changelog | Roadmap | ็ฎ€ไฝ“ไธญๆ–‡ๆ–‡ๆกฃ | ็น้ซ”ไธญๆ–‡ๆ–‡ๆช” | ใƒ‰ใ‚ญใƒฅใƒกใƒณใƒˆ A

Yew Stack 25.8k Jan 2, 2023
A Rust application which funnels external webhook event data to an Urbit chat.

Urbit Webhook Funnel This is a simple Rust application which funnels external webhook event data to an Urbit chat. This application is intended to be

Robert Kornacki 15 Jan 2, 2022
A (flash) message framework for actix-web. A port to Rust of Django's message framework.

actix-web-flash-messages Flash messages for actix-web Web applications sometimes need to show a one-time notification to the user - e.g. an error mess

Luca Palmieri 31 Dec 29, 2022
๐ŸŒฑ๐Ÿฆ€๐ŸŒฑ Trillium is a composable toolkit for building web applications with async rust ๐ŸŒฑ๐Ÿฆ€๐ŸŒฑ

?????? Trillium is a composable toolkit for building web applications with async rust ??????

Trillium 243 Jan 2, 2023
A blazingly fast HTTP client with a magnificent request building syntax, made for humans.

?? glue Make requests, select JSON responses, nest them in other requests: A magnificent syntax for blazingly fast cli HTTP calls, made for humans. Ta

Michele Esposito 4 Dec 7, 2022
Axum + JWT authentication Middleware that allows you to start building your application fast

axum_jwt_ware Integration Guide Simple Axum + JWT authentication middleware with implemented Login and refresh token. Goal I aim to simplify the proce

Eze Sunday 3 Dec 2, 2023
A Rust web framework

cargonauts - a Rust web framework Documentation cargonauts is a Rust web framework intended for building maintainable, well-factored web apps. This pr

null 179 Dec 25, 2022
๐Ÿ“ฎ An elegant Telegram bots framework for Rust

teloxide A full-featured framework that empowers you to easily build Telegram bots using the async/.await syntax in Rust. It handles all the difficult

teloxide 1.6k Jan 3, 2023
Actix Web is a powerful, pragmatic, and extremely fast web framework for Rust.

Actix Web is a powerful, pragmatic, and extremely fast web framework for Rust.

Actix 16.2k Jan 2, 2023