<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Varun Kumar</title>
    <description>The latest articles on DEV Community by Varun Kumar (@varun_kumar_).</description>
    <link>https://dev.to/varun_kumar_</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4133277%2F2e96412e-a953-427a-8cbe-8709f1b949b1.jpg</url>
      <title>DEV Community: Varun Kumar</title>
      <link>https://dev.to/varun_kumar_</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/varun_kumar_"/>
    <language>en</language>
    <item>
      <title>I Built My Own CQRS Library for .NET — Here's Why</title>
      <dc:creator>Varun Kumar</dc:creator>
      <pubDate>Sat, 19 Sep 2026 18:56:16 +0000</pubDate>
      <link>https://dev.to/varun_kumar_/i-built-my-own-cqrs-library-for-net-heres-why-5185</link>
      <guid>https://dev.to/varun_kumar_/i-built-my-own-cqrs-library-for-net-heres-why-5185</guid>
      <description>&lt;h1&gt;
  
  
  I Built My Own CQRS Library for .NET — Here's Why
&lt;/h1&gt;

&lt;p&gt;If you've worked on large .NET applications, you've probably encountered CQRS.&lt;/p&gt;

&lt;p&gt;The basic idea is straightforward:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Commands → Change State
Queries  → Read State
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;But once an application grows, the infrastructure around CQRS can become repetitive.&lt;/p&gt;

&lt;p&gt;You need request abstractions, handlers, dispatching, pipeline processing, validation, dependency injection, and other cross-cutting concerns.&lt;/p&gt;

&lt;p&gt;That led me to build &lt;strong&gt;MediCore&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is MediCore?
&lt;/h2&gt;

&lt;p&gt;MediCore is a lightweight CQRS infrastructure library for .NET applications.&lt;/p&gt;

&lt;p&gt;The goal isn't to force a particular architecture.&lt;/p&gt;

&lt;p&gt;Instead, MediCore provides reusable infrastructure that can fit into architectures such as Clean Architecture.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Problem
&lt;/h2&gt;

&lt;p&gt;A typical application may contain:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Controller
    ↓
Command
    ↓
Handler
    ↓
Validation
    ↓
Business Logic
    ↓
Repository
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When this infrastructure is implemented repeatedly across different applications, there is an opportunity to make the common parts reusable.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Idea Behind MediCore
&lt;/h2&gt;

&lt;p&gt;MediCore focuses on the application layer.&lt;/p&gt;

&lt;p&gt;A simplified flow looks like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;              Request
                 │
                 ↓
          ┌─────────────┐
          │   MediCore  │
          └──────┬──────┘
                 ↓
          Pipeline Behaviors
                 │
                 ↓
              Handler
                 │
                 ↓
          Business Logic
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This allows cross-cutting concerns to be handled independently from the core business logic.&lt;/p&gt;

&lt;h2&gt;
  
  
  CQRS
&lt;/h2&gt;

&lt;p&gt;MediCore follows the CQRS approach:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;             Application
                  │
        ┌─────────┴─────────┐
        ↓                   ↓
     Command              Query
        ↓                   ↓
     Handler              Handler
        ↓                   ↓
      Write                Read
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Commands and queries have different responsibilities.&lt;/p&gt;

&lt;p&gt;Commands modify state.&lt;/p&gt;

&lt;p&gt;Queries retrieve state.&lt;/p&gt;

&lt;p&gt;This separation can make application code easier to organize as the system grows.&lt;/p&gt;

&lt;h2&gt;
  
  
  Pipeline Processing
&lt;/h2&gt;

&lt;p&gt;One of the important ideas is pipeline-based processing.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Request
   ↓
Validation
   ↓
Authorization
   ↓
Logging
   ↓
Transaction
   ↓
Handler
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Instead of placing these concerns inside every handler, they can be handled through pipeline processing.&lt;/p&gt;

&lt;h2&gt;
  
  
  Installation
&lt;/h2&gt;

&lt;p&gt;MediCore can be installed using:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;dotnet add package MediCore
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Who is it for?
&lt;/h2&gt;

&lt;p&gt;MediCore is intended for developers who:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Build .NET applications using CQRS&lt;/li&gt;
&lt;li&gt;Follow Clean Architecture&lt;/li&gt;
&lt;li&gt;Want reusable CQRS infrastructure&lt;/li&gt;
&lt;li&gt;Want to separate commands and queries&lt;/li&gt;
&lt;li&gt;Need extensible pipeline processing&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What's Next?
&lt;/h2&gt;

&lt;p&gt;The project is still evolving.&lt;/p&gt;

&lt;p&gt;I'm working on:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Better documentation&lt;/li&gt;
&lt;li&gt;More examples&lt;/li&gt;
&lt;li&gt;Additional pipeline behaviors&lt;/li&gt;
&lt;li&gt;Performance benchmarks&lt;/li&gt;
&lt;li&gt;Community feedback&lt;/li&gt;
&lt;li&gt;More advanced CQRS scenarios&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Try It
&lt;/h2&gt;

&lt;p&gt;If you're interested in CQRS and .NET, give MediCore a try.&lt;/p&gt;

&lt;p&gt;The project is available through NuGet and GitHub.&lt;/p&gt;

&lt;p&gt;I'd love to hear feedback, suggestions, and ideas from the .NET community.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Building software is not only about writing code. Sometimes it's about turning repeated problems into reusable solutions.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;That's the idea behind MediCore.&lt;/p&gt;

</description>
      <category>productivity</category>
      <category>api</category>
      <category>csharp</category>
      <category>opensource</category>
    </item>
  </channel>
</rss>
