Zum Hauptinhalt springen
tsecurity.de LIVE
Echtzeit-Radar & Feeds
Alle RSS Feeds
👥 Community & Social
IT Security NachrichtenKI-Agenten hebeln klassisches IT-Asset-Management aus(24.09.2026 um 07:14 Uhr)
IT Security NachrichtenMicrosoft erneuert Surface Pro und Laptop mit Snapdragon X2 Plus(24.09.2026 um 07:42 Uhr)
IT Security DownloadsGitHub Release: cline/cline vsdk/shared/v0.0.86 (24.09.2026)(24.09.2026 um 07:43 Uhr)
IT Security DownloadsGitHub Release: cline/cline vsdk/llms/v0.0.86 (24.09.2026)(24.09.2026 um 07:43 Uhr)
IT Security DownloadsGitHub Release: cline/cline vsdk/agents/v0.0.86 (24.09.2026)(24.09.2026 um 07:43 Uhr)
IT Security DownloadsGitHub Release: cline/cline vsdk/core/v0.0.86 (24.09.2026)(24.09.2026 um 07:43 Uhr)
IT Security DownloadsGitHub Release: cline/cline vcli-v3.0.65 (24.09.2026)(24.09.2026 um 07:54 Uhr)
IT Security NachrichtenKI-Agenten hebeln klassisches IT-Asset-Management aus(24.09.2026 um 07:14 Uhr)
IT Security NachrichtenMicrosoft erneuert Surface Pro und Laptop mit Snapdragon X2 Plus(24.09.2026 um 07:42 Uhr)
IT Security DownloadsGitHub Release: cline/cline vsdk/shared/v0.0.86 (24.09.2026)(24.09.2026 um 07:43 Uhr)
IT Security DownloadsGitHub Release: cline/cline vsdk/llms/v0.0.86 (24.09.2026)(24.09.2026 um 07:43 Uhr)
IT Security DownloadsGitHub Release: cline/cline vsdk/agents/v0.0.86 (24.09.2026)(24.09.2026 um 07:43 Uhr)
IT Security DownloadsGitHub Release: cline/cline vsdk/core/v0.0.86 (24.09.2026)(24.09.2026 um 07:43 Uhr)
IT Security DownloadsGitHub Release: cline/cline vcli-v3.0.65 (24.09.2026)(24.09.2026 um 07:54 Uhr)
Intelligence View
⚡ tsecurity.de Intelligence

Micro Frontends em Angular: Guia Prático com Module Federation

✍️ Autor e Código-Fonte Este artigo documenta um projeto real e de código aberto. Criado por: Ghabryel Henrique 🐙 GitHub: GhabryelHenrique 💼 LinkedIn: Conecte-se Comigo Explore o código-fonte completo nos repositórios oficiais do p…

0
↗ Quelle (dev.to)
Reagiere als Erste:r — dein Feedback zählt!




✍️ Autor e Código-Fonte



Este artigo documenta um projeto real e de código aberto.





Explore o código-fonte completo nos repositórios oficiais do projeto:








Nos últimos anos, a arquitetura de Micro Frontends (MFE) tem ganhado destaque como solução para times que precisam escalar aplicações frontend de forma independente. Neste artigo, vou mostrar como implementar MFE em Angular usando Module Federation do Webpack 5.






O que são Micro Frontends?



Micro Frontends é um padrão arquitetural que estende os conceitos de microserviços para o frontend. A ideia é dividir uma aplicação monolítica em partes menores e independentes, onde cada time pode desenvolver, testar e fazer deploy de forma autônoma.






Principais Benefícios





  • Autonomia dos times: Cada equipe trabalha em seu próprio repositório e ciclo de deploy


  • Escalabilidade técnica: Diferentes tecnologias e versões podem coexistir


  • Deploy independente: Alterações em um módulo não exigem rebuild de toda aplicação


  • Manutenibilidade: Código mais organizado e com responsabilidades bem definidas






Module Federation: O Game Changer



Module Federation é uma funcionalidade nativa do Webpack 5 que permite compartilhar código entre aplicações JavaScript em tempo de execução, sem precisar recompilar ou fazer bundle novamente.






