<?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: 1 Pouria Dev</title>
    <description>The latest articles on DEV Community by 1 Pouria Dev (@1pouria).</description>
    <link>https://dev.to/1pouria</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%2F3664888%2F2896cf3e-8817-472c-a628-2ab219ed15a0.jpg</url>
      <title>DEV Community: 1 Pouria Dev</title>
      <link>https://dev.to/1pouria</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/1pouria"/>
    <language>en</language>
    <item>
      <title>How I Fixed Instagram's Annoying Web Video Player (With Shadow DOM &amp; Pragmatic AI)</title>
      <dc:creator>1 Pouria Dev</dc:creator>
      <pubDate>Tue, 20 Oct 2026 16:51:27 +0000</pubDate>
      <link>https://dev.to/1pouria/how-i-fixed-instagrams-annoying-web-video-player-with-shadow-dom-pragmatic-ai-2ggm</link>
      <guid>https://dev.to/1pouria/how-i-fixed-instagrams-annoying-web-video-player-with-shadow-dom-pragmatic-ai-2ggm</guid>
      <description>&lt;p&gt;Ever watched a video on Instagram Web and wanted to rewind just 5 seconds? You can't. &lt;/p&gt;

&lt;p&gt;Platforms like Instagram love to hide basic video controls and cover the &lt;code&gt;&amp;lt;video&amp;gt;&lt;/code&gt; element with invisible overlays. Click once, and it mutes. Click again, and it pauses or opens a post. Want to scrub through the timeline or change playback speed? Good luck.&lt;/p&gt;

&lt;p&gt;I got tired of fighting restricted web players, so I built &lt;strong&gt;&lt;a href="https://chromewebstore.google.com/detail/oneplay-video-control/gpmickcblelmgkfheifkhnhehhmcfahp" rel="noopener noreferrer"&gt;OnePlay - Video Control&lt;/a&gt;&lt;/strong&gt;—a lightweight Chrome extension (Manifest V3 + TypeScript) that puts clean, desktop-grade controls on any HTML5 video across the web.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F79oaflchpjei9kws8pm2.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F79oaflchpjei9kws8pm2.gif" alt="OnePlay Demo" width="480" height="619"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here’s a quick look at what it does, how I kept it from breaking when websites update, and my realistic workflow building it with AI.&lt;/p&gt;




&lt;h3&gt;
  
  
  What OnePlay Does
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Overlay-Proof Controls:&lt;/strong&gt; Sits at max &lt;code&gt;z-index&lt;/code&gt; with isolated pointer handling, so transparent tap-to-mute/pause blockers can't intercept your clicks.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Full Playback &amp;amp; Themes:&lt;/strong&gt; Seek, volume, speed (0.5x to 3x), custom shortcuts (&lt;code&gt;Space&lt;/code&gt;, &lt;code&gt;J/L&lt;/code&gt;, &lt;code&gt;Arrows&lt;/code&gt;), Full or "Minimal Pill" mode, and 4 built-in themes.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Stream Recorder &amp;amp; Downloader:&lt;/strong&gt; Right-click the bar to download direct videos, or record segmented streams (HLS/DASH/Blob) in real-time using &lt;code&gt;captureStream()&lt;/code&gt; and &lt;code&gt;MediaRecorder&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  The Architecture: Complete DOM Decoupling
&lt;/h3&gt;

&lt;p&gt;If you inject UI directly inside a website's player container, two bad things happen:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The host site's CSS leaks into your UI and breaks it.&lt;/li&gt;
&lt;li&gt;Every time the site updates its obfuscated React/Vue tree or uses &lt;code&gt;overflow: hidden&lt;/code&gt;, your extension breaks.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;To avoid this, OnePlay never touches the host player's DOM. Instead:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Top-Level Shadow DOM:&lt;/strong&gt; The controller mounts inside an isolated Shadow DOM attached directly to &lt;code&gt;document.documentElement&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Viewport Tracking:&lt;/strong&gt; It tracks the target video's bounding box via &lt;code&gt;requestAnimationFrame&lt;/code&gt; and floats right over it. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Because it's completely decoupled from the site's layout tree, platforms can redesign their frontend every week and OnePlay keeps working.&lt;/p&gt;




