Skip to content

Angular MFE Prerequisites & Environment Setup | Complete Guide

Before diving into Angular Micro Frontend development, let’s ensure your development environment is properly configured with all the necessary tools and dependencies.

Node.js is the foundation for Angular development and npm package management.

Option A: Direct Download

Terminal window
# Visit https://nodejs.org and download LTS version
# Install the downloaded package

Option B: Using NVM (Recommended)

Unix/macOS:

Terminal window
# Install NVM (Node Version Manager)
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
# Restart terminal or source profile
source ~/.bashrc
# Install and use Node.js 18
nvm install 18
nvm use 18
nvm alias default 18

Windows:

Terminal window
# Step 1: Download and install nvm for Windows from:
Start-Process "https://github.com/coreybutler/nvm-windows/releases/latest/download/nvm-setup.exe"
# Step 2: Install Node.js version 18
nvm install 18
# Step 3: Use Node.js version 18 for current session
nvm use 18
# Step 4: Set Node.js version 18 as default
nvm alias default 18

Option C: Using Package Managers

Windows:

Terminal window
# Using Chocolatey
choco install nodejs
# Using Winget
winget install OpenJS.NodeJS
# Using Scoop
scoop install nodejs

macOS:

Terminal window
# Using Homebrew
brew install node

Ubuntu/Debian:

Terminal window
curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash -
sudo apt-get install -y nodejs
Terminal window
node --version # Should show v18.x.x or later
npm --version # Should show 8.x.x or later

The Angular CLI is essential for creating, building, and managing Angular applications.

Terminal window
# Install Angular CLI globally
npm install -g @angular/cli@latest
# Verify installation
ng version
Terminal window
Angular CLI: 17.x.x
Node: 18.x.x
Package Manager: npm 8.x.x
OS: [your-operating-system]
Terminal window
# Uninstall old version
npm uninstall -g @angular/cli
# Clear cache
npm cache clean --force
# Install latest version
npm install -g @angular/cli@latest

Version control is crucial for managing multiple MFE repositories.

Windows:

Terminal window
# Option 1: Download from official website
Start-Process "https://git-scm.com/download/win"
# Option 2: Using Chocolatey
choco install git
# Option 3: Using Winget
winget install Git.Git

macOS:

Terminal window
# Using Homebrew
brew install git
# Using Xcode Command Line Tools
xcode-select --install

Ubuntu/Debian:

Terminal window
sudo apt-get install git
Terminal window
git config --global user.name "Your Name"
git config --global user.email "bnarayan.sharma@outlook.com"
# Verify configuration
git config --list
  1. Create GitHub account at https://github.com
  2. Generate SSH key for secure access:

Unix/macOS:

Terminal window
# Generate SSH key
ssh-keygen -t ed25519 -C "bnarayan.sharma@outlook.com"
# Start SSH agent
eval "$(ssh-agent -s)"
# Add SSH key to agent
ssh-add ~/.ssh/id_ed25519
# Copy public key to clipboard
cat ~/.ssh/id_ed25519.pub

Windows:

Terminal window
# Generate SSH key
ssh-keygen -t ed25519 -C "bnarayan.sharma@outlook.com"
# Start SSH agent (in PowerShell as Administrator)
Start-Service ssh-agent
Set-Service -Name ssh-agent -StartupType Manual
# Add SSH key to agent
ssh-add $env:USERPROFILE\.ssh\id_ed25519
# Copy public key to clipboard
Get-Content $env:USERPROFILE\.ssh\id_ed25519.pub | Set-Clipboard
  1. Add SSH key to GitHub:

    • Go to GitHub → Settings → SSH and GPG keys
    • Click “New SSH key”
    • Paste your public key
  2. Test SSH connection:

Terminal window
ssh -T git@github.com

VS Code provides excellent Angular development support with extensions.

