How contentstack/micro-frontend-example works
Project type and purpose
• This is a micro-frontend example showcasing a container (“restaurant”) app that dynamically loads a “pizza-app” micro-frontend.
• The container hosts two menu sections (“sandwich” directly and “pizza” via micro-frontend).
• Uses React, webpack, Docker+Nginx, and Docker Compose to orchestrate both apps side by side.
File structure
• Top-level:
· .github/workflows files for CI (CodeQL, policy, SCA, secrets)
· docker-compose.yaml to spin up both services
• “restaurant” directory (container app)
· Dockerfile + nginx.conf to serve built assets
· src/app: container’s React entry, micro-frontend loader, portal target for breadcrumbs
· microfrontends.ts: maps micro-frontend names to remote URLs
• “pizza-app” directory (micro-frontend)
· Dockerfile + nginx.conf, bundle served on port 8081
· src/app: React components for pizza menu, uses React Portal to render breadcrumbs in container
· src/lib: Redux store configuration, micro-frontend metadata context
• Common patterns
· Both use webpack.config.js to produce vendor.js and app bundles
· SCSS for styling, index.html templates
README for additional insights
• Confirms container runs on localhost:8080, micro-frontend on localhost:8081
• Explains React Portal usage for rendering breadcrumbs outside the micro-frontend frame
• Suggests using docker-compose up for quick startup