&lt;h3&gt;
  
  
  My Realistic AI Workflow (Human + Agent)
&lt;/h3&gt;

&lt;p&gt;I built most of this project using &lt;strong&gt;Antigravity&lt;/strong&gt; paired with &lt;strong&gt;Gemini Flash 3.8&lt;/strong&gt;. Honestly, for a browser extension, a fast model like Flash was more than enough—I didn't need slow, heavy models.&lt;/p&gt;

&lt;p&gt;However, relying 100% on AI prompts can slow you down. Here is how I balanced it:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Fixing CSS Manually:&lt;/strong&gt; Whenever a button alignment or theme style looked slightly off, I didn't waste time explaining it to the AI in 5 prompts. Tweaking the CSS myself was way faster.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Inspecting DOM Myself:&lt;/strong&gt; Social media sites have chaotic DOM structures. Instead of asking the AI to guess how a site works, I inspected the pages myself, figured out the quirks, and guided the agent on &lt;em&gt;how&lt;/em&gt; to improve the logic.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And for update checks, instead of hardcoding everything and waiting days for Chrome Web Store reviews, I hosted a simple static &lt;code&gt;version.json&lt;/code&gt; file on &lt;strong&gt;Cloudflare Pages&lt;/strong&gt;.&lt;/p&gt;




&lt;h3&gt;
  
  
  What’s Next? (Would Love Your Feedback!)
&lt;/h3&gt;

&lt;p&gt;OnePlay runs 100% locally with zero tracking. If people find it useful, I’m planning to build a modular plugin system to add:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;🔊 &lt;strong&gt;Volume Booster&lt;/strong&gt; (going beyond 100%).&lt;/li&gt;
&lt;li&gt;📝 &lt;strong&gt;Subtitles &amp;amp; AI Chat:&lt;/strong&gt; Connecting to subtitle APIs, plus a companion &lt;strong&gt;Desktop App&lt;/strong&gt; for local subtitle generation and asking AI questions about the video.&lt;/li&gt;
&lt;li&gt;🖥️ &lt;strong&gt;Central Media Hub:&lt;/strong&gt; A unified popup with live previews to control all playing videos across different tabs.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Give it a try and let me know what you think—or what feature you'd like to see next!&lt;/p&gt;

&lt;p&gt;👉 &lt;strong&gt;&lt;a href="https://chromewebstore.google.com/detail/oneplay-video-control/gpmickcblelmgkfheifkhnhehhmcfahp" rel="noopener noreferrer"&gt;Install from Chrome Web Store&lt;/a&gt;&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
👉 &lt;strong&gt;&lt;a href="https://github.com/Pouria7/OnePlay-Video-Control" rel="noopener noreferrer"&gt;Source Code on GitHub&lt;/a&gt;&lt;/strong&gt; (Stars ⭐ are appreciated!)&lt;/p&gt;

</description>
      <category>ai</category>
      <category>webdev</category>
      <category>javascript</category>
      <category>extensions</category>
    </item>
    <item>
      <title>Why I Built Yet Another Mediator (And Why You Might Care)</title>
      <dc:creator>1 Pouria Dev</dc:creator>
      <pubDate>Tue, 16 Dec 2025 13:39:59 +0000</pubDate>
      <link>https://dev.to/1pouria/why-i-built-yet-another-mediator-and-why-you-might-care-4m1b</link>
      <guid>https://dev.to/1pouria/why-i-built-yet-another-mediator-and-why-you-might-care-4m1b</guid>
      <description>&lt;p&gt;Let me start with a confession: I built AnAspect.Mediator to scratch my own itch. And like most "scratching your own itch" projects, it started with frustration, evolved through experimentation, and ended up solving problems I didn't even know I had.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Journey: From Performance Hunt to Flexibility Need
&lt;/h2&gt;

&lt;p&gt;About a year and a half ago, I was architecting a modular monolith and obsessing over performance. I'd been using MediatR for years, but I wanted something faster. I discovered &lt;a href="https://github.com/martinothamar/Mediator" rel="noopener noreferrer"&gt;Mediator by Martin Othamar&lt;/a&gt; - a SourceGenerator-based implementation that promised better performance through compile-time code generation.&lt;/p&gt;

