# belaczek/nx-federation-repro architecture

> Architecture diagram of the GitHub repository belaczek/nx-federation-repro, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-05). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/belaczek/nx-federation-repro
- Repository: https://github.com/belaczek/nx-federation-repro

## Overview

##### Main Components Identification
The system consists of three main applications:
- Host Application (acme-host)
- Remote Application 1 (acme-remote)
- Remote Application 2 (acmeRemoteTwo)

##### Connection Flows
- Exposed modules/components flow

##### Technical Details
- Webpack Module Federation configuration details
- Shared dependencies from the module-federation.base.config.ts
- Build-time vs. Runtime loading indicators
- TypeScript configuration relationships

##### Additional Elements
- Development tools section (Nx workspace configuration)
- Build/Deploy pipeline indicators
- Environment-specific configurations (development vs. production)

Key Considerations:
- Keep the Module Federation architecture as the primary focus
- Clear boundaries between applications
- Shared module management
- Dynamic loading capabilities
- Build-time vs. runtime separation

##### Application boundaries and communication paths

This will provide a comprehensive view of how the applications interact while maintaining the necessary level of detail for understanding the system's architecture.

Remember to include version information and any specific Nx workspace configurations that affect the overall architecture.

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Host["Host Application"]
        direction TB
        HostApp["acme-host"]:::host
        HostMain["main.ts"]:::entry
        HostWebpack["webpack.config.ts"]:::config
        HostMF["module-federation.config.ts"]:::config
        HostRoot["app.tsx"]:::component
        
        HostApp --> HostMain
        HostApp --> HostWebpack
        HostApp --> HostMF
        HostMain --> HostRoot
    end

    subgraph Remotes["Remote Applications"]
        direction TB
        subgraph Remote1["Remote Application 1"]
            direction TB
            Remote1App["acme-remote"]:::remote
            Remote1Main["main.ts"]:::entry
            Remote1Entry["remote-entry.ts"]:::entry
            Remote1Webpack["webpack.config.ts"]:::config
            Remote1MF["module-federation.config.ts"]:::config
            Remote1Root["app.tsx"]:::component
            
            Remote1App --> Remote1Main
            Remote1App --> Remote1Entry
            Remote1App --> Remote1Webpack
            Remote1App --> Remote1MF
            Remote1Main --> Remote1Root
        end

        subgraph Remote2["Remote Application 2"]
            direction TB
            Remote2App["acmeRemoteTwo"]:::remote
            Remote2Main["main.ts"]:::entry
            Remote2Entry["remote-entry.ts"]:::entry
            Remote2Webpack["webpack.config.ts"]:::config
            Remote2MF["module-federation.config.ts"]:::config
            Remote2Root["app.tsx"]:::component
            
            Remote2App --> Remote2Main
            Remote2App --> Remote2Entry
            Remote2App --> Remote2Webpack
            Remote2App --> Remote2MF
            Remote2Main --> Remote2Root
        end
    end

    subgraph Shared["Shared Configuration"]
        direction TB
        BaseMF["module-federation.base.config.ts"]:::shared
        TSConfig["tsconfig.base.json"]:::config
        NxConfig["nx.json"]:::config
        PackageJSON["package.json"]:::config
    end

    Host -.->|Federation| Remote1
    Host -.->|Federation| Remote2
    Shared --> Host
    Shared --> Remote1
    Shared --> Remote2

    %% Click events for components
    click HostApp "https://github.com/belaczek/nx-federation-repro/tree/main/apps/acme-host/"
    click HostMain "https://github.com/belaczek/nx-federation-repro/blob/main/apps/acme-host/src/main.ts"
    click HostWebpack "https://github.com/belaczek/nx-federation-repro/blob/main/apps/acme-host/webpack.config.ts"
    click HostMF "https://github.com/belaczek/nx-federation-repro/blob/main/apps/acme-host/module-federation.config.ts"
    click HostRoot "https://github.com/belaczek/nx-federation-repro/blob/main/apps/acme-host/src/app/app.tsx"
    
    click Remote1App "https://github.com/belaczek/nx-federation-repro/tree/main/apps/acme-remote/"
    click Remote1Main "https://github.com/belaczek/nx-federation-repro/blob/main/apps/acme-remote/src/main.ts"
    click Remote1Entry "https://github.com/belaczek/nx-federation-repro/blob/main/apps/acme-remote/src/remote-entry.ts"
    click Remote1Webpack "https://github.com/belaczek/nx-federation-repro/blob/main/apps/acme-remote/webpack.config.ts"
    click Remote1MF "https://github.com/belaczek/nx-federation-repro/blob/main/apps/acme-remote/module-federation.config.ts"
    click Remote1Root "https://github.com/belaczek/nx-federation-repro/blob/main/apps/acme-remote/src/app/app.tsx"
    
    click Remote2App "https://github.com/belaczek/nx-federation-repro/tree/main/apps/acmeRemoteTwo/"
    click Remote2Main "https://github.com/belaczek/nx-federation-repro/blob/main/apps/acmeRemoteTwo/src/main.ts"
    click Remote2Entry "https://github.com/belaczek/nx-federation-repro/blob/main/apps/acmeRemoteTwo/src/remote-entry.ts"
    click Remote2Webpack "https://github.com/belaczek/nx-federation-repro/blob/main/apps/acmeRemoteTwo/webpack.config.ts"
    click Remote2MF "https://github.com/belaczek/nx-federation-repro/blob/main/apps/acmeRemoteTwo/module-federation.config.ts"
    click Remote2Root "https://github.com/belaczek/nx-federation-repro/blob/main/apps/acmeRemoteTwo/src/app/app.tsx"
    
    click BaseMF "https://github.com/belaczek/nx-federation-repro/blob/main/module-federation.base.config.ts"
    click TSConfig "https://github.com/belaczek/nx-federation-repro/blob/main/tsconfig.base.json"
    click NxConfig "https://github.com/belaczek/nx-federation-repro/blob/main/nx.json"
    click PackageJSON "https://github.com/belaczek/nx-federation-repro/blob/main/package.json"

    %% Styling
    classDef host fill:#2196F3,stroke:#1976D2,color:white
    classDef remote fill:#4CAF50,stroke:#388E3C,color:white
    classDef entry fill:#FF9800,stroke:#F57C00,color:white
    classDef config fill:#9C27B0,stroke:#7B1FA2,color:white
    classDef component fill:#607D8B,stroke:#455A64,color:white
    classDef shared fill:#E91E63,stroke:#C2185B,color:white

    %% Legend
    subgraph Legend
        direction TB
        L1[Host Application]:::host
        L2[Remote Application]:::remote
        L3[Entry Points]:::entry
        L4[Configuration]:::config
        L5[Components]:::component
        L6[Shared Modules]:::shared
    end
```
