How alan2207/e-shop-with-mf works
Main Components
• Main Application Shell – Acts as the central container. It “glues” all the micro frontends together. It is built with Next.js and handles routing and layout.
• Products Application – Manages and displays the products list and product detail pages with functionality to add products.
• Cart Application – Manages user cart state and related interactions.
• Checkout Application – Handles the user checkout process.
• Home Application – Displays the e-commerce home page with a Vue.js-based UI.
• Shared Package – Contains utilities, API clients (for example, the API client for the FakeStore API), state management helpers, and other shared functionality available to all micro frontends.
• External API Layer – The FakeStore API (https://fakestoreapi.com/) which supplies product data.
Relationships and Interactions
• The Main application acts as the shell that loads the individual micro frontends via Webpack Module Federation.
• Each micro frontend (Products, Cart, Checkout, Home) is an independent module running on a distinct port during development and deployed separately in production.
• A shared library/package is used by the micro frontends to centralize common code, which may include API communications (like API client calls to FakeStore API), utility functions, and even state management hooks.
• Data flows from the external FakeStore API into the Products app, and then through interactions (e.g., “add to cart”) into the Cart and Checkout applications.
• Communication between these micro frontends might be handled via public APIs exposed through Module Federation and by leveraging the shared library.
Architectural Patterns and Design Principles
• Micro Frontend Architecture: Each application (or microservice) is developed, built, and deployed independently yet composed together at runtime.
• Module Federation: Uses Webpack Module Federation to share code and load remote modules dynamically.
• Separation of Concerns: The monorepo structure clearly separates each application’s code with its own configuration, pages, and components – while also sharing common code via the “packages/shared” module.
• Technology Stack: Next.js is used for most apps (Main, Products, Cart, Checkout) while Vue.js is used for the Home app; TypeScript underpins the code for type safety; styling is consistent with Tailwind CSS.
Final Detailing
• Configuration or deployment notes (like how production assets might be hosted on a CDN) if relevant to the overall system design.
• Mention that each micro frontend is self-contained with its own ESLint configurations, TailwindCSS, and build scripts, reinforcing the independence of each module.
• Optionally, include a small inset showing the overall deployment strategy (as depicted by the Deployment Overview in the README) which indicates the server for Main, cloud storage/CDN for micro frontends, and how the shared library could be deployed via NPM or included in the monorepo.