npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@yaagoub/federation-tools

v1.3.1

Published

**FederationTools** is a lightweight utility library designed to simplify **environment variables**, **assets**, and **internationalization (i18n)** management across **Angular micro-frontend architectures** (Module Federation / Native Federation).

Readme

FederationTools

FederationTools is a lightweight utility library designed to simplify environment variables, assets, and internationalization (i18n) management across Angular micro-frontend architectures (Module Federation / Native Federation).

It provides a single, consistent API that works across the shell and all remote MFEs, without iframes and without leaking configuration to window.


📦 Installation

Add the library to your workspace:

npm install @yaagoub/federation-tools

📁 Project Structure (Shell)

The shell application acts as the single source of truth for:

  • environment variables
  • translations
  • asset origins

Recommended structure:

└── 📁settings
    ├── 📁env
    │   └── env.json                # Shell environment variables
    │
    ├── 📁i18n
    │   ├── en.json                 # English translations
    │   └── ar.json                 # Arabic translations
    │
    └── 📁manifest
        ├── 📁assets
        │   └── assets.manifest.json
        │       {
        │         "shell": "http://localhost:4200",
        │         "mfe1":  "http://localhost:4201",
        │         "mfe2":  "http://localhost:4202"
        │       }
        │
        ├── 📁env
        │   └── env.manifest.json
        │       {
        │         "shell": "http://localhost:4200",
        │         "mfe1":  "http://localhost:4201",
        │         "mfe2":  "http://localhost:4202"
        │       }
        │
        └── 📁i18n
            └── i18n.manifest.json
                {
                  "shell": "http://localhost:4200",
                  "mfe1":  "http://localhost:4201",
                  "mfe2":  "http://localhost:4202"
                }

for remotes Recommended structure:

└── 📁settings
    ├── 📁env
    │   └── env.json                # mfe environment variables
    │
    ├── 📁i18n
    │   ├── en.json                 # English translations
    │   └── ar.json                 # Arabic translations

Each manifest defines where to fetch data from for each micro frontend.


⚙️ Development Configuration (Angular)

During development, expose the manifests and settings using the Angular assets configuration:

"development": {
  "assets": [
    {
      "glob": "**/*",
      "input": "projects/lkhedma/public"
    },
    {
      "glob": "env.manifest.json",
      "input": "projects/../src/settings/manifest/env",
      "output": "."
    },
    {
      "glob": "assets.manifest.json",
      "input": "projects/../src/settings/manifest/assets",
      "output": "."
    },
    {
      "glob": "i18n.manifest.json",
      "input": "projects/../src/settings/manifest/i18n",
      "output": "."
    },
    {
      "glob": "**/*",
      "input": "projects/../src/settings/i18n",
      "output": "i18n"
    },
    {
      "glob": "env.json",
      "input": "projects/../src/settings/env",
      "output": "."
    }
  ],
  "optimization": false,
  "extractLicenses": false,
  "sourceMap": true
}

💡 In production, these files are typically served by the shell (CDN, Nginx, or gateway).


🔌 Shell Providers Setup

Register the FederationTools providers once in the shell application:

provideFederationAsset(),
provideFederationEnv(),
provideFederationTranslation('en') // default language

These providers automatically:

  • load manifests
  • fetch remote data
  • cache results
  • expose a unified API to all MFEs

🖼️ Federated Assets

Use assets from any MFE by prefixing the asset name with the micro frontend key.

<img [asset]="'mfe1:logo.png'" />

Supported elements

The asset directive works with:

  • img
  • video
  • audio
  • iframe
  • source
  • a
  • object

The prefix (mfe1) must exist in assets.manifest.json.


🌍 Internationalization (i18n)

FederationTools provides a federated translation system shared across all MFEs.

Template usage

{{ 'home.title' | translate }}

Programmatic usage

import { inject } from '@angular/core';
import { TranslationService } from '@yaagoub/federation-tools';

const translationService = inject(TranslationService);

translationService.translate('home.title');

Translations are:

  • loaded lazily
  • merged across shell + MFEs
  • automatically updated when the language changes

Waiting for environment initialization

import { from } from 'rxjs';
import { waitForFederationEnv } from '@yaagoub/federation-tools';

from(waitForFederationEnv('mfe1')).subscribe(env => {
  // Safe access to federated environment variables
});

Key guarantees

  • ✔️ Shell loads the environment first
  • ✔️ MFEs wait safely for availability
  • ✔️ Immutable, frozen configuration
  • ✔️ No global leaks