<?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: seyed ali moradi (call me Sam)</title>
    <description>The latest articles on DEV Community by seyed ali moradi (call me Sam) (@seyed_alimoradi_e9f65c65).</description>
    <link>https://dev.to/seyed_alimoradi_e9f65c65</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%2F2072793%2F3923d79c-a877-49dc-a2a3-6394c0968249.jpg</url>
      <title>DEV Community: seyed ali moradi (call me Sam)</title>
      <link>https://dev.to/seyed_alimoradi_e9f65c65</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/seyed_alimoradi_e9f65c65"/>
    <language>en</language>
    <item>
      <title>Move to Event-Driven Architecture</title>
      <dc:creator>seyed ali moradi (call me Sam)</dc:creator>
      <pubDate>Fri, 19 Jun 2026 13:26:28 +0000</pubDate>
      <link>https://dev.to/seyed_alimoradi_e9f65c65/move-to-event-driven-architecture-3ea7</link>
      <guid>https://dev.to/seyed_alimoradi_e9f65c65/move-to-event-driven-architecture-3ea7</guid>
      <description>&lt;p&gt;Like many teams  we didn’t choose event-driven architecture in the first place.&lt;/p&gt;

&lt;p&gt;At first, the application was relatively simple. A user performed an action, the backend processed it, updated the database, and returned a response.&lt;/p&gt;

&lt;p&gt;But as the product evolved new requirements showed up!&lt;/p&gt;

&lt;p&gt;A single action didn’t just affect one part of the system.&lt;/p&gt;

&lt;p&gt;Creating or updating data could trigger:&lt;/p&gt;

&lt;p&gt;Price recalculations&lt;br&gt;
Cache invalidations&lt;br&gt;
Real-time frontend updates&lt;br&gt;
Audit logging&lt;br&gt;
Notifications&lt;br&gt;
Reporting updates&lt;/p&gt;

&lt;p&gt;Initially, these responsibilities were handled directly inside service methods.&lt;br&gt;
A simplified example looked something like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;update_price&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;

 &lt;span class="n"&gt;price&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;calculate_price&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

 &lt;span class="nf"&gt;save&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;price&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

 &lt;span class="nf"&gt;update_cache&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;price&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

 &lt;span class="nf"&gt;create_audit_log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;price&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

 &lt;span class="nf"&gt;realtime_update&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;price&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

 &lt;span class="nf"&gt;update_reports&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;price&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;At first this approach seemed to work.&lt;/p&gt;

&lt;p&gt;But over time problems grew.&lt;/p&gt;

&lt;p&gt;The Cost of Coupling&lt;br&gt;
Every new requirement meant modifying existing code.&lt;/p&gt;

&lt;p&gt;Even a simple business change may require changing multiple services.&lt;/p&gt;

&lt;p&gt;The result was:&lt;/p&gt;

&lt;p&gt;Larger service functions and methods&lt;br&gt;
More dependencies that became impossible to maintain over time &lt;br&gt;
More testing complexity that eventually became unmanageable &lt;br&gt;
Higher risk during deployment&lt;br&gt;
Unexpected behavior during edge cases&lt;/p&gt;

&lt;p&gt;The Real-Time Challenge&lt;br&gt;
The biggest challenge appeared when we introduced more real-time functionality.&lt;/p&gt;

&lt;p&gt;Frontend clients needed immediate updates whenever important data changed.&lt;/p&gt;

&lt;p&gt;Users needed immediate updates whenever important data or data related to them changed.&lt;/p&gt;

&lt;p&gt;A Different Perspective&lt;br&gt;
So instead of asking which services need to be called, we start to ask what happened?&lt;/p&gt;

&lt;p&gt;And rather than directly invoking downstream processes, we introduced events.&lt;/p&gt;

&lt;p&gt;Services no longer needed to know who was interested in those events.&lt;/p&gt;

&lt;p&gt;They simply published them.&lt;/p&gt;

&lt;p&gt;Consumers could subscribe and react independently.&lt;/p&gt;

&lt;p&gt;What Changed&lt;br&gt;
Instead of this:&lt;/p&gt;

&lt;p&gt;Service A&lt;/p&gt;

&lt;p&gt;├─ Service B&lt;/p&gt;

&lt;p&gt;├─ Service C&lt;/p&gt;

&lt;p&gt;└─ Service D&lt;/p&gt;

&lt;p&gt;We moved toward:&lt;/p&gt;

&lt;p&gt;Service A&lt;/p&gt;

&lt;p&gt;│&lt;/p&gt;

&lt;p&gt;▼&lt;/p&gt;

&lt;p&gt;Event Bus&lt;/p&gt;

&lt;p&gt;│&lt;/p&gt;

&lt;p&gt;├─ Consumer B&lt;/p&gt;

&lt;p&gt;├─ Consumer C&lt;/p&gt;

&lt;p&gt;└─ Consumer D&lt;/p&gt;

&lt;p&gt;The producer became responsible only for publishing an event.&lt;/p&gt;

&lt;p&gt;Consumers became responsible for their own behavior.&lt;/p&gt;

&lt;p&gt;This significantly reduced coupling between components.&lt;/p&gt;

&lt;p&gt;Benefits We Observed&lt;br&gt;
Easier Feature Development&lt;br&gt;
Adding new features often means a new event consumer rather than modifying existing business logic.&lt;/p&gt;

&lt;p&gt;Better Separation of Concerns&lt;br&gt;
Services focused on their responsibilities instead of coordinating multiple downstream processes.&lt;/p&gt;

&lt;p&gt;Improved Real-Time Updates&lt;br&gt;
Frontend updates became event-driven rather than tightly integrated into backend workflows.&lt;/p&gt;

&lt;p&gt;What We Learned&lt;br&gt;
Moving to an event-driven architecture did not eliminate complexity.&lt;/p&gt;

&lt;p&gt;It changed where the complexity lived.&lt;/p&gt;

&lt;p&gt;We had to think about:&lt;/p&gt;

&lt;p&gt;Event contracts&lt;br&gt;
Idempotency&lt;br&gt;
Ordering&lt;br&gt;
Delivery guarantees&lt;/p&gt;

&lt;p&gt;However, these challenges were easier to manage rather than dependencies we had before.&lt;/p&gt;

&lt;p&gt;The architecture change gave us a system that could evolve without requiring every component to know about every other one.&lt;/p&gt;

&lt;p&gt;And as the application grew, that flexibility became one of the most valuable decisions we made.&lt;/p&gt;

&lt;p&gt;Have you made the move to event-driven architecture? What were your challenges and how to solve them?&lt;/p&gt;

</description>
      <category>eventdriven</category>
    </item>
  </channel>
</rss>