Como funciona?



O Module Federation divide as aplicações em dois tipos:





  • Host (Shell): Aplicação principal que consome os módulos remotos


  • Remote: Aplicação que expõe módulos para serem consumidos






Implementando na Prática



Vamos criar um exemplo com uma aplicação shell (host) e dois micro frontends remotos.






Passo 1: Configurando o Projeto



Primeiro, vamos usar o @angular-architects/module-federation para facilitar a configuração:




# Instalar o Angular CLI
npm install -g @angular/cli

# Criar workspace
ng new mfe-workspace --create-application=false
cd
mfe-workspace

# Criar aplicações
ng generate application shell --routing --style=scss
ng generate application mfe-products --routing --style=scss
ng generate application mfe-orders --routing --style=scss









Passo 2: Adicionar Module Federation



Instale o plugin em cada aplicação:




# No diretório raiz
ng add @angular-architects/module-federation --project shell --port 4200 --type host
ng add @angular-architects/module-federation --project mfe-products --port 4201 --type remote
ng add @angular-architects/module-federation --project mfe-orders --port 4202 --type remote









Passo 3: Configurar o Remote (mfe-products)



No arquivo webpack.config.js do mfe-products:




const { shareAll, withModuleFederationPlugin } = require('@angular-architects/module-federation/webpack');

module.exports = withModuleFederationPlugin({
name: 'mfeProducts',

exposes: {
'./ProductsModule': './projects/mfe-products/src/app/products/products.module.ts',
},

shared: {
...shareAll({
singleton: true,
strictVersion: true,
requiredVersion: 'auto'
}),
},
});






Crie o módulo de produtos:




// products.module.ts
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { RouterModule, Routes } from '@angular/router';
import { ProductsComponent } from './products.component';

const routes: Routes = [
{
path: '',
component: ProductsComponent
}
];

@NgModule({
declarations: [ProductsComponent],
imports: [
CommonModule,
RouterModule.forChild(routes)
]
})
export class ProductsModule { }









Passo 4: Configurar o Host (Shell)



No arquivo webpack.config.js do shell:




const { shareAll, withModuleFederationPlugin } = require('@angular-architects/module-federation/webpack');

module.exports = withModuleFederationPlugin({
remotes: {
"mfeProducts": "http://localhost:4201/remoteEntry.js",
"mfeOrders": "http://localhost:4202/remoteEntry.js",
},

shared: {
...shareAll({
singleton: true,
strictVersion: true,
requiredVersion: 'auto'
}),
},
});






Configure as rotas no app-routing.module.ts:




import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { loadRemoteModule } from '@angular-architects/module-federation';

const routes: Routes = [
{
path: 'products',
loadChildren: () =>
loadRemoteModule({
type: 'module',
remoteEntry: 'http://localhost:4201/remoteEntry.js',
exposedModule: './ProductsModule'
})
.then(m => m.ProductsModule)
},
{
path: 'orders',
loadChildren: () =>
loadRemoteModule({
type: 'module',
remoteEntry: 'http://localhost:4202/remoteEntry.js',
exposedModule: './OrdersModule'
})
.then(m => m.OrdersModule)
},
{
path: '',
redirectTo: '/products',
pathMatch: 'full'
}
];

@NgModule({
imports: [RouterModule.forRoot(routes)],
exports: [RouterModule]
})
export class AppRoutingModule { }









Passo 5: Configuração Dinâmica



Para ambientes diferentes, crie um arquivo mfe.manifest.json:




{
"mfeProducts": "http://localhost:4201/remoteEntry.js",
"mfeOrders": "http://localhost:4202/remoteEntry.js"
}






Carregue o manifesto dinamicamente:




// main.ts
import { loadManifest } from '@angular-architects/module-federation';

loadManifest('/assets/mfe.manifest.json')
.catch(err => console.error('Error loading manifest', err))
.then(() => import('./bootstrap'))
.catch(err => console.error(err));









Compartilhamento de Estado



