{"id":38598905,"url":"https://github.com/fraktalio/fmodel-rust-demo","last_synced_at":"2026-01-17T08:31:44.581Z","repository":{"id":210980510,"uuid":"727906556","full_name":"fraktalio/fmodel-rust-demo","owner":"fraktalio","description":"fmodel-rust demo - Functional and Algebraic Domain modeling with Rust","archived":false,"fork":false,"pushed_at":"2025-12-24T01:56:53.000Z","size":508,"stargazers_count":6,"open_issues_count":11,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-12-25T14:53:26.376Z","etag":null,"topics":["cqrs","domain-modelling","event-sourcing","functional-programming","postgresql"],"latest_commit_sha":null,"homepage":"https://fraktalio.com","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fraktalio.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2023-12-05T20:26:00.000Z","updated_at":"2025-07-25T21:20:54.000Z","dependencies_parsed_at":"2026-01-04T04:04:34.552Z","dependency_job_id":null,"html_url":"https://github.com/fraktalio/fmodel-rust-demo","commit_stats":{"total_commits":60,"total_committers":3,"mean_commits":20.0,"dds":"0.21666666666666667","last_synced_commit":"026d90ce1a38453c96623da9693684c701b1f65e"},"previous_names":["fraktalio/fmodel-rust-demo"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/fraktalio/fmodel-rust-demo","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fraktalio%2Ffmodel-rust-demo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fraktalio%2Ffmodel-rust-demo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fraktalio%2Ffmodel-rust-demo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fraktalio%2Ffmodel-rust-demo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fraktalio","download_url":"https://codeload.github.com/fraktalio/fmodel-rust-demo/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fraktalio%2Ffmodel-rust-demo/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28504364,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-17T06:57:29.758Z","status":"ssl_error","status_checked_at":"2026-01-17T06:56:03.931Z","response_time":85,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cqrs","domain-modelling","event-sourcing","functional-programming","postgresql"],"created_at":"2026-01-17T08:31:44.488Z","updated_at":"2026-01-17T08:31:44.551Z","avatar_url":"https://github.com/fraktalio.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"A demo/example project for the imaginary restaurant and order management.\nIt is demonstrating the usage of [fmodel-rust library](https://github.com/fraktalio/fmodel-rust).\n\nIt demonstrates how to run our unique domain and orchestrate it in an EventSourced/EventDriven way.\n\n![event model image](restaurant-model.jpg)\n*this blueprint is an outcome of the [event-modeling](https://eventmodeling.org/posts/what-is-event-modeling/) process*\n\n## Fmodel\n\nThis project is using [Fmodel](https://github.com/fraktalio/fmodel-rust) - Rust library. \nFind the documentation at [https://docs.rs/fmodel-rust/latest/fmodel_rust/](https://docs.rs/fmodel-rust/latest/fmodel_rust/)\n\n**fmodel-rust** is:\n\n- enabling functional and algebraic domain modeling with Rust programming language.\n- inspired by DDD, EventSourcing and Functional programming communities, yet implements these ideas and\n  concepts in idiomatic Rust, which in turn makes our code\n    - less error-prone,\n    - easier to understand,\n    - easier to test,\n    - type-safe,\n    - memory-safe and\n    - thread-safe.\n- enabling illustrating requirements using examples\n    - the requirements are presented as scenarios.\n    - a scenario is an example of the system’s behavior from the users’ perspective,\n    - and they are specified using the Given-When-Then structure to create a testable/runnable specification\n        - Given `\u003c some precondition(s) / events \u003e`\n        - When `\u003c an action/trigger occurs / commands\u003e`\n        - Then `\u003c some post condition / events \u003e`\n\n```rust\n        DeciderTestSpecification::default()\n            .for_decider(self::order_decider()) // Set the decider\n            .given(vec![]) // no existing events\n            .when(create_order_command.clone()) // Create an Order\n            .then(vec![OrderEvent::Created(OrderCreated {\n                identifier: identifier.clone(),\n                restaurant_identifier: restaurant_identifier.clone(),\n                status: OrderStatus::Created,\n                line_items: line_items.clone(),\n            })]);\n```\n\n## Fstore-SQL\n\nThis project is using [PostgreSQL powered event store](https://github.com/fraktalio/fstore-sql), optimized for event\nsourcing and event streaming.\n\n**Fstore-SQL** is enabling event-sourcing and *pool-based* event-streaming patterns by using SQL (PostgreSQL) only.\n\n- `event-sourcing` data pattern (by using PostgreSQL database) to durably store events\n    - Append events to the ordered, append-only log, using `entity id`/`decider id` as a key\n    - Load all the events for a single entity/decider, in an ordered sequence, using the `entity id`/`decider id` as a\n      key\n    - Support optimistic locking/concurrency\n- `event-streaming` to concurrently coordinate read over a streams of events from multiple consumer instances\n    - Support real-time concurrent consumers to project events into view/query models\n\n## Tools\n\n- [EventModeling](https://eventmodeling.org/posts/what-is-event-modeling/) - a method of describing systems using an\n  example of how information has changed within them over time.\n\n## Patterns\n\n- EventSourcing\n- CQRS\n\n\n## Run the database\n```shell\ndocker compose up -d\n```\n\n## Run the Application\n\n```shell\ncargo run\n```\n\n## Shutdown the database:\n```shell\ndocker compose down -v\n```\n\n## Migration with Offline Mode is Enabled by Default\n\nMigration with the [offline mode](https://github.com/launchbadge/sqlx/tree/main/sqlx-cli#force-building-in-offline-mode) is enabled by:\n\n- setting `SQLX_OFFLINE` environment variable to true in `.env` file.\n- invoking `cargo sqlx prepare` to save query metadata to `.sqlx` in the current directory.\n- checking this directory into version control \n\nand an **active database connection will no longer be needed to build your project**.\n\n## Migration in Online mode can be Enabled\n\nRun the command below to install the sqlx-cli binary:\n```shell\ncargo install sqlx-cli\n```\n\nPush migration to the database\n```shell\nsqlx migrate run\n```\n\nto revert the latest migration:\n```shell\nsqlx migrate revert\n```\n\nSet `SQLX_OFFLINE` environment variable to false in `.env` file to disable offline mode.\n\n**Now your queries will be checked against the database at compile time!**\n\n\n## Try it out\n\nCheck the [test.http](test.http)!\n\n\n---\nCreated with :heart: by [Fraktalio](https://fraktalio.com/)\n\nExcited to launch your next IT project with us? Let's get started! Reach out to our team at `info@fraktalio.com` to\nbegin the journey to success.\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffraktalio%2Ffmodel-rust-demo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffraktalio%2Ffmodel-rust-demo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffraktalio%2Ffmodel-rust-demo/lists"}