<?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: Alberto Martinez</title>
    <description>The latest articles on DEV Community by Alberto Martinez (@alberto_martinez).</description>
    <link>https://dev.to/alberto_martinez</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%2F3212911%2Fb655d981-7dd9-4ba1-a103-c960ec6acbbf.jpg</url>
      <title>DEV Community: Alberto Martinez</title>
      <link>https://dev.to/alberto_martinez</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/alberto_martinez"/>
    <language>en</language>
    <item>
      <title>Building a Modular Architecture with Microservices, Microfrontends, and a Local Shell App</title>
      <dc:creator>Alberto Martinez</dc:creator>
      <pubDate>Tue, 27 May 2025 07:09:22 +0000</pubDate>
      <link>https://dev.to/alberto_martinez/building-a-modular-architecture-with-microservices-microfrontends-and-a-local-shell-app-3m13</link>
      <guid>https://dev.to/alberto_martinez/building-a-modular-architecture-with-microservices-microfrontends-and-a-local-shell-app-3m13</guid>
      <description>&lt;p&gt;canonical_url: &lt;a href="https://medium.com/@albe.mtz/building-a-modular-architecture-with-microservices-microfrontends-and-a-local-shell-app-9cf2d99e5773" rel="noopener noreferrer"&gt;https://medium.com/@albe.mtz/building-a-modular-architecture-with-microservices-microfrontends-and-a-local-shell-app-9cf2d99e5773&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Originally published in Medium: &lt;a href="https://medium.com/@albe.mtz/building-a-modular-architecture-with-microservices-microfrontends-and-a-local-shell-app-9cf2d99e5773" rel="noopener noreferrer"&gt;link&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;In a cloud-dominated era, modern infrastructure solutions often rely on external services, centralized configurations, and tightly coupled ecosystems. However, not every development environment benefits from or requires that dependency.&lt;/p&gt;

&lt;p&gt;This article explores a modular, autonomous, and locally hosted alternative based on a &lt;strong&gt;Shell App&lt;/strong&gt; that orchestrates microservices and microfrontends within a private network.&lt;/p&gt;

&lt;p&gt;This approach is ideal for developers seeking a fully functional, offline-ready environment—perfect for labs, controlled testing, and low-cost deployments using mini PCs or home servers.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is a Shell App and How Does It Work?
&lt;/h2&gt;

&lt;p&gt;The &lt;strong&gt;Shell App&lt;/strong&gt; is a containerized application acting as the backbone of the system. It integrates various frontend and backend modules while acting as a single point of entry for both users and internal services.&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Route Management
&lt;/h3&gt;

&lt;p&gt;The Shell App detects available modules via a central database or dynamic config file, then uses reverse proxy logic to route incoming requests to their respective services. This allows a single domain (e.g., &lt;code&gt;app.local&lt;/code&gt;) to dynamically serve content from multiple internal modules.&lt;/p&gt;

&lt;p&gt;Routing is powered by &lt;code&gt;http-proxy-middleware&lt;/code&gt;, enabling clean delegation of paths like &lt;code&gt;/api/users&lt;/code&gt; or &lt;code&gt;/dashboard&lt;/code&gt; to containers without directly exposing their ports.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. JWT Authentication
&lt;/h3&gt;

&lt;p&gt;It handles all incoming JWT tokens, verifying:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Signature validity&lt;/li&gt;
&lt;li&gt;Token expiration&lt;/li&gt;
&lt;li&gt;Role or permission claims&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;On login, the Shell App issues the token to the frontend, ensuring secure, stateless sessions.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Serving Microfrontends
&lt;/h3&gt;

&lt;p&gt;Instead of a monolithic UI, the Shell App dynamically loads microfrontends based on active modules. This is achieved via:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Dynamic JS imports from sibling containers&lt;/li&gt;
&lt;li&gt;Webpack Module Federation (or similar alternatives)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The Shell App injects these microfrontends into a shared UI shell, allowing the UI to scale independently with backend capabilities.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Module Registry via Central Database
&lt;/h3&gt;

