{"id":18428459,"url":"https://github.com/lefttwixwand/moderncqrs","last_synced_at":"2025-04-07T17:32:01.257Z","repository":{"id":137401571,"uuid":"424559116","full_name":"LeftTwixWand/ModernCQRS","owner":"LeftTwixWand","description":"This repository shows, how to implement CQRS architecture pattern, using Autofac and MediatR libraries.","archived":false,"fork":false,"pushed_at":"2025-04-06T00:17:11.000Z","size":62,"stargazers_count":30,"open_issues_count":0,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-06T00:23:29.745Z","etag":null,"topics":["autofac","autofac-container","autofac-di","cqrs","csharp","decorator","decorator-pattern","decorators","dotnet","mediator-pattern","mediatr","mediatr-library"],"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/LeftTwixWand.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,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-11-04T10:46:07.000Z","updated_at":"2025-04-06T00:17:15.000Z","dependencies_parsed_at":null,"dependency_job_id":"b2852c53-f89e-4b4e-94d9-9bf647ebe542","html_url":"https://github.com/LeftTwixWand/ModernCQRS","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LeftTwixWand%2FModernCQRS","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LeftTwixWand%2FModernCQRS/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LeftTwixWand%2FModernCQRS/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LeftTwixWand%2FModernCQRS/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LeftTwixWand","download_url":"https://codeload.github.com/LeftTwixWand/ModernCQRS/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247697768,"owners_count":20981245,"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","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":["autofac","autofac-container","autofac-di","cqrs","csharp","decorator","decorator-pattern","decorators","dotnet","mediator-pattern","mediatr","mediatr-library"],"created_at":"2024-11-06T05:13:46.523Z","updated_at":"2025-04-07T17:32:01.248Z","avatar_url":"https://github.com/LeftTwixWand.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"## This repository shows, how to implement CQRS architecture approach, using [Autofac](https://github.com/autofac/Autofac) and [MediatR](https://github.com/jbogard/MediatR) libraries.\n\nThe main purpose is to create a simple app with clear CQRS requests processing behavior.\n\nThis repository demonstrates how to:\n - Set up the **MediatR**\n - Create custom **Commands** / **Queries** and its handlers\n - Add **decorators** for all types of request handlers\n - Add **decorators** only for Command or Query handlers\n - Use **pipelines** (**MediatR** Behaviours like request Pre Processors and Post Processors)\n\nThe sample app output:\n\n![Output](https://user-images.githubusercontent.com/50652041/221921311-cffbd848-5e7a-4841-9f30-99dd5aa8b24c.png)\n\n### The architecture\n\n```mermaid\nflowchart TD\n    %% Start with client call\n    Start([Client]) --\u003e|\"mediator.Send(command)\"| MediatR[MediatR]\n    \n    %% Simple flow through layers\n    MediatR --\u003e Pipeline\n    \n    subgraph Pipeline [Request Pipeline]\n        direction TB\n        PreProc[Pre-Processors Layer] --\u003e Decorators1[Decorators Layer]\n        Decorators1 --\u003e Handler[Request Handler]\n        Handler --\u003e Decorators2[Decorators Layer]\n        Decorators2 --\u003e PostProc[Post-Processors Layer]\n    end\n    \n    Pipeline --\u003e Response([Response])\n    \n    %% Cross-mode optimized styling (works well in both light and dark themes)\n    classDef client fill:#4D7EA8,stroke:#2C4D6E,stroke-width:2px,color:white,font-weight:bold\n    classDef pipeline fill:#6B7FD7,stroke:#3B4AA0,stroke-width:2px,color:white\n    classDef layer fill:#9683EC,stroke:#644CB5,stroke-width:1px,color:white\n    classDef handler fill:#50B9A0,stroke:#2E6B5E,stroke-width:2px,color:white,font-weight:bold\n    classDef structure fill:#E6777E,stroke:#B24248,stroke-width:1px,color:white\n    \n    class Start,Response client\n    class Pipeline,MediatR pipeline\n    class PreProc,Decorators1,Decorators2,PostProc layer\n    class Handler handler\n    class RequestStructure,HandlerStructure,IRequest,IIdentReq,CmdQuery,IReqHandler,ICmdHandler,IQryHandler structure\n```\n\n```mermaid\nflowchart TD\n    \n    %% Simplified hierarchy on the side\n    subgraph RequestStructure [Request Hierarchy]\n        direction TB\n        IRequest[MediatR.IRequest] --\u003e IIdentReq[IIdentifiableRequest]\n        IIdentReq --\u003e CmdQuery[CommandBase/QueryBase]\n    end\n    \n    %% Simplified handler hierarchy\n    subgraph HandlerStructure [Handler Hierarchy]\n        direction TB\n        IReqHandler[MediatR.IRequestHandler] --\u003e ICmdHandler[ICommandHandler]\n        IReqHandler --\u003e IQryHandler[IQueryHandler]\n    end\n    \n    %% Cross-mode optimized styling (works well in both light and dark themes)\n    classDef client fill:#4D7EA8,stroke:#2C4D6E,stroke-width:2px,color:white,font-weight:bold\n    classDef pipeline fill:#6B7FD7,stroke:#3B4AA0,stroke-width:2px,color:white\n    classDef layer fill:#9683EC,stroke:#644CB5,stroke-width:1px,color:white\n    classDef handler fill:#50B9A0,stroke:#2E6B5E,stroke-width:2px,color:white,font-weight:bold\n    classDef structure fill:#E6777E,stroke:#B24248,stroke-width:1px,color:white\n    \n    class Start,Response client\n    class Pipeline,MediatR pipeline\n    class PreProc,Decorators1,Decorators2,PostProc layer\n    class Handler handler\n    class RequestStructure,HandlerStructure,IRequest,IIdentReq,CmdQuery,IReqHandler,ICmdHandler,IQryHandler structure\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flefttwixwand%2Fmoderncqrs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flefttwixwand%2Fmoderncqrs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flefttwixwand%2Fmoderncqrs/lists"}