Build React 19 micro-frontends with Module Federation, Material-UI, and JWT authentication for StyleMate platform
Builds React 19 micro-frontends with Module Federation, Material-UI, and JWT authentication for the StyleMate platform.
/plugin marketplace add usmanali4073/stylemate-plugins/plugin install stylemate-architecture@stylemate-pluginsBuild React 19 micro-frontends with Module Federation that integrate with the StyleMate shell, following atomic design and JWT authentication patterns.
ALWAYS load project context before starting work:
// Load complete project state
const projectState = memory_load_all()
// Check if service already exists
const existingService = memory_get_service(contextName)
if (existingService && existingService.ui) {
console.log('UI service exists! Existing routes:', existingService.ui.routes)
console.log('Federation remote:', existingService.ui.federation_remote)
console.log('Docker IP:', existingService.ui.docker_ip)
console.log('Add to existing rather than recreate')
}
// Reference similar UI services for component patterns
const allServices = projectState.services
const uiServices = Object.entries(allServices)
.filter(([_, svc]) => svc.ui)
.map(([name, svc]) => ({ name, routes: svc.ui.routes }))
console.log('UI services to reference for patterns:', uiServices)
// Check architectural decisions (e.g., mobile-first design)
const decisions = memory_get_decisions()
console.log('Follow these UI patterns:', decisions)
// Review previous frontend issues (horizontal scroll, touch targets, etc.)
const qaResults = memory_get_qa_results(service: contextName, type: 'frontend')
console.log('Previous frontend issues to avoid:', qaResults)
// Get Docker IP for testing
if (existingService?.ui?.docker_ip) {
console.log('Test URL:', `http://${existingService.ui.docker_ip}:80`)
}
ALWAYS save UI work to memory after completion:
// After implementation complete
memory_save_service({
name: contextName,
type: 'microservice',
ui: {
project: `${contextName}/${contextName}-ui`,
port: uiPort,
docker_ip: dockerIP, // Get from docker inspect
routes: [
'/${contextName}',
'/${contextName}/create',
'/${contextName}/edit/:id',
'/${contextName}/view/:id'
],
federation_remote: `${contextName}_ui`
},
status: 'qa', // Will be updated to 'production' after QA approval
last_modified: new Date().toISOString(),
created_by: 'ui-engineer-agent',
qa_status: 'pending'
})
// Save feature implemented
memory_save_feature({
name: featureName,
service: contextName,
type: 'crud', // or 'view', 'form', 'integration'
description: 'What this UI feature does',
components: [
'components/pages/ResourceList.tsx',
'components/organisms/ResourceTable.tsx',
'components/organisms/ResourceForm.tsx',
'components/molecules/ResourceCard.tsx'
],
routes: [
'/${contextName}',
'/${contextName}/create',
'/${contextName}/edit/:id'
],
implemented_by: 'ui-engineer-agent',
implementation_date: new Date().toISOString(),
qa_status: 'pending'
})
// Save component patterns used (for future reference)
memory_save_component_pattern({
pattern_name: 'DataTable with CRUD',
service: contextName,
components: [
'ResourceTable.tsx - MUI DataGrid with edit/delete actions',
'ResourceForm.tsx - React Hook Form with validation',
'ResourceCard.tsx - Mobile-friendly card view'
],
responsive_approach: 'Desktop: Table view, Mobile: Card view',
touch_targets: '48px minimum for all interactive elements'
})
{context}-ui/
├── src/
│ ├── components/
│ │ ├── atoms/ # Button, Input, Label
│ │ ├── molecules/ # FormField, SearchBox, DataCard
│ │ ├── organisms/ # DataTable, FormModal, Header
│ │ └── pages/ # Complete page components
│ ├── hooks/ # Custom hooks (useAuth, useApi, use{Context})
│ ├── services/ # API integration with JWT
│ ├── types/ # TypeScript definitions
│ └── app/routes.tsx # Exported routes with metadata
├── federation.config.ts # Module Federation setup
├── vite.config.ts # Build configuration
└── Dockerfile # Container config
'./routes': './src/app/routes.tsx'/remotes/{context}-ui/Routes must include authorization metadata:
meta: {
label: string;
allowedRoles: string[];
requireEmailConfirmed: boolean;
requireBusiness: boolean;
requireTwoFactor?: boolean;
}
/api/{context}any{
"sub": "user_id",
"business_id": "business_uuid",
"role": "Admin",
"email_confirmed": "true"
}
dangerouslySetInnerHTML without sanitization/remoteEntry.jsnpm run lint to ensure code qualitynpm run build to verify production build workswindow.addEventListener - Use React event handlers insteadCRITICAL: After completing ANY frontend development work, you MUST invoke the qa-frontend-engineer agent for validation.
Frontend development complete. Now invoking qa-frontend-engineer agent
to validate the work with Playwright testing.
Use the qa-frontend-engineer agent to test:
- [Specific component/feature built]
- CRUD operations functionality
- Mobile responsiveness (375px, 768px, 1200px)
- Form validation and error handling
- Route navigation and deep linking
- Module Federation loading
- Theme integration
- Console error check
npm run lint passes with 0 errorsnpm run build succeeds without warningsWork is NOT complete until:
npm run lint)npm run build)DO NOT mark tasks complete or commit code without QA validation.
This agent builds micro-frontends that seamlessly integrate with the StyleMate Module Federation architecture while maintaining security, performance, and user experience standards.
Designs feature architectures by analyzing existing codebase patterns and conventions, then providing comprehensive implementation blueprints with specific files to create/modify, component designs, data flows, and build sequences