&lt;p&gt;The Shell App queries a local database (PostgreSQL or SQLite) to check which modules are active, their ports, routes, and capabilities. This registry enables:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Dynamic route mapping&lt;/li&gt;
&lt;li&gt;Error handling for inactive services&lt;/li&gt;
&lt;li&gt;Status dashboards for module availability&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The registry can be maintained manually, via service discovery scripts, or using container metadata.&lt;/p&gt;

&lt;h2&gt;
  
  
  General Architecture
&lt;/h2&gt;

&lt;p&gt;The architecture consists of loosely coupled, containerized services communicating over an internal network:&lt;/p&gt;

&lt;h3&gt;
  
  
  🧠 CORE Shell App
&lt;/h3&gt;

&lt;p&gt;The orchestrator for all routes, UIs, and security. It’s the access gateway, API proxy, and dynamic loader of all frontend content.&lt;/p&gt;

&lt;h3&gt;
  
  
  🎨 Microfrontends
&lt;/h3&gt;

&lt;p&gt;Each module has its own independently built UI. These are loaded on-demand into the Shell App, ensuring teams can work in isolation and update without affecting others.&lt;/p&gt;

&lt;h3&gt;
  
  
  ⚙️ Microservices (Backends)
&lt;/h3&gt;

&lt;p&gt;Each functional area (e.g., users, metrics, auth) is handled by a dedicated service, often with its own language, database, and API interface. They connect through well-defined HTTP routes proxied by the Shell App.&lt;/p&gt;

&lt;h3&gt;
  
  
  🗄️ Central Database
&lt;/h3&gt;

&lt;p&gt;Maintains system-wide configuration: active modules, routes, status, and shared resources like tokens or user roles.&lt;/p&gt;

&lt;h3&gt;
  
  
  📦 Docker Containers
&lt;/h3&gt;

&lt;p&gt;Each part of the system—frontends, backends, databases—is isolated in its own container. Networking is managed via Docker or K3s, and modules only expose necessary ports internally.&lt;/p&gt;

&lt;h2&gt;
  
  
  Use Case: Local Network Deployment
&lt;/h2&gt;

&lt;p&gt;This system is deployed on a physical Linux machine (such as a mini PC), running &lt;code&gt;docker compose&lt;/code&gt; or &lt;code&gt;k3s&lt;/code&gt; (lightweight Kubernetes).&lt;/p&gt;

&lt;p&gt;The Shell App exposes HTTPS using self-signed certificates and can be accessed from any local device using internal DNS names like &lt;code&gt;dashboard.local&lt;/code&gt; or &lt;code&gt;auth.local&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;This brings major benefits:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Full control over the environment and data&lt;/li&gt;
&lt;li&gt;No reliance on public cloud&lt;/li&gt;
&lt;li&gt;Low hardware requirements&lt;/li&gt;
&lt;li&gt;Perfect for test environments, offline labs, or secure dev spaces&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Benefits and Limitations
&lt;/h2&gt;

&lt;h3&gt;
  
  
  ✅ Advantages
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Real modularity: plug-and-play services&lt;/li&gt;
&lt;li&gt;Easy local scaling and maintenance&lt;/li&gt;
&lt;li&gt;Secure and offline-capable by design&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  ⚠️ Limitations
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Requires Docker/Kubernetes knowledge&lt;/li&gt;
&lt;li&gt;Setup can be complex without a GUI&lt;/li&gt;
&lt;li&gt;Not optimized for public deployment without hardened security&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;This architecture proves it’s entirely possible to create a modern, modular, and functional DevOps environment without the cloud.&lt;/p&gt;

&lt;p&gt;Using standard tools like Docker, Kubernetes, and TLS, you can build a complete platform ready for testing, development, or private deployment.&lt;/p&gt;

&lt;p&gt;Coming next: we'll explore automating this environment with Terraform and Dev Containers, as well as integration with tools like Grafana, Portainer, and distributed databases.&lt;/p&gt;

</description>
      <category>devops</category>
      <category>kubernetes</category>
      <category>docker</category>
      <category>microservices</category>
    </item>
  </channel>
</rss>
