{"id":38598736,"url":"https://github.com/fraktalio/fmodel-ktor-demo","last_synced_at":"2026-01-17T08:31:38.823Z","repository":{"id":172445570,"uuid":"634580844","full_name":"fraktalio/fmodel-ktor-demo","owner":"fraktalio","description":"Fmodel demo - Functional and Algebraic Domain modeling - Ktor","archived":false,"fork":false,"pushed_at":"2026-01-16T15:05:42.000Z","size":14081,"stargazers_count":20,"open_issues_count":11,"forks_count":3,"subscribers_count":2,"default_branch":"main","last_synced_at":"2026-01-17T04:49:39.945Z","etag":null,"topics":["cqrs-pattern","event-modeling","event-sourcing"],"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,"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-04-30T15:43:08.000Z","updated_at":"2025-12-08T22:05:42.000Z","dependencies_parsed_at":"2024-02-14T23:25:45.180Z","dependency_job_id":"369d947a-ed2a-4afb-a56d-da6f618f810f","html_url":"https://github.com/fraktalio/fmodel-ktor-demo","commit_stats":null,"previous_names":["fraktalio/fmodel-ktor-demo"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/fraktalio/fmodel-ktor-demo","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fraktalio%2Ffmodel-ktor-demo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fraktalio%2Ffmodel-ktor-demo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fraktalio%2Ffmodel-ktor-demo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fraktalio%2Ffmodel-ktor-demo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fraktalio","download_url":"https://codeload.github.com/fraktalio/fmodel-ktor-demo/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fraktalio%2Ffmodel-ktor-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-pattern","event-modeling","event-sourcing"],"created_at":"2026-01-17T08:31:38.042Z","updated_at":"2026-01-17T08:31:38.808Z","avatar_url":"https://github.com/fraktalio.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"# fmodel-ktor-demo (EventSourcing)\n\nA demo/example project for the imaginary restaurant and order management.\nIt is backing the [Fmodel Reference Guide](https://fraktalio.com/fmodel/).\n\nIt demonstrates how to run our unique domain and orchestrate it in an EventSourced/EventDriven way.\n\n![event model image](.assets/restaurant-model2.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) - Kotlin, multiplatform library.\n\n**Fmodel** is:\n\n- enabling functional, algebraic and reactive domain modeling with Kotlin programming language.\n- inspired by DDD, EventSourcing and Functional programming communities, yet implements these ideas and\n  concepts in idiomatic Kotlin, which in turn makes our code\n    - less error-prone,\n    - easier to understand,\n    - easier to test,\n    - type-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\nCheck the tests!\n\n```kotlin\nwith(orderDecider) {\n    givenEvents(listOf(orderCreatedEvent)) {         // PRE CONDITIONS\n        whenCommand(createOrderCommand)              // ACTION\n    } thenEvents listOf(orderRejectedEvent)          // POST CONDITIONS\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## Prerequisites\n\n- [Java 17](https://adoptium.net/)\n- [Docker](https://www.docker.com/products/docker-desktop/)\n\n## Technology\n\n- [Fmodel - Domain modeling with Kotlin](https://github.com/fraktalio/fmodel)\n- [Ktor](https://ktor.io/) (HTTP)\n- [Kotlin](https://kotlinlang.org/) (Coroutines, Serialization)\n- [Arrow](https://arrow-kt.io/) (Fx Coroutines, ...)\n- [Postgres](https://www.postgresql.org/) ([event store](https://github.com/fraktalio/fstore-sql), projections)\n\n## Run \u0026 Test\n\nThis project is using [Gradle](https://docs.gradle.org) as a build and automation tool.\n\n### Test:\n\n```shell\n./gradlew check\n```\n\n### Run:\n\n\u003e Make sure you have [Postgres](https://www.postgresql.org/download/) installed and running.\n\n\u003e Alternatively, you can use [Docker](https://www.docker.com/products/docker-desktop/) to run PostgreSQL.\n\n```shell\ndocker run --name postgres -e POSTGRES_PASSWORD=postgres -p 5432:5432 -d postgres\n```\n\n\u003e Check the connection URL in [application environment variables](src/main/kotlin/com/fraktalio/Env.kt)\n\n```shell\n./gradlew run\n```\n\n### Run in Docker\n\n\u003e Make sure you have [Docker](https://www.docker.com/products/docker-desktop/) installed and running.\n\nBuild OCI (docker) image:\n\n```shell\n./gradlew publishImageToLocalRegistry\n```\n\nRun application and Postgres database:\n\n```shell\ndocker-compose up\n```\n\n## Further Reading\n\n- Check the [FModel reference guide](https://github.com/fraktalio/fmodel)\n- Read the [blog](https://fraktalio.com/blog/)\n- Learn by example on the [playground](https://fraktalio.com/blog/playground)\n- [Spring Boot version of this project](https://github.com/fraktalio/fmodel-spring-demo).\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","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffraktalio%2Ffmodel-ktor-demo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffraktalio%2Ffmodel-ktor-demo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffraktalio%2Ffmodel-ktor-demo/lists"}