How holypug1274/marketplace works
The Marketplace project is a monorepo Angular web application for a mock e-commerce store built with Angular 16+ (using Standalone Components), Angular Material, Nx, and NgRx. Its primary function is to provide a multi-faceted front-end experience (including authentication, a dashboard, and a web store with various e-commerce features) with micro-frontend components managed via module federation.
Main Architectural Components
a. Frontend Applications:
• Auth – Handles user authentication flows and possibly acts as a gateway for logging in.
• Dashboard – Provides a user dashboard that may include administrative or user-specific views.
• Canadian Registry – (Appears to be another application module, possibly catering to a specific region or function.)
• Web Store – The primary application for navigating the mock e-commerce store.
b. Micro-Frontend & Module Federation:
• Each of the above applications uses module federation (as indicated by “module-federation.config.js” files) to share components and functionality among different apps.
c. Libraries (libs folder):
• Data Access Layers – Under “libs/web-store/data-access” are libraries for handling API interactions and state for different domains such as products, basket, checkout, home, success, and shared concerns.
• Feature Modules – Under “libs/web-store/feature” you see features for basket, checkout, home, and success. These encapsulate business logic and interact with the data access libraries.
• UI Components – Under “libs/web-store/ui” there are multiple UI libraries (e.g., header, footer, input-text, billing-address-form, payment-details-form, product-card, product-summary-table, shipping-address-form) that provide reusable visual components across your micro frontends.
d. Testing & E2E:
• Separate E2E projects exist for multiple apps (e.g., “apps/auth-e2e”, “apps/dashboard-e2e”, “apps/web-store-e2e”) which facilitate end-to-end testing.
• Jest configurations and test setup files in individual apps and libs indicate a robust unit testing strategy.
e. Build & Deployment Artifacts:
• The production folder shows the built/compiled assets for different applications, evidencing separate build processes per micro-frontend.
• Configuration files (webpack.config.js, webpack.prod.config.js) show custom build pipelines, likely tied to module federation.
Relationships and Interactions
• Each frontend application acts as a consumer and provider of remote modules (micro frontends) via module federation. For example, the Auth and Dashboard apps each have their own module federation configuration, and they import remote components (such as “remote-entry” modules) from shared libraries.
• The Web Store app is largely composed by integrating several UI component libraries, feature modules for e-commerce functionalities (basket, checkout, etc.), and data-access libraries which encapsulate state management concerns using NgRx.
• There is a clear separation of concerns between presentation (UI components), business logic (feature modules and state management), and data persistence/API interactions (data-access libs).
• E2E tests connect with these front-end modules, ensuring the interactions via simulated user actions are validated.
Architectural Patterns & Design Principles
• Micro-frontend Architecture via module federation enables independent deployment and code splitting across Auth, Dashboard, and Web Store modules.
• Nx Monorepo Organization: Encourages sharing of code (libs) across multiple applications, enabling consistency and reuse.
• Layered Architecture:
• Presentation Layer: Angular components (organized per application and UI libraries).
• Domain/Feature Layer: Features like basket, checkout, home, and success encapsulated in dedicated libs.
• Data Access Layer: API and state management libraries.
• Reactive State Management: NgRx is used to manage state and interactions within complex e-commerce flows.