Microservices - Detailed Component Mapping
Version: 1.0 Date: August 4, 2026 Purpose: Complete component-to-service mapping with dependencies
π Current Monorepo Component Inventory
π apps/
apps/app (Next.js Application)
Type: Frontend Application (Server-Side Rendered)
Purpose: Admin dashboard & management portal
Size: Large
Dependencies: All shared packages, Auth, Permissions, DB client
Structure:
βββ app/ # Next.js app router
β βββ [lang]/ # Language routing
β β βββ (routes)/
β β β βββ (root)/
β β β β βββ page.tsx # Home/login page
β β β βββ (site)/
β β β βββ [workspace]/
β β β β βββ dashboard/
β β β β β βββ analytics/
β β β β β βββ history/
β β β β β βββ page.tsx
β β β β βββ product/ # Product management CRUD
β β β β βββ order/ # Order management
β β β β βββ members/ # Team member management
β β β β βββ manage/ # Workspace settings
β β β β βββ settings/
β β β β β βββ faq/
β β β β β βββ page.tsx
β β β β βββ subscription/
β β β β βββ layout.tsx
β β β βββ user/ # User management
β β β β βββ [refId]/
β β β β β βββ controls/
β β β β β β βββ media/
β β β β β β βββ page.tsx
β β β β β βββ layout.tsx
β β β β βββ dev/ # Developer tools
β β β β βββ tools/
β β β β βββ client/
β β β β βββ api/
β β β βββ layout.tsx
β βββ auth/ # Auth-related pages
β βββ components/ # React components
β βββ context/ # Context providers
β βββ config/ # Configuration
β βββ db/ # Database queries/utilities
β βββ hooks/ # Custom hooks
β βββ lib/ # Library utilities
β βββ prisma/ # Prisma schema (copy)
β βββ public/ # Static assets
β βββ schemas/ # Validation schemas
β βββ types/ # TypeScript types
β βββ validator/ # Custom validators
Exports:
- None (final application)
Pages/Routes:
- /[lang]/ (root/home)
- /[lang]/(site)/[workspace]/dashboard/analytics
- /[lang]/(site)/[workspace]/dashboard/history
- /[lang]/(site)/[workspace]/product (list/create/edit)
- /[lang]/(site)/[workspace]/order
- /[lang]/(site)/[workspace]/members/manage
- /[lang]/(site)/[workspace]/members/register
- /[lang]/(site)/[workspace]/manage
- /[lang]/(site)/[workspace]/settings/faq
- /[lang]/(site)/[workspace]/subscription
- /[lang]/(site)/user/[refId]/controls/media
Key Components:
- Analytics components (rest-bar, rest-line, rest-pie)
- Product management forms
- Member management UI
- Dashboard layouts
- Settings panelsMigration Plan:
- Extract as Admin Module (MFE - Port 3107)
- Keep existing pages but connect to microservices APIs
- Replace direct DB queries with API calls
- Update
api/folder to use API Gateway
apps/app/ (Next.js Application)
Type: Frontend Application (Public/User-facing)
Purpose: Main e-commerce/store application
Size: Large
Dependencies: All shared packages, Auth, DB client
Structure:
βββ store/ # E-commerce store frontend
β βββ app/
β β βββ [lang]/
β β β βββ (routes)/
β β β β βββ page.tsx # Homepage
β β β β βββ products/
β β β β β βββ [slug]/
β β β β β βββ page.tsx
β β β β βββ cart/
β β β β β βββ page.tsx
β β β β βββ checkout/
β β β β β βββ page.tsx
β β β β βββ account/
β β β β β βββ profile/
β β β β β βββ orders/
β β β β β βββ settings/
β β β β βββ search/
β β β β βββ page.tsx
β β β βββ layout.tsx
β β βββ components/
β β βββ hooks/
β β βββ lib/
β β βββ public/
β β βββ types/
β β βββ utils/
β βββ package.json
β
βββ warehouse/ # Inventory/warehouse management
βββ app/
β βββ [lang]/
β β βββ (routes)/
β β β βββ page.tsx
β β β βββ inventory/
β β β βββ orders/
β β β βββ transfers/
β β β βββ reports/
β β βββ layout.tsx
β βββ components/
β βββ hooks/
β βββ lib/
β βββ public/
βββ package.json
Exports:
- None (final applications)
Key Pages:
- / (homepage with featured products)
- /products (product listing & search)
- /products/[slug] (product detail)
- /cart (shopping cart)
- /checkout (order creation)
- /account/profile (user profile)
- /account/orders (order history)
- /account/orders/[id] (order detail)
- /account/settings (user settings)
- /warehouse/inventory (warehouse staff view)
- /warehouse/orders (warehouse order management)
- /warehouse/transfers (inventory transfers)
Key Components:
- Product card
- Product grid
- Cart summary
- Checkout form
- Order summary
- Payment form
- Inventory displayMigration Plan:
- Store β Product Module (MFE - Port 3104) + Order Module (MFE - Port 3105)
- Warehouse β Separate warehouse app or warehouse-module (MFE - Port 3110)
- Replace DB queries with API Gateway calls
- Implement client-side caching with SWR
apps/app/mobile (React Native/Expo)
Type: Mobile Application
Purpose: Native mobile experience for e-commerce
Size: Medium
Dependencies: Shared packages, Auth, HTTP client
Structure:
βββ app/
β βββ (auth)/
β β βββ login.tsx
β β βββ register.tsx
β β βββ reset-password.tsx
β βββ (app)/
β β βββ home.tsx
β β βββ products.tsx
β β βββ products/[id].tsx
β β βββ cart.tsx
β β βββ checkout.tsx
β β βββ orders.tsx
β β βββ account.tsx
β β βββ settings.tsx
β β βββ layout.tsx
β βββ components/
β βββ hooks/
β βββ lib/
β βββ services/
β βββ types/
β βββ utils/
βββ package.json
Services:
- Auth service (login, logout, token management)
- Product service (fetch products, search)
- Order service (create orders, fetch history)
- User service (profile, settings)
Key Components:
- Product list (FlatList)
- Product detail screen
- Cart management
- Checkout form
- Order history
- Login/Register screensMigration Plan:
- Update API endpoints to point to API Gateway
- Keep existing client-side logic
- Implement offline support with AsyncStorage
- Add push notifications from Notification Service
apps/api (Backend API)
Type: Backend Node.js/Prisma API
Purpose: Current monolithic API serving all frontends
Size: Large
Dependencies: Prisma, MongoDB, HTTP client, crypto
Structure:
βββ src/
β βββ routes/
β β βββ auth.ts
β β βββ users.ts
β β βββ products.ts
β β βββ orders.ts
β β βββ organizations.ts
β β βββ analytics.ts
β β βββ settings.ts
β β βββ index.ts
β βββ middleware/
β β βββ auth.ts
β β βββ cors.ts
β β βββ error-handler.ts
β β βββ rate-limit.ts
β βββ services/
β β βββ auth.service.ts
β β βββ user.service.ts
β β βββ product.service.ts
β β βββ order.service.ts
β β βββ email.service.ts
β β βββ payment.service.ts
β βββ utils/
β β βββ crypto.ts
β β βββ jwt.ts
β β βββ validators.ts
β β βββ helpers.ts
β βββ types/
β β βββ index.ts
β βββ index.ts (main server entry)
βββ prisma/
β βββ schema.prisma
β βββ seed.ts
β βββ migrations/
βββ package.json
βββ tsconfig.json
REST Endpoints (to be decomposed):
- POST /auth/register
- POST /auth/login
- POST /auth/refresh
- GET /users/:id
- PUT /users/:id
- DELETE /users/:id
- GET /products
- POST /products
- GET /products/:id
- PUT /products/:id
- DELETE /products/:id
- GET /orders
- POST /orders
- GET /orders/:id
- PUT /orders/:id/status
- GET /organizations/:id
- POST /organizations
- GET /analytics/dashboard
- GET /settings
- PUT /settings
Exports:
- ./typesMigration Plan:
- DECOMMISSION this monolithic API
- Split into: Auth, User, Product, Order, Organization, Analytics, Settings services
- Each service owns its own endpoints
- API Gateway routes requests to appropriate service
- Remove in Phase 5
apps/docs (Documentation)
Type: Next.js Documentation Site
Purpose: Technical documentation
Size: Small
Dependencies: MDX, UI components
Structure:
βββ app/
β βββ (home)/
β β βββ page.tsx
β βββ docs/
β β βββ [slug]/
β β β βββ page.tsx
β β βββ layout.tsx
β βββ api/
β β βββ search/
β β βββ route.ts
β βββ layout.tsx
β βββ error.tsx
βββ content/ # MDX files
βββ components/
βββ lib/
βββ public/
βββ package.json
Exports:
- None (final application)Migration Plan:
- KEEP AS IS - Separate documentation site
- Update with API reference for new microservices
- Add deployment guides for new architecture
π¦ packages/
@repo/db
Type: Database/ORM Package
Purpose: Prisma client, database schema, seed utilities
Size: Large
Exports:
- Prisma client
- Database seed functions
- Type definitions
- Database utilities
Structure:
βββ prisma/
β βββ schema.prisma # Full database schema
β βββ seed.ts # Seed script
β βββ migrations/ # Migration files
βββ src/
β βββ index.ts # Exports prisma client
β βββ client.ts # Prisma client setup
β βββ seed/
β β βββ auth.ts
β β βββ users.ts
β β βββ products.ts
β β βββ orders.ts
β βββ utils.ts
βββ generated/
β βββ prisma/ # Generated Prisma client
β βββ types/
βββ plugin/
β βββ address/ # Address plugin
βββ scripts/
β βββ generate-types-prisma.ts
βββ package.json
βββ README.md
Current Database:
- MongoDB with Prisma as ORM
- Single database containing all tables
- Tables include: User, Account, Organization, Product, Order, Analytics, etc.
Exports:
- . β prisma client & seed
- ./seed/* β individual seed functions
- ./types β TypeScript definitions
- ./plugin/address β address utilitiesMigration Plan:
- DECOMPOSE into service-specific schemas
- Create separate Prisma instances:
@repo/db-authβ Auth DB schema@repo/db-usersβ Users DB schema@repo/db-productsβ Products DB schema@repo/db-ordersβ Orders DB schema- etc.
- Move schema files to respective services
- Keep utilities as shared package
- Migrate seed functions to service-specific seeds
@repo/auth
Type: Shared Library
Purpose: Authentication utilities (currently mostly empty/shell)
Size: Small
Exports:
- None currently (shell package)
Current Structure:
βββ src/
β βββ index.ts # Empty or minimal exports
βββ package.json
βββ README.md
Peerq Dependencies:
- reactMigration Plan:
- EXPAND & REPURPOSE as Auth Utilities Package
- Add:
- JWT token generation/validation utilities
- Password hashing helpers (bcrypt)
- Session management utilities
- 2FA helpers
- Permission checking utilities
- Keep as shared package for all services to use
- Or move into Auth Service
@repo/core
Type: Shared Utilities Package
Purpose: Core validators, time utilities, business logic
Size: Medium
Exports:
- . β main index
- ./validator
- ./time
- ./time/client
Current Structure:
βββ src/
β βββ index.ts
β βββ validator/
β β βββ Validator.ts # Email, password, phone validators
β β βββ SourceImage.ts
β β βββ Comparison.ts # Data comparison utilities
β β βββ DomainService.ts
β β βββ Safeguard.ts
β β βββ ArrayValidator.ts
β β βββ index.ts
β βββ time/
β β βββ index.ts # Time utilities
β β βββ client/
β β βββ index.ts
β βββ helpers/ # Various helpers
βββ package.json
βββ README.md
Peer Dependencies:
- react
- xuxiMigration Plan:
- KEEP AS SHARED PACKAGE for all services
- Add validators specific to services:
- Product validators
- Order validators
- Organization validators
- Replicate validators in each service for independence
- Or keep centralized and call as dependency
@repo/permissions
Type: Shared RBAC Package
Purpose: Role-based access control
Size: Small
Exports:
- Hooks for permission checking
Current Structure:
βββ src/
β βββ index.ts
β βββ hooks/
β β βββ useRole.ts
β β βββ usePermission.ts
β β βββ useGuard.ts
β βββ utils/
β βββ checkPermission.ts
βββ package.json
βββ README.mdMigration Plan:
- MOVE TO Auth Service as core component
- Update to use microservice-based auth
- Create permissions API endpoint
- Keep light client-side checking for UX
- Centralize permission checking on backend
@repo/helpers
Type: Shared Utilities Package
Purpose: Helper functions (transformers, debounce, etc.)
Size: Small
Current Structure:
βββ src/
β βββ index.ts
β βββ transformer.ts
β βββ debounce.ts
β βββ insert-element.ts
β βββ cookie-store.ts
β βββ ... other helpers
βββ package.json
βββ README.mdMigration Plan:
- KEEP AS SHARED PACKAGE
- Used by both backend services and frontend modules
- Add more helpers as services are extracted
@repo/hooks
Type: React Hooks Library
Purpose: Custom React hooks (useAuth, useFetch, etc.)
Size: Medium
Current Structure:
βββ src/
β βββ index.ts
β βββ useAuth.ts # Authentication hook
β βββ useUser.ts # User data hook
β βββ useFetch.ts # Data fetching hook
β βββ useForm.ts # Form handling hook
β βββ useLocalStorage.ts
β βββ useDebounce.ts
β βββ ... other hooks
βββ package.json
βββ README.mdMigration Plan:
- DISTRIBUTE TO MFE MODULES
- Create hooks in shell module
- Create hooks in respective feature modules
- Or keep as shared package with updated hooks:
useAuth()β calls Auth Module APIuseUser()β calls User Service APIuseProduct()β calls Product Service APIuseOrder()β calls Order Service API
@repo/http-client
Type: HTTP Client Library
Purpose: Axios wrapper for API calls
Size: Small
Current Structure:
βββ lib/
β βββ axios.ts # Axios instance configuration
β βββ interceptors.ts # Request/response interceptors
β βββ retry.ts # Retry logic
βββ src/
β βββ index.ts
β βββ client.ts # HTTP client wrapper
β βββ types.ts
β βββ utils.ts
βββ package.json
βββ README.md
Features:
- Centralized axios configuration
- Request/response interceptors
- Automatic token refresh
- Retry logic
- Error handlingMigration Plan:
- KEEP AS SHARED PACKAGE
- All services and MFE modules use this
- Update to:
- Use API Gateway URL
- Add service-to-service communication features
- Add circuit breaker support
- Add logging/tracing
@repo/i18n
Type: Internationalization Package
Purpose: Multi-language support
Size: Medium
Current Structure:
βββ src/
β βββ index.ts
β βββ locales/
β β βββ en.ts
β β βββ id.ts
β β βββ ... other locales
β βββ hooks/
β β βββ useI18n.ts
β β βββ useTranslate.ts
β βββ utils/
β βββ load-messages.ts
βββ messages/ # Message files
βββ raw/ # Raw message data
βββ script/ # i18n scripts
βββ package.json
Features:
- Multi-language support
- Message loading
- Translation hooks
- Locale managementMigration Plan:
- KEEP AS SHARED PACKAGE
- Used by shell and all MFE modules
- Backend services don't need this (API responses in English)
- Add service-level translations if needed
@repo/components & @repo/ui
Type: UI Component Libraries
Purpose: Reusable React components, design system
Size: Large
Structure:
βββ src/
β βββ components/ # Reusable components
β β βββ Button.tsx
β β βββ Form.tsx
β β βββ Modal.tsx
β β βββ Table.tsx
β β βββ Card.tsx
β β βββ ... many more
β βββ styles.css # Tailwind styles
β βββ index.ts
β βββ types.ts
βββ dist/ # Built components
βββ package.json
βββ README.md
Design System:
- Tailwind CSS based
- Radix UI components
- Custom styled componentsMigration Plan:
- MOVE TO SHELL MODULE
- Shell application becomes design system host
- MFE modules import design system from shell
- Or distribute to each MFE:
- Core UI components in shell
- Feature-specific components in modules
@repo/icons
Type: Icon Library
Purpose: SVG icons
Size: Small
Current Structure:
βββ packages/
β βββ icons/
β β βββ ArrowIcon.tsx
β β βββ CloseIcon.tsx
β β βββ ... many more
β β βββ index.ts
β βββ src/
β βββ package.jsonMigration Plan:
- MOVE TO SHELL MODULE
- Or distribute across MFE modules
- Keep as shared package with imports
@repo/configs/
Type: Configuration Packages
Purpose: Shared configuration (ESLint, TypeScript, CSS, tests)
Size: Small
Includes:
- @repo/configs-eslint
- @repo/configs-typescript
- @repo/configs-css
- @repo/configs-test
- @repo/configs-global-types
Current Structure:
βββ eslint/
β βββ index.js
β βββ next.js
β βββ base.js
βββ typescript/
β βββ base.json
β βββ nextjs.json
βββ css/
β βββ tailwind.config.ts
β βββ postcss.config.js
βββ test/
β βββ jest.config.js
β βββ setup.ts
βββ global-types/
βββ index.ts
βββ ... type definitionsMigration Plan:
- KEEP AS SHARED PACKAGES
- Each service and MFE inherits configuration
- Centralize best practices
- Easy updates across all services
@repo/engines
Type: Business Logic Package
Purpose: Domain-specific business engines
Size: Medium
Current Structure:
βββ src/
β βββ index.ts
β βββ ProductEngine.ts # Product domain logic
β βββ OrderEngine.ts # Order domain logic
β βββ AnalyticsEngine.ts
β βββ PricingEngine.ts
β βββ ... other engines
βββ package.jsonMigration Plan:
- DISTRIBUTE TO SERVICES
- Move ProductEngine to Product Service
- Move OrderEngine to Order Service
- Move AnalyticsEngine to Analytics Service
- Keep general-purpose engines as shared
ποΈ tools/
tools/cli
Type: Command-line tool
Purpose: Development utilities (dev server orchestration)
Size: Small
Structure:
βββ src/
β βββ commands/
β β βββ dev.ts
β β βββ build.ts
β β βββ ... other commands
β βββ core/
β βββ cli.ts
β βββ utils.ts
βββ _test/
βββ package.json
βββ tsconfig.json
Main Commands:
- dev β Start development environment
- build β Build all packages
- lint β Lint codebase
- type-check β Type checking
- ... moreMigration Plan:
- EXPAND CLI TOOL
- Add service-specific commands:
dev:servicesβ Start all microservicesdev:frontendβ Start all MFE modulesservice:logs <name>β View service logsservice:restart <name>β Restart specific servicedb:migrateβ Run migrationsdocker:upβ Start Docker Composedocker:downβ Stop Docker Compose
tools/scripts
Type: Automation scripts
Purpose: Generate exports, migrate data, etc.
Size: Small
Current Scripts:
- generate-exports.ts
- generate-indonesia-regions.ts
- parse-and-split-indonesia-regions.ts
- generate-locale-merge.tsMigration Plan:
- ADD NEW SCRIPTS
- Data migration scripts for each service
- Service setup scripts
- Database seeding scripts
π data/
Type: Data package
Purpose: Shared datasets (seed data)
Size: Small
Current Structure:
βββ src/
β βββ seed-indonesia-regions/
βββ package.json
βββ tsconfig.json
Content:
- Indonesia regions SQL/TypeScript data
- Used for location/address fieldsMigration Plan:
- KEEP AS IS
- Reference in services that need location data
- Or move to Settings Service
π Dependency Graph (Current State)
ββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Frontend Apps β
β ββββββββββββββββ ββββββββββββββββ β
β β main β β app β app/mobile β
β β (Next.js) β β (Next.js) β(React Native)β
β ββββββββ¬ββββββββ ββββββββ¬ββββββββ β
β β β β
β βββββββββββ¬ββββββββ β
β β β
βββββββββββββββββββββΌβββββββββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββ
β Shared Packages β
β β
β ββ @repo/ui β
β ββ @repo/components β
β ββ @repo/hooks β
β ββ @repo/i18n β
β ββ @repo/helpers β
β ββ @repo/http-client β
β ββ @repo/core β
β ββ @repo/auth β
β ββ @repo/permissions β
β ββ @repo/configs/* β
β β
ββββββββββββ¬βββββββββββββ
β
βΌ
βββββββββββββββββββββββββ
β Backend + Database β
β β
β ββββββββββββββββββ β
β β apps/api β β
β β (Monolithic) β β
β ββββββββββ¬ββββββββ β
β β β
β βΌ β
β ββββββββββββββββββββ β
β β @repo/db β β
β β (Prisma + MongoDB) β
β ββββββββββββββββββββ β
β β
βββββββββββββββββββββββββπ Dependency Graph (Target State - Post-Migration)
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Frontend - Micro-Frontends β
β β
β ββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β Shell (Port 3100) β β
β β ββ Layout orchestration β β
β β ββ Module loader β β
β β ββ Global state β β
β β ββ Design system / Icons / Styles β β
β ββββββββββββββ¬ββββββββββββββββββββββββββββββββββββ β
β β β
β βββββββββ΄ββββββββββββββββββββ¬βββββββββββββ β
β β β β β
β ββββββΌββββββ ββββββββββββ ββββββΌβββββ ββββββΌβββ β
β βAuth β βProduct β βOrder β βAdmin β β
β βModule β βModule β βModule β βModule β β
β β(3101) β β(3104) β β(3105) β β(3107) β β
β ββββββ¬ββββββ ββββββββββββ ββββββββ¬βββ βββββββββ β
β β β β
β β βββββββββββββ¬βββββββββββββ β
β β β β β
β ββββββΌβββββΌββββ βββββΌβββββββββ ββββββββββββββ β
β βUser Module β βAnalytics β βOrg Module β β
β β(3102) β βModule β β(3103) β β
β β β β(3106) β β β β
β βββββββββββββββ ββββββββββββββ ββββββββββββββ β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββ
β API Gateway β
β (Port 3000) β
β ββ Routing β
β ββ Auth validation β
β ββ Rate limiting β
β ββ Circuit breakers β
ββββββββββββββββ¬βββββββββββββ
β
βββββββββββββββΌββββββββββββββ¬βββββββββββββ
β β β β
βΌ βΌ βΌ βΌ
ββββββββββββββ ββββββββββββ βββββββββββ ββββββββββββ
βAuth Serviceβ βUser Svc β βOrg Svc β βProduct β
β(3001) β β(3002) β β(3003) β βService β
β β β β β β β(3004) β
βauth_db β βusers_db β βorgs_db β βproducts_ β
β β β β β β βdb β
ββββββββββββββ ββββββββββββ βββββββββββ ββββββββββββ
β
βββββββββββββββΌβββββββββββββ¬βββββββββββββ
βΌ βΌ βΌ βΌ
ββββββββββββββ ββββββββββββ βββββββββββ ββββββββββββ
βOrder β βAnalytics β βSettings β βNotify β
βService β βService β βService β βService β
β(3005) β β(3006) β β(3007) β β(3008) β
β β β β β β β β
βorders_db β βanalytics β βsettings β β(external)β
β β β_db β β_db β β β
ββββββββββββββ ββββββββββββ βββββββββββ ββββββββββββ
β²
β
ββββββββββββ΄βββββββββββββ
β β
βΌ βΌ
ββββββββββββββββββββββββ βββββββββββββββ
β Event Bus / Message β β Redis Cacheβ
β Broker β β (sessions, β
β (Redis/Kafka) β β rate-limit)
β β β β
β - order-created β βββββββββββββββ
β - order-updated β
β - product-viewed β
β - user-registered β
ββββββββββββββββββββββββπ Service-to-Service Dependencies
Auth Service (3001)
Depends On:
- None (independent)
Used By:
- API Gateway (token validation)
- User Service (token validation)
- Organization Service (token validation)
- Product Service (token validation)
- Order Service (token validation)
- Analytics Service (token validation)
- Settings Service (token validation)
- All MFE modules (indirectly via API Gateway)
Provides:
- Token generation & validation
- User authentication
- 2FA functionality
- Password managementUser Service (3002)
Depends On:
- Auth Service (token validation)
Used By:
- Organization Service (get user info)
- Order Service (get user info)
- Analytics Service (user metadata)
- User Module MFE
Provides:
- User profiles
- User settings
- User metadataOrganization Service (3003)
Depends On:
- Auth Service (token validation)
- User Service (user info, membership)
Used By:
- API Gateway (workspace context)
- Product Service (org membership check)
- Order Service (org context)
- Settings Service (org settings)
- Org Module MFE
Provides:
- Organization management
- Member management
- Invitations
- Workspace dataProduct Service (3004)
Depends On:
- Auth Service (token validation)
- Organization Service (org context)
Used By:
- API Gateway
- Order Service (product info, pricing)
- Analytics Service (product views)
- Product Module MFE
- Order Module MFE
Provides:
- Product catalog
- Inventory management
- Product search
- Categories
- PricingOrder Service (3005)
Depends On:
- Auth Service (token validation)
- User Service (user info)
- Product Service (product info, inventory)
Used By:
- API Gateway
- Analytics Service (order events)
- Notification Service (order notifications)
- Order Module MFE
Provides:
- Order creation
- Order management
- Order history
- Order trackingAnalytics Service (3006)
Depends On:
- Event Bus (message stream)
- Auth Service (token validation)
Used By:
- API Gateway
- Analytics Module MFE
- Admin Module MFE
Provides:
- Dashboard metrics
- Reports
- Analytics dataSettings Service (3007)
Depends On:
- Auth Service (token validation)
- Organization Service (org context)
Used By:
- API Gateway
- Admin Module MFE
- All services (feature flags)
Provides:
- System settings
- FAQ management
- Subscription data
- Feature flagsNotification Service (3008)
Depends On:
- Event Bus (message stream)
- External services (SendGrid, Twilio)
Used By:
- Order Service (async notifications)
- User Service (async notifications)
- Auth Service (email confirmations)
Provides:
- Email notifications
- SMS notifications
- Push notificationsπ Data Flow Patterns
Pattern 1: Synchronous Request (User fetches product)
User (Frontend)
β Click "View Product"
βΌ
Product Module MFE
β Fetch /api/products/123
βΌ
API Gateway (Port 3000)
ββ Validate token from Auth Service
βΌ
Product Service (Port 3004)
ββ Check org membership via Organization Service
ββ Query products_db
βΌ
Response JSON
β
MFE displays productPattern 2: Asynchronous Event (User creates order)
User (Frontend)
βΌ Click "Place Order"
βΌ
Order Module MFE
ββ POST /api/orders
βΌ
API Gateway
βΌ
Order Service (Port 3005)
ββ Validate: Product exists? (call Product Service)
ββ Validate: Inventory available? (call Product Service)
ββ Create order in orders_db
ββ Emit "order-created" event to Redis
ββ Return 201 Created
βΌ
Event Bus (Redis) receives "order-created"
ββ Analytics Service subscribes β Update metrics
ββ Notification Service subscribes β Send email
ββ Inventory System subscribes β Reserve stock
βΌ
Analytics updated in real-time
Email sent to user
Inventory reservedPattern 3: Cross-Service Lookup (Order processing)
Order Service processing order
ββ GET /api/users/user123 from User Service
β ββ Validate token
β ββ Call User Service
β ββ Get user info
β ββ Cache in Redis
β
ββ GET /api/products/prod456 from Product Service
β ββ Validate token
β ββ Call Product Service
β ββ Check inventory
β ββ Cache in Redis
β
ββ Combine data
ββ Create order
ββ Return complete orderπ¦ Migration Package Dependencies
Step 1: Extract Shared Core
Dependencies to create first:
β @repo/configs/* (no dependencies)
β @repo/helpers (no dependencies)
β @repo/http-client (minimal dependencies)
β @repo/core (helpers, validators)
β @repo/i18n (locales, utilities)
β @repo/permissions (helpers)
β @repo/auth (core, helpers)Step 2: Services Foundation
β API Gateway (http-client, helpers)
β Auth Service (auth, core, helpers, http-client)
β User Service (http-client, helpers, core)
β Organization Service (http-client, helpers, core)Step 3: Business Services
β Product Service (http-client, helpers, core, auth)
β Order Service (http-client, helpers, core, product, user)
β Analytics Service (http-client, helpers)Step 4: Support Services
β Settings Service (http-client, helpers, core)
β Notification Service (http-client, helpers)Step 5: Micro-Frontends
β Shell (ui, components, icons, i18n, helpers, hooks, http-client)
β Auth Module (shell, http-client, hooks, auth)
β Product Module (shell, http-client, hooks)
β Order Module (shell, http-client, hooks)
β User Module (shell, http-client, hooks)
β Organization Module (shell, http-client, hooks)
β Analytics Module (shell, http-client, hooks)
β Admin Module (shell, http-client, hooks, permissions)Summary
This mapping document provides:
- Complete Component Inventory - All current code organized by type and location
- Export Analysis - What each package/app exports
- Dependency Graph - Current vs. target state
- Data Flow Patterns - How components interact
- Migration Sequencing - Order to extract services
- Service Distribution - Where code should live post-migration
The blueprint and this mapping work together to guide a systematic, low-risk migration from monorepo to microservices + micro-frontend architecture.
Document Version: 1.0 Last Updated: August 4, 2026 Audience: Development team, architects, tech leads