<?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: Mahmoud Farouk</title>
    <description>The latest articles on DEV Community by Mahmoud Farouk (@mfarouk2894).</description>
    <link>https://dev.to/mfarouk2894</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.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3875582%2Fbdb248d1-ad93-47f1-836f-055c00424e24.jpg</url>
      <title>DEV Community: Mahmoud Farouk</title>
      <link>https://dev.to/mfarouk2894</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/mfarouk2894"/>
    <language>en</language>
    <item>
      <title>Stop Starting with Microservices: Why I Built a Modular Monolith for my B2B SaaS Boilerplate</title>
      <dc:creator>Mahmoud Farouk</dc:creator>
      <pubDate>Sun, 12 Apr 2026 22:46:28 +0000</pubDate>
      <link>https://dev.to/mfarouk2894/stop-starting-with-microservices-why-i-built-a-modular-monolith-for-my-b2b-saas-boilerplate-4gho</link>
      <guid>https://dev.to/mfarouk2894/stop-starting-with-microservices-why-i-built-a-modular-monolith-for-my-b2b-saas-boilerplate-4gho</guid>
      <description>&lt;p&gt;If you've ever started a new B2B SaaS project, you know the drill. Before you write a single line of feature code that actually brings value to your users, you spend weeks (or months) wrestling with the exact same infrastructure:&lt;/p&gt;

&lt;p&gt;Setting up Multi-tenancy (and worrying about data leakage).&lt;/p&gt;

&lt;p&gt;Configuring stateless JWT authentication.&lt;/p&gt;

&lt;p&gt;Handling database migrations.&lt;/p&gt;

&lt;p&gt;Integrating payment webhooks safely (idempotency, anyone?).&lt;/p&gt;

&lt;p&gt;As a Principal Software Developer, I realized this "setup fatigue" was killing momentum. So, I decided to build the ultimate boilerplate to solve this once and for all: the Arab Enterprise Kit (AEK).&lt;/p&gt;

&lt;p&gt;But when it came to the architecture, I made a controversial choice for 2026: I completely ignored Microservices.&lt;/p&gt;

&lt;p&gt;Here is why I went with a strict Modular Monolith instead, and how I structured the tech stack.&lt;/p&gt;

&lt;p&gt;The Microservices Trap for Early-Stage SaaS&lt;br&gt;
Microservices are fantastic for scaling massive engineering teams. But for solo founders or small teams launching a B2B SaaS, they introduce a DevOps nightmare:&lt;/p&gt;

&lt;p&gt;Distributed tracing becomes mandatory.&lt;/p&gt;

&lt;p&gt;Data consistency and distributed transactions (Saga patterns) slow down feature delivery.&lt;/p&gt;

&lt;p&gt;Infrastructure costs spike before you even have your first paying customer.&lt;/p&gt;

&lt;p&gt;The Modular Monolith Solution&lt;br&gt;
Instead of splitting by network boundaries, I split by logical boundaries within the same deployment unit.&lt;/p&gt;

&lt;p&gt;Here is the tech stack I chose for the AEK:&lt;/p&gt;

&lt;p&gt;Backend: Java 25 &amp;amp; Spring Boot 4. We use Single-Schema Multi-Tenancy with Hibernate Filters. It ensures strict data isolation at the ORM level without the overhead of spinning up a new database per tenant.&lt;/p&gt;

&lt;p&gt;Frontend: Angular 21 (Zoneless UI using Signals). Combined with native Tailwind RTL/LTR support, making it perfectly suited for global and MENA region applications.&lt;/p&gt;

&lt;p&gt;Integrations: * Stripe Webhooks: Fully configured with idempotency keys to prevent double-charging during network retries.&lt;/p&gt;

&lt;p&gt;Local AI (Ollama): Because B2B enterprise clients care deeply about privacy, sending data to 3rd party LLMs is often a dealbreaker. Integrating local AI ensures zero data leaks.&lt;/p&gt;

&lt;p&gt;The Result?&lt;br&gt;
By keeping everything in a well-structured monolith, you get the deployment simplicity of a single .jar file, but the clean separation of domains. If one module ever needs to scale independently, extracting it is straightforward because the boundaries are already respected in the code.&lt;/p&gt;

&lt;p&gt;🎁 Get the Full 37-Page Architectural Blueprint&lt;br&gt;
Before I even wrote the code for the AEK, I documented every single architectural decision, tradeoff, and pattern into a comprehensive blueprint.&lt;/p&gt;

&lt;p&gt;If you are a technical founder or developer struggling with the initial architecture of your SaaS, you can grab the complete 37-page Architectural Blueprint for free here:&lt;/p&gt;

&lt;p&gt;👉 &lt;a href="https://mahmoudfarouk28.gumroad.com/l/sdmeap" rel="noopener noreferrer"&gt;https://mahmoudfarouk28.gumroad.com/l/sdmeap&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I'd love to hear your thoughts. Have you fallen into the microservices trap early on, or are you team a monolith? Let's discuss in the comments! 👇&lt;/p&gt;

</description>
      <category>java</category>
      <category>springboot</category>
      <category>angular</category>
      <category>architecture</category>
    </item>
  </channel>
</rss>