Terminal window
# Install extensions using VS Code command palette (Ctrl+Shift+P)
# or install via command line:
code --install-extension Angular.ng-template
code --install-extension ms-vscode.vscode-typescript-next
code --install-extension bradlc.vscode-tailwindcss
code --install-extension ms-vscode.vscode-json
code --install-extension esbenp.prettier-vscode
code --install-extension ms-vscode.vscode-eslint
  • Angular Language Service: IntelliSense for Angular templates
  • TypeScript Importer: Auto import TypeScript modules
  • Prettier: Code formatting
  • ESLint: Code linting
  • GitLens: Enhanced Git capabilities
  • Bracket Pair Colorizer: Better code readability
  • Auto Rename Tag: Rename paired HTML tags
  • Angular Snippets: Code snippets for Angular

Terminal window
# Verify npm installation
npm --version
# Update npm to latest version
npm install -g npm@latest
Terminal window
# Install Yarn globally
npm install -g yarn
# Verify installation
yarn --version
Terminal window
# Webpack will be installed per project
# But you can install CLI globally for debugging
npm install -g webpack-cli

For deploying to Azure Static Web Apps:

  1. Visit https://azure.microsoft.com/free/
  2. Sign up for free account (includes $200 credit)
  3. Verify email and complete setup

Windows:

Terminal window
# Option 1: Download MSI installer
Start-Process "https://learn.microsoft.com/en-us/cli/azure/install-azure-cli-windows"
# Option 2: Using Chocolatey
choco install azure-cli
# Option 3: Using Winget
winget install Microsoft.AzureCLI

macOS:

Terminal window
# Using Homebrew
brew install azure-cli

Ubuntu/Debian:

Terminal window
curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash
Terminal window
# Login to Azure account
az login
# Verify login
az account show
Terminal window
# Install Static Web Apps CLI
npm install -g @azure/static-web-apps-cli
# Verify installation
swa --version

🔧 Development Environment Configuration

Section titled “🔧 Development Environment Configuration”
  • Windows Terminal (Recommended): Install from Microsoft Store
  • PowerShell 7+: Download from GitHub releases
  • Git Bash: Included with Git installation
  • Use default terminal or install iTerm2 (macOS) or Terminator (Linux)

Create a global environment file for common environment variables:

Unix/macOS:

Terminal window
# Create global environment file
touch ~/.env
# Add common variables
echo "NODE_ENV=development" >> ~/.env
echo "ANGULAR_CLI_ANALYTICS=false" >> ~/.env

Windows:

Terminal window
# Create global environment file
New-Item -Path $env:USERPROFILE\.env -ItemType File -Force
# Add common variables
Add-Content -Path $env:USERPROFILE\.env -Value "NODE_ENV=development"
Add-Content -Path $env:USERPROFILE\.env -Value "ANGULAR_CLI_ANALYTICS=false"
# Alternative: Set system environment variables
[Environment]::SetEnvironmentVariable("NODE_ENV", "development", "User")
[Environment]::SetEnvironmentVariable("ANGULAR_CLI_ANALYTICS", "false", "User")

Configure npm for better performance and security:

Unix/macOS/Windows:

Terminal window
# Set npm registry (optional)
npm config set registry https://registry.npmjs.org/
# Disable analytics
npm config set analytics false
# Set cache location (optional)
npm config set cache ~/.npm-cache

Windows (PowerShell alternative):

Terminal window
# Set npm registry (optional)
npm config set registry https://registry.npmjs.org/
# Disable analytics
npm config set analytics false
# Set cache location (Windows-specific path)
npm config set cache "$env:USERPROFILE\.npm-cache"

These will be installed per project, but good to know:

Terminal window
# Core Module Federation packages
@angular-architects/module-federation
webpack
webpack-cli
@angular-builders/custom-webpack

Common dev dependencies for MFE projects:

Terminal window
# TypeScript
typescript
@types/node
# Testing
@angular/testing
jasmine
karma
# Linting
eslint
@typescript-eslint/parser
@typescript-eslint/eslint-plugin
# Build tools
@angular-devkit/build-angular

Run these commands to verify your setup:

Create a verification script:

Unix/macOS (check-environment.sh):