Para comunicação entre MFEs, você pode usar diferentes estratégias:






1. Usando RxJS e Services Compartilhados






// shared-state.service.ts
import { Injectable } from '@angular/core';
import { BehaviorSubject, Observable } from 'rxjs';

@Injectable({
providedIn: 'root'
})
export class SharedStateService {
private userSubject = new BehaviorSubject<any>(null);
public user$: Observable<any> = this.userSubject.asObservable();

setUser(user: any): void {
this.userSubject.next(user);
}
}









2. Usando Custom Events






// Emitir evento
window.dispatchEvent(new CustomEvent('user-updated', {
detail: { userId: 123 }
}));

// Ouvir evento
window.addEventListener('user-updated', (event: any) => {
console.log('User updated:', event.detail);
});









Boas Práticas






1. Versionamento



Use semantic versioning para suas bibliotecas compartilhadas:




shared: {
'@angular/core': {
singleton: true,
strictVersion: true,
requiredVersion: '^17.0.0'
}
}









2. Tratamento de Erros



Implemente error boundaries para falhas no carregamento de MFEs:




loadChildren: () =>
loadRemoteModule({
type: 'module',
remoteEntry: 'http://localhost:4201/remoteEntry.js',
exposedModule: './ProductsModule'
})
.then(m => m.ProductsModule)
.catch(err => {
console.error('Error loading module', err);
return import('./fallback/fallback.module').then(m => m.FallbackModule);
})









3. Performance




  • Use lazy loading para carregar MFEs sob demanda

  • Implemente caching strategies para remoteEntry.js

  • Monitore o tamanho dos bundles compartilhados






4. Testes



Configure testes para cada MFE independentemente:




// products.component.spec.ts
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { ProductsComponent } from './products.component';

describe('ProductsComponent', () => {
let component: ProductsComponent;
let fixture: ComponentFixture<ProductsComponent>;

beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ ProductsComponent ]
})
.compileComponents();
});

beforeEach(() => {
fixture = TestBed.createComponent(ProductsComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});

it('should create', () => {
expect(component).toBeTruthy();
});
});









Deploy e CI/CD



Para deploy independente, configure pipelines separados:




# .github/workflows/mfe-products.yml
name: Deploy MFE Products

on:
push:
branches: [ main ]
paths:
- 'projects/mfe-products/**'

jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Setup Node
uses: actions/setup-node@v2
with:
node-version: '18'

- name: Install dependencies
run: npm ci

- name: Build
run: npm run build:mfe-products

- name: Deploy
run: |
# Deploy para seu CDN/Storage
aws s3 sync dist/mfe-products s3://your-bucket/mfe-products









Desafios e Considerações






1. Debugging



Debugging pode ser mais complexo. Use source maps e ferramentas como:




// webpack.config.js
module.exports = {
devtool: 'source-map',
// ...
}









2. Dependências Compartilhadas



Cuidado com o tamanho do bundle. Use o bundle analyzer:




npm install --save-dev webpack-bundle-analyzer









3. Consistência de UI



Crie uma biblioteca de design system compartilhada:




ng generate library ui-components









Conclusão



Module Federation transformou a forma como construímos Micro Frontends em Angular. Com ele, conseguimos:




  • Deploy independente de aplicações

  • Compartilhamento de código em runtime

  • Redução significativa no tamanho dos bundles

  • Maior autonomia para os times



A arquitetura de MFE não é uma bala de prata e adiciona complexidade ao projeto, mas para times grandes trabalhando em aplicações enterprise, os benefícios superam os desafios.






Recursos Úteis








Repositório de Exemplo



