{"id":20715753,"url":"https://github.com/tpierrain/cqrs","last_synced_at":"2025-07-27T16:10:58.869Z","repository":{"id":150148749,"uuid":"69128161","full_name":"tpierrain/CQRS","owner":"tpierrain","description":"A simple project to explain CQRS during a live coding session at MS experiences'16","archived":false,"fork":false,"pushed_at":"2017-01-09T16:45:00.000Z","size":4376,"stargazers_count":143,"open_issues_count":7,"forks_count":32,"subscribers_count":13,"default_branch":"master","last_synced_at":"2025-04-23T11:54:57.552Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tpierrain.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2016-09-24T21:17:04.000Z","updated_at":"2025-03-25T20:08:41.000Z","dependencies_parsed_at":"2023-04-14T10:32:04.699Z","dependency_job_id":null,"html_url":"https://github.com/tpierrain/CQRS","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/tpierrain/CQRS","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tpierrain%2FCQRS","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tpierrain%2FCQRS/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tpierrain%2FCQRS/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tpierrain%2FCQRS/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tpierrain","download_url":"https://codeload.github.com/tpierrain/CQRS/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tpierrain%2FCQRS/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267384363,"owners_count":24078576,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-27T02:00:11.917Z","response_time":82,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":[],"created_at":"2024-11-17T02:39:46.159Z","updated_at":"2025-07-27T16:10:58.816Z","avatar_url":"https://github.com/tpierrain.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"![BookARoom](https://github.com/tpierrain/cqrs/blob/master/images/bookARoom.gif?raw=true)\n\nBookARoom is a simple project __to explain CQRS__ during a live coding session at MS experiences'16 (__slides are available here: [https://github.com/tpierrain/CQRS-slides](https://github.com/tpierrain/CQRS-slides)__) or __[here on slideshare](http://www.slideshare.net/ThomasPierrain/cqrs-without-event-sourcing)__\n\nThe project is a __dotnet core__ ASP.NET web site (in order to be containerized in the next session), allowing users:\n\n1. To consult and search for available rooms (READ model)\n2. To book a room (WRITE model)\n\nOf course, booking a room (write model) will impact the read model accordingly.\n\n---\n![disclaimer](https://github.com/tpierrain/cqrs/blob/master/images/disclaimer.gif?raw=true)\n\nThis project is not a real one nor a prod-ready code. The intent here is __to illustrate the CQRS pattern during a 40 minutes session__. Thus, some __trade-offs have been taken__ in that direction (e.g. the usage of *Command* and *Queries* terminology instead of domain specific names that I would have used otherwise).\n\n##### CQRS without Event Sourcing?!?\nYes, since the timing will be short for __[this *MS experiences'16* session in Paris](https://experiences.microsoft.fr/Event/speaker/thomas-pierrain/e11c8e2e-f572-e611-80c3-000d3a2229a6)__ (no more than 30 minutes of live-coding), I've decided to focus only on CQRS pattern, WITHOUT Event Sourcing (ES). Indeed, ES is often a mental dam for people's understanding. \nI also find important that people understand that __CQRS ![loves](https://github.com/tpierrain/cqrs/blob/master/images/heart.png?raw=true) Event sourcing__, but __CQRS != Event sourcing__.\n\n---\n\n### Highlights of the talk\n\n1. __CQRS (WITHOUT Event Sourcing)__:\n    - Why CQRS?\n    - Pattern origin\n    - How read and write models articulate\n    - Eventual consistency challenges and options\n    - Short clarification between __CQRS \u0026 Event sourcing__\n    \n1. How __Outside-in TDD__ works\n1. How __Hexagonal Architecture__ can help us to focus on __Domain first__, before tackling the infra code (ASP.NET) in a second time\n1. What is __dotnet core__ and how it articulates with the new version of ASP.NET\n\n\n---\n\n### Projects \u0026 Dependencies\n- ![directory](https://github.com/tpierrain/cqrs/blob/master/images/directory.png?raw=true) __BookARoom.Domain__:  containing all the domain logic of the solution (for both read and write models). __(has no dependency)__\n\n- ![directory](https://github.com/tpierrain/cqrs/blob/master/images/directory.png?raw=true) __BookARoom.Infra__: containing the reusable infrastructure code (i.e. non-domain one like adapters, command handler, repositories) for both read and write models. __(depends on both Domain and IntegrationModel projects)__\n\n- ![directory](https://github.com/tpierrain/cqrs/blob/master/images/directory.png?raw=true) __BookARoom.Infra.Web__: ASP.NET core project hosting the web infrastructure code (like ViewModels, Views and Controllers) which relies on the BookARoom.Infra code. __(depends on both Domain, Infra and IntegrationModel projects)__\n\n- ![directory](https://github.com/tpierrain/cqrs/blob/master/images/directory.png?raw=true) __BookARoom.Tests__: containing tests for all projects. __(depends on all the other BookARoom projects)__\n\n- ![directory](https://github.com/tpierrain/cqrs/blob/master/images/directory.png?raw=true) __BookARoom.IntegrationModel__: command-line project to generate integration json files for hotel (from code). __(has no dependency)__\n\n---\n\n### Tips and tricks\n\n##### How to run the tests\n\nNote: resharper and ncrunch don't support yet dotnet core; you can only run them via Visual Studio test runner (e.g. Ctrl-R, A) or by executing:\n\n     dotnet test \n\nwithin the BookARoom.Tests project directory.\n\n---\n\n### CQRS in a nutshell\n\nThere are many forms of CQRS implementation. The implementation of the BookARoom project follows this version:\n\n![directory](https://github.com/tpierrain/cqrs/blob/master/images/CQRSdiagram.png?raw=true)\n\nfrom original source: [https://msdn.microsoft.com/en-us/library/jj591573.aspx](https://msdn.microsoft.com/en-us/library/jj591573.aspx)\n\n---\n![lab](https://github.com/tpierrain/cqrs/blob/master/images/Lab.jpg?raw=true)\n\nThe objective of this lab is to __add the \"cancel a reservation\" feature__.\n\n__[Step by step Instructions (following outside-in TDD technique) are presented here](LabInstructions.md)__.\n\n---\n\n### Tracks of improvement\n\n1. Fight against the current anemic model (mainly because I never worked on that topic and that I don't have any expert available to help me ;-( and embrace more the ubiquitous language of this domain.\n\n...\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftpierrain%2Fcqrs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftpierrain%2Fcqrs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftpierrain%2Fcqrs/lists"}