&lt;p&gt;Perfect, right? Almost.&lt;/p&gt;

&lt;p&gt;I was heavily using &lt;code&gt;internal&lt;/code&gt; access modifiers to enforce proper encapsulation between modules. Clean boundaries, proper separation of concerns, the whole nine yards. But the SourceGenerator-based mediator couldn't discover my &lt;code&gt;internal&lt;/code&gt; handlers. It silently skipped them.&lt;/p&gt;

&lt;p&gt;I could have fought with it, maybe contributed a fix, or changed my architecture. Instead, I did what any developer does when they're already deep in the rabbit hole. At that point, I wasn't trying to build a library - I just wanted my architecture to stop fighting me&lt;/p&gt;

&lt;h2&gt;
  
  
  The Accidental Year-Long Break
&lt;/h2&gt;

&lt;p&gt;I got it working for my needs and... forgot about it. Nearly a year passed. The code sat there, doing its job in my internal projects, stable but unremarkable.&lt;/p&gt;

&lt;p&gt;Then, a few weeks ago, I revisited it with fresh eyes (and Claude Opus as a rubber duck). What started as "let me clean this up" turned into "wait, this actually solves a real problem."&lt;/p&gt;

&lt;h2&gt;
  
  
  The Real Problem: Pipeline Rigidity
&lt;/h2&gt;

&lt;p&gt;Here's what I realized: MediatR's pipeline is elegant but rigid. Once you configure your behaviors at startup, that's it. Every request goes through the same pipeline, whether it needs to or not.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Real-world scenario:&lt;/strong&gt; You have logging and validation behaviors. In production, most requests need both. But during a performance-critical batch operation? You might want to skip logging. During development? Maybe you want extra verbose logging for specific requests.&lt;/p&gt;

&lt;p&gt;With MediatR, your options are:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Redeploy with different configuration (not practical)&lt;/li&gt;
&lt;li&gt;Add conditional logic inside behaviors (messy and defeats the purpose)&lt;/li&gt;
&lt;li&gt;Live with the overhead (expensive)&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Enter Conditional Behaviors
&lt;/h2&gt;

&lt;p&gt;AnAspect.Mediator introduces runtime pipeline control:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Skip all pipeline behaviors for performance-critical operations&lt;/span&gt;
&lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;_mediator&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;WithoutPipeline&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;SendAsync&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nf"&gt;ProcessBatchCommand&lt;/span&gt;&lt;span class="p"&gt;());&lt;/span&gt;

&lt;span class="c1"&gt;// Use specific pipeline group&lt;/span&gt;
&lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;_mediator&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;WithPipelineGroup&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"admin"&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;SendAsync&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;command&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="c1"&gt;// Exclude specific behavior types&lt;/span&gt;
&lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;_mediator&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ExcludeBehavior&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;ILoggingBehavior&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;()&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ExcludeBehavior&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;ICachingBehavior&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;()&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;SendAsync&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;command&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="c1"&gt;// Skip only global behaviors&lt;/span&gt;
&lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;_mediator&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;SkipGlobalBehaviors&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;SendAsync&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;command&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://github.com/Pouria7/AnAspect.Mediator" rel="noopener noreferrer"&gt;documents...&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The behaviors are still there, configured at startup. But now you control which ones run, when they run, for each individual request.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Order Matters (And Why It's Explicit)
&lt;/h2&gt;

&lt;p&gt;I made a deliberate choice: behavior order is set via explicit &lt;code&gt;Order&lt;/code&gt; property and can't be changed at runtime. &lt;/p&gt;