Você pode encontrar o código completo deste tutorial no GitHub: [https://github.com/GhabryelHenrique/angular-mfe-example]






O que você achou deste artigo? Já trabalha com Micro Frontends? Compartilhe sua experiência nos comentários!



Se este conteúdo foi útil, não esqueça de dar um ❤️ e compartilhar com outros devs!

SOC Incident Playbook: Remote Code Execution (RCE) Defense
title: Detect Exploitation - Micro Frontends em Angular: Guia Prático com Module Federation
id: a429c839-9156-4560-8159-87cb98fb3ca0
status: experimental
description: Automatisch generierte SIEM-Erkennungsregel basierend auf CTI Intelligence
references:
  - https://tsecurity.de/
author: iShareStuff CTI Automated Detection Engine
date: 2026-09-24
logsource:
  category: network_connection
  product: any
detection:
  selection:
      CommandLine|contains:
        - 'exploit'
  condition: selection
falsepositives:
  - Legitime administrative Zugriffe oder Penetrationstests
level: high
tags:
  - attack.initial_access
rule CTI_Threat_Indicator {
    meta:
        author = "iShareStuff CTI Automated Detection Engine"
        date = "2026-09-24"
        description = "YARA Signature for "
    strings:
        $str = "Micro Frontends em Angular: Gu" ascii wide
    condition:
        any of them
}
tsecurity.de Cognitive Threat RAG
Fokus-Vektor:

Kognitive Analyse für identifizierte Bedrohung: Erhöhte Bedrohungslage im Bereich Micro Frontends em Angular: Guia Prático.... Basierend auf 368k Vektor-Korrelationen werden sofortige Isolationsmaßnahmen für betroffene Endpunkte empfohlen.

🛡️ Angriffsfläche & Exposure

Netzwerk/Remote-Zugriff ohne Vorauthentifizierung möglich.

Empfohlene Sofortmaßnahmen
  • 1. Perimeter-Inspektion: Relevante Portfreigaben und exponierte Endpunkte unverzüglich scannen.
  • 2. Patch-Applikation: Hersteller-Hotfix einspielen oder betroffene Daemons in isolierte DMZ-Segmente überführen.
  • 3. Telemetrie & EDR-Alerts: Prozessaufrufe und Child-Processes auf anomale Shell-Spawns überwachen.
🔗 Semantisch verwandte Zero-Days MariaDB 11.7 VEC
Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten Micro Frontends em Angular: Guia Prático com Module Federation

Thematisch verwandte Begriffe: Micro, Frontends, Angular, Guia · 6 Treffer

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Zum Aktualisieren ziehen
ZERO-DAY CVE-2026-96676 | A vulnerability was identified in Fast FAC1900R 20190827_2.0.2. The impa…
Advisory →
TTS Reader • tsecurity.de Voice
tsecurity.de Icon
tsecurity.de App
Offline-Lesen, Eilmeldungen & 0ms Ladezeit

Installiere tsecurity.de direkt auf deinen Home-Bildschirm für das ultimative Vollbild-Magazinerlebnis ohne Browser-Leisten.

Nächster Beitrag
Themen-Radar & Intelligence Matrix
Echtzeit-Taxonomie nach Angriffsvektoren & Plattformen

tsecurity.de Live Threat Radar

🔴 LIVE RADAR
MONITORING
AKTIV
CVE-DATENBANK
LIVE
🔍
Community Radar & Live Chat
Sentinel Bot online • Live-Stream
Dein Cluster: Security Explorer
Match:
lädt…
Verbindung zum Community-Stream wird aufgebaut...
Bearbeitungsmodus — Senden überschreibt deine Nachricht
Community-Puls — was gerade passiert
lädt…
Aktivitäten deiner Analysten
lädt…
Neues Thema oder Eilmeldung einreichen

Reiche interessante Links, Zero-Days oder Debatten ein. Die Community entscheidet per Upvote über die Veröffentlichung.

Heiß diskutierte Einreichungen
🔖 Gespeicherte Artikel
📂 Keine gespeicherten Artikel vorhanden.
Zurück Ziehen Vor
Links: vorheriger Artikel Rechts: nächster Artikel unten: schließen
News NIS-2 Frühwarnung Tier-1 Intel TTP ⏱️ 3 Min vor 10 Min
Artikeldaten werden geladen...

Zurück: vorheriger Vor: nächster
↗ Original-Quelle
Social Reaktionen Deine Reaktion zählt
Einstufung & Relevanz-Poll 0 Stimmen
In sozialen Netzwerken teilen 1-Klick