Tổng quan kiến trúc
High-level Architecture
Port Registry
| Port | Module | MFE Key | Base Path |
|---|---|---|---|
| 8080 | Container | — | / |
| 8081 | Dashboard | dashboard | /dashboard |
| 8082 | Auth | auth | /auth |
| 8083 | Content | content | /content |
| 8084 | Inventory | inventory | /inventory |
| 8085 | Analytics | analytics | /analytics |
| 8086 | Role-Permission | rolePermission | /role-permission |
| 8087 | Sale Manage | saleManage | /sale-manage |
| 8088 | Setting | setting | /setting |
| 8089 | Workforce | workforce | /workforce |
| 8090 | (Marketing) | (chưa triển khai) | /marketing |
| 8091 | E-Invoice | electronicInvoice | /e-invoice |
| 8092 | Payment | payment | /payment |
| 8093 | CRM | crm | /crm |
| 8094 | Mobile | mobile | /mobile |
| 8095 | Partner | partner | /partner |
| 8096 | Accounting | accounting | /accounting |
| 8097 | E-Signature | eSignature | /e-signature |
thông tin
Port 8090 được dự trữ cho module Marketing (chưa triển khai). Toàn bộ registry được định nghĩa tại apps/container/src/config/mfeRegistry.ts.
Stack tổng thể
Frontend
- React 18 + TypeScript cho UI
- Vite 7 +
@module-federation/vitecho build & MFE runtime - Tailwind CSS v4 với custom theme (
core/src/styles/theme.css)
State & Data
- Redux Toolkit cho global state (auth, store selection)
- RTK Query cho server state (API caching, auto-refetch)
- React Hook Form + Zod cho form management
Monorepo tooling
- pnpm workspaces:
apps/*+core - Turborepo: parallel builds, caching, task dependencies
@vppos/core: shared UI, hooks, utils, types — tất cả modules import từ đây
Infrastructure
- Docker multi-stage builds (1 Dockerfile per MFE)
- Kubernetes deployments (1 pod per MFE)
- Nginx reverse proxy
- GitLab CI/CD pipeline
Luồng request (Production)
Nguyên tắc thiết kế
- Module Independence: Mỗi MFE là 1 ứng dụng độc lập, có thể build & deploy riêng
- Shared Nothing (gần như): Chỉ share React, ReactDOM, Router, Redux qua Module Federation
singleton - Core Library: UI components, hooks, utils chung nằm trong
@vppos/core— build-time dependency, không phải runtime - Single Source of Truth: Route config, MFE registry, permissions đều khai báo tại Container
- Convention over Configuration: Tất cả modules tuân theo cùng folder structure, naming convention, coding patterns