{"id":13696533,"url":"https://github.com/fraktalio/fmodel-demos","last_synced_at":"2026-01-17T08:31:41.739Z","repository":{"id":39298376,"uuid":"359149058","full_name":"fraktalio/fmodel-demos","owner":"fraktalio","description":"Functional Domain Modeling - Demos - https://fraktalio.com/fmodel/","archived":false,"fork":false,"pushed_at":"2023-08-25T07:18:56.000Z","size":12151,"stargazers_count":50,"open_issues_count":7,"forks_count":8,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-05-03T17:43:45.912Z","etag":null,"topics":["architecture","arrow-kt","ddd","demo-app","event-modeling","event-sourcing","functional-programming","kotlin","modeling","oop-principles","reactive","reactive-programming"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","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}},"created_at":"2021-04-18T13:21:15.000Z","updated_at":"2024-08-09T10:37:41.000Z","dependencies_parsed_at":"2023-09-24T12:10:34.472Z","dependency_job_id":null,"html_url":"https://github.com/fraktalio/fmodel-demos","commit_stats":{"total_commits":87,"total_committers":4,"mean_commits":21.75,"dds":0.5402298850574713,"last_synced_commit":"0346b8ec4b65c29502720f61cf7870db17ae9836"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/fraktalio/fmodel-demos","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fraktalio%2Ffmodel-demos","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fraktalio%2Ffmodel-demos/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fraktalio%2Ffmodel-demos/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fraktalio%2Ffmodel-demos/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fraktalio","download_url":"https://codeload.github.com/fraktalio/fmodel-demos/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fraktalio%2Ffmodel-demos/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":["architecture","arrow-kt","ddd","demo-app","event-modeling","event-sourcing","functional-programming","kotlin","modeling","oop-principles","reactive","reactive-programming"],"created_at":"2024-08-02T18:00:42.133Z","updated_at":"2026-01-17T08:31:41.714Z","avatar_url":"https://github.com/fraktalio.png","language":"Kotlin","funding_links":[],"categories":["🧑🏻‍💻 Code examples"],"sub_categories":[],"readme":"# Functional domain modeling - Examples\n\nThe word `domain` here means the area of interest in the business. When you are developing an `information system` to\nautomate activities of that business, you’re modeling the business. The abstractions that you design, the behaviors that\nyou implement, and the UI interactions that you build all reflect the business — *together they constitute the `model`\nof the domain*.\n\n## f(model)\n\nThese examples are demonstrating the usage of the [fmodel](https://fraktalio.com/fmodel)\nlibrary.\n\nLibrary is written in [Kotlin](https://kotlinlang.org/) programing language by practicing functional style. It is a\nsmall library constructed out of generic data types that can be used to effectively model any stateful information\nsystem.\n\nIt is truly decoupling the pure declaration of our program logic from the runtime. And therefore, the runtime has the\nchance to see the big picture of our program and decide how to run and optimize it.\n\n## Examples\n\nTo demonstrate that `pure declaration of our program logic` is separated from the runtime target and infrastructure, we\nare going to\npractice [onion architecture / ports and adapters](https://blog.ploeh.dk/2013/12/03/layers-onions-ports-adapters-its-all-the-same/)\nin all examples.\n\n![onion architecture image](.assets/onion.png)\n\nThe arrows in the image are showing the direction of the dependency. Notice that all dependencies point inwards, and\nthat Domain is not depending on anybody or anything.\n\n### Restaurant management system\n\nRestaurant management system is:\n\n- managing restaurant menus and other information including location and opening hours\n- managing the preparation of orders at a restaurant kitchen\n\n![restaurant management - event model](.assets/event-model.jpg)\n\nWe are going to run our [**unique** core domain](domain) logic in different ways, by implementing\ndifferent [application](application) and/or `persistence` layers:\n\n| Type | Description | Technology | Scenario | Domain | Application | Adapter |\n| --- | --- | --- | --- | --- | --- | --- |\n| [State stored information system](application/state-stored-system1) | Restaurant management | Kotlin, Arrow, Reactive Spring Boot, R2DBC | combined aggregate scenario - monolith aggregate | `fmodel domain` | `fmodel application` | `spring` |\n| [Event-sourced information system](application/event-sourced-system1) | Restaurant management| Kotlin, Arrow, Reactive Spring Boot, [Axon Framework](https://axoniq.io/product-overview/axon-framework) on infra layer, and [Axon Server](https://axoniq.io/product-overview/axon-server) | combined aggregate scenario - monolith aggregate | `fmodel domain` | `fmodel application` | `axon`, `spring` |\n| [Event-sourced information system - distributed](application/event-sourced-system2) | Restaurant management| Kotlin, Arrow, Reactive Spring Boot, [Axon Framework](https://axoniq.io/product-overview/axon-framework) on infra layer, and [Axon Server](https://axoniq.io/product-overview/axon-server) | distributed aggregate(s) | `fmodel domain` | `fmodel application` | `axon`, `spring` |\n| [Event-sourced information system - distributed](application/event-sourced-system3) | Restaurant management| Kotlin, Arrow, Reactive Spring Boot, [Axon Framework](https://axoniq.io/product-overview/axon-framework) on application layer, and [Axon Server](https://axoniq.io/product-overview/axon-server) | distributed aggregate(s) | `fmodel domain` | `axon` | `axon`, `spring` |\n\n## References and further reading\n\n- [https://fraktalio.com/fmodel/](https://fraktalio.com/fmodel/)\n\n---\nCreated with :heart: by [Fraktalio](https://fraktalio.com/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffraktalio%2Ffmodel-demos","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffraktalio%2Ffmodel-demos","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffraktalio%2Ffmodel-demos/lists"}