#!/bin/bash
echo "=== Angular MFE Environment Check ==="
echo ""
echo "Node.js version:"
node --version
echo "NPM version:"
npm --version
echo "Angular CLI version:"
ng version --skip-git
echo "Git version:"
git --version
echo "Azure CLI version:"
az --version | head -1
echo "VS Code version:"
code --version | head -1
echo ""
echo "=== Environment Check Complete ==="

Windows (check-environment.ps1):

Terminal window
Write-Host "=== Angular MFE Environment Check ===" -ForegroundColor Blue
Write-Host ""
Write-Host "Node.js version:" -ForegroundColor Green
node --version
Write-Host "NPM version:" -ForegroundColor Green
npm --version
Write-Host "Angular CLI version:" -ForegroundColor Green
ng version --skip-git
Write-Host "Git version:" -ForegroundColor Green
git --version
Write-Host "Azure CLI version:" -ForegroundColor Green
az --version | Select-Object -First 1
Write-Host "VS Code version:" -ForegroundColor Green
code --version | Select-Object -First 1
Write-Host ""
Write-Host "=== Environment Check Complete ===" -ForegroundColor Blue

Running the script:

Unix/macOS:

Terminal window
chmod +x check-environment.sh
./check-environment.sh

Windows:

Terminal window
# Enable script execution (run as Administrator if needed)
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
# Run the script
.\check-environment.ps1
ToolMinimum VersionRecommended
Node.js18.0.018.17.0+
NPM8.0.09.0.0+
Angular CLI15.0.017.0.0+
Git2.20.02.40.0+
VS Code1.70.0Latest

Unix/macOS:

Terminal window
# Solution: Configure npm to use different directory
mkdir ~/.npm-global
npm config set prefix '~/.npm-global'
# Add to ~/.bashrc or ~/.zshrc
export PATH=~/.npm-global/bin:$PATH
# Reload shell
source ~/.bashrc

Windows:

Terminal window
# Solution: Configure npm to use different directory
New-Item -Path "$env:USERPROFILE\.npm-global" -ItemType Directory -Force
npm config set prefix "$env:USERPROFILE\.npm-global"
# Add to PATH environment variable
$currentPath = [Environment]::GetEnvironmentVariable("Path", "User")
$newPath = "$env:USERPROFILE\.npm-global;$currentPath"
[Environment]::SetEnvironmentVariable("Path", $newPath, "User")
# Restart PowerShell for changes to take effect
Terminal window
# Clear npm cache
npm cache clean --force
# Remove existing Angular CLI
npm uninstall -g @angular/cli
# Reinstall with specific version
npm install -g @angular/cli@latest
Terminal window
# Test SSH connection
ssh -T git@github.com
# If issues, regenerate SSH key
ssh-keygen -t ed25519 -C "bnarayan.sharma@outlook.com" -f ~/.ssh/id_ed25519_new
# Add new key to SSH agent
ssh-add ~/.ssh/id_ed25519_new
Terminal window
# Reset VS Code extensions
code --list-extensions
code --uninstall-extension <extension-id>
code --install-extension <extension-id>

Unix/macOS:

Terminal window
# Increase Node.js memory limit
export NODE_OPTIONS="--max-old-space-size=8192"
# Enable Angular CLI completion
ng completion bash >> ~/.bashrc # or ~/.zshrc
source ~/.bashrc

Windows:

Terminal window
# Increase Node.js memory limit
[Environment]::SetEnvironmentVariable("NODE_OPTIONS", "--max-old-space-size=8192", "User")
# Enable Angular CLI completion (PowerShell)
ng completion powershell | Out-String | Invoke-Expression
# Add to PowerShell profile for persistence
ng completion powershell >> $PROFILE
Terminal window
# Use npm ci for faster installs in CI/CD
npm ci
# Enable parallel installs
npm config set fund false
npm config set audit false


Once your environment is set up and verified:

  1. Environment Setup Complete
  2. ➡️ Continue to: Project Setup - Creating repositories and initial project structure
  3. 📚 Learn More: Review Angular MFE Introduction if you haven’t already

Your development environment is now ready for Angular Micro Frontend development! 🚀