&lt;p&gt;Why? Two reasons:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Runtime order changes aren't that useful.&lt;/strong&gt; In practice, you rarely need to change execution order dynamically. You either need a behavior or you don't.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Code traceability matters.&lt;/strong&gt; When debugging, I want to look at my registration code and know exactly what order things execute in. Runtime order manipulation makes the pipeline a black box.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Instead, I focused on making order work seamlessly with groups:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="n"&gt;services&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;AddMediator&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;cfg&lt;/span&gt; &lt;span class="p"&gt;=&amp;gt;&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// Global behaviors with explicit ordering&lt;/span&gt;
    &lt;span class="n"&gt;cfg&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;AddBehavior&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;ValidationBehavior&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;(&lt;/span&gt;&lt;span class="n"&gt;order&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="n"&gt;cfg&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;AddBehavior&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;LoggingBehavior&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;(&lt;/span&gt;&lt;span class="n"&gt;order&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;10&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;groups&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s"&gt;"monitoring"&lt;/span&gt;&lt;span class="p"&gt;]);&lt;/span&gt;
    &lt;span class="n"&gt;cfg&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;AddBehavior&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;CachingBehavior&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;(&lt;/span&gt;&lt;span class="n"&gt;order&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;20&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;groups&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s"&gt;"monitoring"&lt;/span&gt;&lt;span class="p"&gt;]);&lt;/span&gt;

    &lt;span class="c1"&gt;// Typed behaviors for specific requests&lt;/span&gt;
    &lt;span class="n"&gt;cfg&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;AddBehavior&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;CreateUserValidation&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;CreateUserCommand&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;UserDto&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;(&lt;/span&gt;&lt;span class="n"&gt;order&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;5&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now you can reason about your pipeline AND control it dynamically without sacrificing clarity.&lt;/p&gt;

&lt;h2&gt;
  
  
  Performance: The Real Story
&lt;/h2&gt;

&lt;p&gt;Here's where it gets interesting. I didn't build this to beat everyone on benchmarks, but the design choices led to some unexpected wins.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Scalability Sweet Spot
&lt;/h3&gt;

&lt;p&gt;When you have 100+ handlers in a large application (which is typical in production systems), AnAspect.Mediator shines:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Scenario&lt;/th&gt;
&lt;th&gt;AnAspect&lt;/th&gt;
&lt;th&gt;MediatR&lt;/th&gt;
&lt;th&gt;SourceGenerator&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;100 handlers, with pipeline&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;88 ns / 96 B&lt;/td&gt;
&lt;td&gt;117 ns / 344 B&lt;/td&gt;
&lt;td&gt;109 ns / 160 B&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Performance gain&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;Baseline&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;25% slower&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;19% slower&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The key insight: &lt;strong&gt;AnAspect maintains consistent performance as your application grows.&lt;/strong&gt; More handlers? Same speed.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Serverless Advantage
&lt;/h3&gt;

&lt;p&gt;For serverless/cloud scenarios where cold starts matter, the story is even better:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Scenario&lt;/th&gt;
&lt;th&gt;AnAspect&lt;/th&gt;
&lt;th&gt;SourceGenerator&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Cold start (no pipeline)&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;39,525 ns&lt;/td&gt;
&lt;td&gt;56,695 ns&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Performance gain&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;35% faster&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Baseline&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;This isn't just about raw speed - it's about predictable, consistent performance that doesn't degrade as your codebase grows.&lt;/p&gt;

&lt;h3&gt;
  
  
  But Let's Be Honest
&lt;/h3&gt;

&lt;p&gt;In simple scenarios without pipelines, SourceGenerator-based mediators are roughly equivalent in performance. The difference is negligible for basic request/response.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Where AnAspect wins:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Complex pipelines with multiple behaviors&lt;/li&gt;
&lt;li&gt;Large-scale applications (50+ handlers)&lt;/li&gt;
&lt;li&gt;Serverless/cold start scenarios&lt;/li&gt;
&lt;li&gt;When you need runtime pipeline control&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;When SourceGenerator is fine:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Simple CQRS without complex pipelines&lt;/li&gt;
&lt;li&gt;Small to medium applications&lt;/li&gt;
&lt;li&gt;You don't need conditional behaviors&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What's NOT Here (And Why)
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;No Notifications/Events.&lt;/strong&gt; I know, MediatR has &lt;code&gt;INotification&lt;/code&gt;. I'm leaving it out deliberately. If you need pub/sub, there are better tools for that (MassTransit, Brighter, even plain .NET events). AnAspect.Mediator focuses on request/response with flexible pipelines. One thing, done well.&lt;/p&gt;

&lt;h2&gt;
  
  
  Current State: Alpha, But Battle-Tested
&lt;/h2&gt;

&lt;p&gt;I'm calling this Alpha because:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Documentation needs work&lt;/li&gt;
&lt;li&gt;I want better test coverage&lt;/li&gt;
&lt;li&gt;The API might still evolve based on feedback&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;But it's already running in production-adjacent environments (my internal projects), and it's stable. I'm using it, which means I care about keeping it that way.&lt;/p&gt;

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

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

&lt;p&gt;&lt;strong&gt;1. Build-time handler validation&lt;/strong&gt;&lt;br&gt;
Report at registration time when:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A request has no handler (probably a bug)&lt;/li&gt;
&lt;li&gt;A request has multiple handlers (definitely a bug, unless you want notifications)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This will be configurable: &lt;code&gt;Warn&lt;/code&gt;, &lt;code&gt;Exception&lt;/code&gt;, or &lt;code&gt;None&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="n"&gt;services&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;AddMediator&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;cfg&lt;/span&gt; &lt;span class="p"&gt;=&amp;gt;&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;cfg&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;HandlerValidation&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="n"&gt;ValidationMode&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Exception&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// Fail fast&lt;/span&gt;
    &lt;span class="n"&gt;cfg&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;RegisterServicesFromAssembly&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;typeof&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;MyHandler&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="n"&gt;Assembly&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;2. Telemetry integration&lt;/strong&gt;&lt;br&gt;
Making it play nice with OpenTelemetry and other observability tools. The conditional behaviors make this interesting - you can see which behaviors ran for each request in your traces.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Better documentation&lt;/strong&gt;&lt;br&gt;
Real examples, migration guides from MediatR, common patterns and anti-patterns.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. Public roadmap&lt;/strong&gt;&lt;br&gt;
What I'm building, what I'm considering, what I'm explicitly not doing.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Share This Now?
&lt;/h2&gt;

&lt;p&gt;Because I think the conditional behavior pattern is genuinely useful, and I haven't seen it elsewhere. ASP.NET Core's Minimal API recently added the ability to skip middleware (like validation) for specific endpoints. That's the same instinct - sometimes you need fine-grained control.&lt;/p&gt;

&lt;p&gt;If you've ever wanted to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Skip expensive behaviors for specific requests&lt;/li&gt;
&lt;li&gt;Toggle diagnostics without redeploying&lt;/li&gt;
&lt;li&gt;A/B test different pipeline configurations&lt;/li&gt;
&lt;li&gt;Optimize performance-critical paths without compromising safety elsewhere&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;...then this might be worth a look.&lt;/p&gt;

&lt;h2&gt;
  
  
  Try It, Break It, Tell Me What You Think
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;GitHub:&lt;/strong&gt; &lt;a href="https://github.com/Pouria7/AnAspect.Mediator" rel="noopener noreferrer"&gt;https://github.com/Pouria7/AnAspect.Mediator&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;NuGet:&lt;/strong&gt; &lt;a href="https://www.nuget.org/packages/AnAspect.Mediator" rel="noopener noreferrer"&gt;AnAspect.Mediator&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I'd genuinely love feedback:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;What's confusing in the API?&lt;/li&gt;
&lt;li&gt;What features are missing?&lt;/li&gt;
&lt;li&gt;What would make this useful for your projects?&lt;/li&gt;
&lt;li&gt;Where did I make the wrong design choice?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The API is still soft enough to change if there's a better way. Drop a comment, open an issue, or just tell me I'm wrong about something. All feedback is valuable.&lt;/p&gt;

&lt;p&gt;And if you're thinking "I wish I could just..." with your current mediator - tell me. Maybe it's something worth adding, or maybe it's deliberately not in scope. Either way, I want to know what real developers actually need.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;P.S. Should you migrate from MediatR? Probably not yet, unless you specifically need conditional behaviors or have scalability concerns with large handler counts. Let this mature a bit. But if you're starting fresh or evaluating options? Give it a shot. Worst case, you learn something. Best case, you save yourself some future pain.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>dotnet</category>
      <category>csharp</category>
      <category>performance</category>
      <category>architecture</category>
    </item>
  </channel>
</rss>
