Micro-Frontend & Microservices Architecture
π― Architecture Philosophyβ
"Right-sized services, not micro for micro's sake"
EduPulse follows a pragmatic microservices approach - we split services based on:
- Team ownership - Who maintains it?
- Deployment frequency - How often does it change?
- Scaling needs - Does it need independent scaling?
- Technology requirements - Does it need a different tech stack?
π₯οΈ Micro-Frontend Architectureβ
Why Micro-Frontends?β
| Benefit | EduPulse Context |
|---|---|
| Independent Deployments | Update Fee module without touching SIS |
| Team Autonomy | HR team owns HR MFE completely |
| Technology Flexibility | AI features can use different libs |
| Scalability | Heavy dashboards load independently |
MFE Strategy: Module Federationβ
We use Webpack Module Federation with Next.js for:
- Runtime integration (not build-time)
- Shared dependencies (React, UI library)
- Independent versioning
ποΈ Shell & Child MFE Breakdownβ
Shell Application (Host)β
The Shell MFE is the orchestrator that handles cross-cutting concerns.
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β SHELL MFE (Host) β
β edupulse-shell.vercel.app β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β SHELL RESPONSIBILITIES β β
β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββ βββββββββββββββ€ β
β β β’ Authentication & Session Management β β
β β β’ Global Navigation (Sidebar, Header, Breadcrumbs) β β
β β β’ Tenant Context Provider β β
β β β’ Theme Provider (Light/Dark mode) β β
β β β’ Global Error Boundary β β
β β β’ Notification System (Toast, Alerts) β β
β β β’ Permission Context (RBAC) β β
β β β’ Analytics Wrapper β β
β β β’ PWA Service Worker β β
β β β’ Global Search β β
β β β’ User Profile & Settings β β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β SHELL LAYOUT β β
β β ββββββββββββ¬ββββββββββββββββββββββββββββββββββββββββββββββββββββ β β
β β β β Header (User, Notifications, School Switcher) β β β
β β β βββββββββββββββββββββββββββββββββββββββββββββββββββββ€ β β
β β β Sidebar β β β β
β β β (Nav) β REMOTE MFE CONTAINER β β β
β β β β (Dynamic Loading Zone) β β β
β β β β β β β
β β β β β β β
β β ββββββββββββ΄ββββββββββββββββββββββββββββββββββββββββββββββββββββ β β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Shell MFE Tech Stackβ
// shell/package.json
{
"name": "@edupulse/shell",
"dependencies": {
"next": "15.x",
"@module-federation/nextjs-mf": "^8.x",
"@tanstack/react-query": "^5.x",
"zustand": "^5.x", // Global state
"@edupulse/ui": "workspace:*", // Shared UI library
"next-auth": "^5.x" // Authentication
}
}
Shell Shared Exportsβ
// shell/src/shared/index.ts - Exposed to all MFEs
export { AuthProvider, useAuth } from './auth';
export { TenantProvider, useTenant } from './tenant';
export { ThemeProvider, useTheme } from './theme';
export { PermissionGate, usePermissions } from './permissions';
export { useNotification } from './notifications';
export { apiClient } from './api-client';
export { queryClient } from './query-client';
Child MFE Breakdownβ
We have 6 Child MFEs organized by domain and team ownership:
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β CHILD MFEs (Remotes) β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β β
β βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ β
β β MFE-CORE β β MFE-ACADEMIC β β MFE-FINANCE β β
β β (SIS + Admin) β β (Learning) β β (Fees + HR) β β
β βββββββββββββββββββ€ βββββββββββββββββββ€ βββββββββββββββββββ€ β
β β β’ Dashboard β β β’ Timetable β β β’ Fee Config β β
β β β’ Students β β β’ Attendance β β β’ Invoices β β
β β β’ Admissions β β β’ Gradebook β β β’ Payments β β
β β β’ Classes β β β’ Exam Results β β β’ Reports β β
β β β’ Documents β β β’ Report Cards β β β’ HR/Staff β β
β β β’ Settings β β β’ Assignments β β β’ Payroll β β
β β β β β’ Curriculum β β β’ Leave Mgmt β β
β βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ β
β β
β βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ β
β β MFE-AI β β MFE-PORTAL β β MFE-OPS β β
β β (AI Features) β β (Public/User) β β (Operations) β β
β βββββββββββββββββββ€ βββββββββββββββββββ€ βββββββββββββββββββ€ β
β β β’ AI Tutor β β β’ Parent Portal β β β’ Transport β β
β β β’ Doubt Snap β β β’ Student Portalβ β β’ Assets/Lab β β
β β β’ Exam Predict β β β’ Teacher Portalβ β β’ Library β β
β β β’ Question Gen β β β’ Admission Formβ β β’ Wellness β β
β β β’ Analytics β β β’ Fee Payment β β β’ Events β β
β β β’ Chatbots β β β’ Alumni β β β’ Notices β β
β βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ β
β β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
MFE Detailsβ
1. MFE-Core (SIS & Administration)β
| Attribute | Value |
|---|---|
| Package | @edupulse/mfe-core |
| Team | Core Platform |
| EPICs | EPIC-1, EPIC-2, EPIC-3 |
| Deployment | Daily |
| Size | Large (~150 components) |
Modules:
/dashboard- Admin dashboard, widgets, quick actions/students- Student CRUD, search, bulk actions/admissions- Inquiry, applications, enrollment/classes- Class/section management, promotions/documents- Document management, verification/settings- School settings, academic year, configurations
2. MFE-Academic (Teaching & Learning)β
| Attribute | Value |
|---|---|
| Package | @edupulse/mfe-academic |
| Team | Academic Team |
| EPICs | EPIC-7 |
| Deployment | Weekly |
| Size | Medium (~80 components) |
Modules:
/timetable- Schedule builder, room allocation/attendance- Mark attendance, reports, biometric sync/gradebook- Marks entry, grade calculation/exams- Exam scheduling, seating, hall tickets/report-cards- Generate, customize, print/assignments- Create, submit, grade
3. MFE-Finance (Fees & HR)β
| Attribute | Value |
|---|---|
| Package | @edupulse/mfe-finance |
| Team | Finance Team |
| EPICs | EPIC-4, EPIC-5 |
| Deployment | Weekly |
| Size | Medium (~100 components) |
Modules:
/fees- Fee structure, invoices, collections/payments- Online payments, receipts/reports- Financial reports, outstanding dues/hr- Staff management, profiles/payroll- Salary processing, payslips/leave- Leave applications, approvals
4. MFE-AI (AI-Powered Features)β
| Attribute | Value |
|---|---|
| Package | @edupulse/mfe-ai |
| Team | AI/ML Team |
| EPICs | EPIC-6, EPIC-8, EPIC-9 |
| Deployment | Bi-weekly |
| Size | Medium (~60 components) |
| Special | Uses Python backend |
Modules:
/tutor- AI tutoring chat interface/doubt-snap- Camera capture, OCR, solution/predictor- Exam prediction dashboard/question-gen- AI question paper generator/analytics- AI-powered insights/chatbots- Admission, support chatbots
5. MFE-Portal (User-Facing Portals)β
| Attribute | Value |
|---|---|
| Package | @edupulse/mfe-portal |
| Team | Product Team |
| EPICs | EPIC-3, EPIC-4, EPIC-13 |
| Deployment | Weekly |
| Size | Medium (~70 components) |
| Special | Public pages, SEO optimized |
Modules:
/parent- Parent dashboard, child tracking/student- Student self-service/teacher- Teacher dashboard, quick actions/admission- Public admission form/pay- Fee payment gateway/alumni- Alumni network, events
6. MFE-Ops (Operations)β
| Attribute | Value |
|---|---|
| Package | @edupulse/mfe-ops |
| Team | Operations Team |
| EPICs | EPIC-10, EPIC-11, EPIC-12 |
| Deployment | Monthly |
| Size | Small (~50 components) |
Modules:
/transport- Route management, tracking/assets- Inventory, lab equipment/library- Book management, issue/return/wellness- Health records, counseling/events- Event calendar, registrations/notices- Notice board, circulars
MFE Routing Strategyβ
// shell/src/app/layout.tsx
const MFE_ROUTES = {
// MFE-Core
'/dashboard': 'mfe-core/Dashboard',
'/students': 'mfe-core/Students',
'/admissions': 'mfe-core/Admissions',
'/classes': 'mfe-core/Classes',
// MFE-Academic
'/timetable': 'mfe-academic/Timetable',
'/attendance': 'mfe-academic/Attendance',
'/gradebook': 'mfe-academic/Gradebook',
'/exams': 'mfe-academic/Exams',
// MFE-Finance
'/fees': 'mfe-finance/Fees',
'/payments': 'mfe-finance/Payments',
'/hr': 'mfe-finance/HR',
'/payroll': 'mfe-finance/Payroll',
// MFE-AI
'/ai-tutor': 'mfe-ai/Tutor',
'/doubt-snap': 'mfe-ai/DoubtSnap',
'/predictor': 'mfe-ai/Predictor',
// MFE-Portal
'/parent-portal': 'mfe-portal/Parent',
'/student-portal': 'mfe-portal/Student',
'/teacher-portal': 'mfe-portal/Teacher',
// MFE-Ops
'/transport': 'mfe-ops/Transport',
'/assets': 'mfe-ops/Assets',
'/library': 'mfe-ops/Library',
};
Shared UI Libraryβ
All MFEs share a common UI library:
// packages/ui/src/index.ts
export * from './components/Button';
export * from './components/Input';
export * from './components/Table';
export * from './components/DataGrid';
export * from './components/Form';
export * from './components/Modal';
export * from './components/Card';
export * from './components/Charts';
// ... 50+ components
export * from './layouts/PageLayout';
export * from './layouts/FormLayout';
export * from './layouts/ListLayout';
export * from './hooks/useDebounce';
export * from './hooks/useInfiniteScroll';
export * from './hooks/useMediaQuery';
π§ Microservices Architectureβ
Service Count Strategyβ
"6-8 services is the sweet spot for a team of 8-12 developers"
| Approach | Services | Pros | Cons |
|---|---|---|---|
| Monolith | 1 | Simple | Hard to scale, deploy |
| Mini-services | 3-4 | Easy to manage | Limited flexibility |
| Right-sized β | 6-8 | Balanced | Our choice |
| Micro | 15+ | Very flexible | Complex, overhead |
EduPulse Service Breakdown: 7 Servicesβ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β MICROSERVICES ARCHITECTURE β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β β
β βββββββββββββββββββ β
β β API GATEWAY β β
β β (Kong / AWS) β β
β ββββββββββ¬βββββββββ β
β β β
β ββββββββββββββββββββββββββββΌβββββββββββββββββββββββββββ β
β β β β β
β βΌ βΌ βΌ β
β βββββββββββββββββββ βββ ββββββββββββββββ βββββββββββββββββββ β
β β AUTH SERVICE β β SIS SERVICE β β FINANCE SERVICE β β
β β (Node.js) β β (Node.js) β β (Node.js) β β
β βββββββββββββββββββ€ βββββββββββββββββββ€ βββββββββββββββββββ€ β
β β β’ Cognito β β β’ Students β β β’ Fee Config β β
β β β’ JWT/Sessions β β β’ Admissions β β β’ Invoices β β
β β β’ RBAC β β β’ Classes β β β’ Reports β β
β β β’ Audit Logs β β β’ Documents β β β’ HR/Staff β β
β β β’ Encryption β β β’ Promotions β β β’ Leave β β
β βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ β
β β
β βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ β
β β ACADEMIC SERVICEβ β AI SERVICE β β OPS SERVICE β β
β β (Node.js) β β (Python) β β (Node.js) β β
β βββββββββββββββββββ€ βββββββββββββββββββ€ βββββββββββββββββββ€ β
β β β’ Timetable β β β’ AI Tutor β β β’ Transport β β
β β β’ Attendance β β β’ Exam Predict β β β’ Assets β β
β β β’ Gradebook β β β’ Doubt Snap β β β’ Library β β
β β β’ Exams β β β’ Question Gen β β β’ Wellness β β
β β β’ Report Cards β β β’ Analytics β β β’ Events β β
β βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ β
β β
β βββββββββββββββββββ β
β β ENGINE SERVICE β β
β β (Go) β β
β βββββββββββββββββββ€ β
β β β’ Payment Proc β β
β β β’ Finance Engineβ β
β β β’ Attendance Engβ β
β β β’ Notifications β β
β β β’ Real-time β β
β βββββββββββββββββββ β
β β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Service Detailsβ
Service 1: Auth Service (Node.js)β
| Attribute | Value |
|---|---|
| Language | Node.js/TypeScript |
| Framework | NestJS |
| Database | PostgreSQL (shared) |
| EPICs | EPIC-2 |
| Team | Platform |
Responsibilities:
- Cognito integration
- JWT token management
- Session management
- RBAC/Permissions
- Audit logging
- Data encryption/decryption service
- DPDPA compliance
API Prefix: /api/v1/auth/*
Service 2: SIS Service (Node.js)β
| Attribute | Value |
|---|---|
| Language | Node.js/TypeScript |
| Framework | NestJS |
| Database | PostgreSQL |
| EPICs | EPIC-3 |
| Team | Core |
Responsibilities:
- Student management
- Guardian management
- Admission workflow
- Class/Section management
- Document management
- Transfer certificates
- Promotion/Transfer
API Prefix: /api/v1/sis/*
Service 3: Finance Service (Node.js)β
| Attribute | Value |
|---|---|
| Language | Node.js/TypeScript |
| Framework | NestJS |
| Database | PostgreSQL |
| EPICs | EPIC-4, EPIC-5 |
| Team | Finance |
Responsibilities:
- Fee structure configuration
- Invoice generation
- Payment tracking
- Financial reports
- HR/Staff management
- Leave management
- Payroll configuration
API Prefix: /api/v1/finance/*, /api/v1/hr/*
Service 4: Academic Service (Node.js)β
| Attribute | Value |
|---|---|
| Language | Node.js/TypeScript |
| Framework | NestJS |
| Database | PostgreSQL |
| EPICs | EPIC-7 |
| Team | Academic |
Responsibilities:
- Timetable management
- Attendance (mark, reports)
- Gradebook
- Exam management
- Report card generation
- Curriculum management
API Prefix: /api/v1/academic/*
Service 5: AI Service (Python)β
| Attribute | Value |
|---|---|
| Language | Python |
| Framework | FastAPI |
| Database | PostgreSQL + Qdrant |
| EPICs | EPIC-6, EPIC-8, EPIC-9 |
| Team | AI/ML |
Responsibilities:
- AI Tutor conversations
- Doubt Snap (OCR + solution)
- Board Exam prediction
- Question generation
- AI-powered analytics
- RAG pipelines
- Claude API integration
API Prefix: /api/v1/ai/*
Service 6: Ops Service (Node.js)β
| Attribute | Value |
|---|---|
| Language | Node.js/TypeScript |
| Framework | NestJS |
| Database | PostgreSQL |
| EPICs | EPIC-10, EPIC-11, EPIC-12, EPIC-13 |
| Team | Operations |
Responsibilities:
- Transport management
- Asset/Inventory management
- Library management
- Wellness/Health records
- Event management
- Alumni network
API Prefix: /api/v1/ops/*
Service 7: Engine Service (Go)β
| Attribute | Value |
|---|---|
| Language | Go |
| Framework | Gin |
| Database | PostgreSQL |
| EPICs | EPIC-4, EPIC-5 (critical paths) |
| Team | Platform |
Responsibilities:
- Payment gateway processing
- Double-entry finance engine
- Attendance engine (biometric sync)
- Notification dispatcher
- Real-time sync (WebSocket)
- Background job processing
- Event sourcing
API Prefix: /api/v1/engine/*
Service Communicationβ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β SERVICE COMMUNICATION PATTERNS β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ βββββββββββββ€
β β
β SYNCHRONOUS (REST/gRPC) β
β ββββββββββββββββββββββββ β
β β’ User-facing API calls β
β β’ Auth validation β
β β’ Real-time data fetches β
β β
β Frontend ββRESTβββΊ Node.js Services ββgRPCβββΊ Go Engine β
β ββRESTβββΊ Python AI β
β β
β ASYNCHRONOUS (Message Queue) β
β ββββββββββββββββββββββββββββ β
β β’ Notifications (SMS, Email, Push) β
β β’ Bulk operations β
β β’ AI processing β
β β’ Event sourcing β
β β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β MESSAGE QUEUE (Redis + NATS) β β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β² β² β² β² β² β
β β β β β β β
β ββββ΄βββ βββββ΄ββββ βββββ΄ββββ βββββ΄ββββ βββββ΄ββββ β
β βAuth β β SIS β βFinanceβ β AI β βEngine β β
β βββββββ βββββββββ βββββββββ βββββββββ βββββββββ β
β β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Database Strategyβ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β DATABASE STRATEGY β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β β
β SHARED DATABASE (Phase 1: 0-100K users) β
β ββββββββββββββββββββββββββββββββββββββββ β
β β’ Single PostgreSQL instance β
β β’ Schema-per-tenant (tenant_id in every table) β
β β’ Simpler operations, easier debugging β
β β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β PostgreSQL (Single Instance) β β
β β βββββββββββ βββββββββββ βββββββββββ βββββββββββ βββββββββββ β β
β β β auth β β sis β β finance β βacademic β β ops β β β
β β β schema β β schema β β schema β β schema β β schema β β β
β β βββββββββββ βββββββββββ βββββββββββ βββββββββββ βββββββββββ β β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β
β DATABASE-PER-SERVICE (Phase 2: 100K+ users) β
β βββββββββββββββββββββββββββββββββββββββββββ β
β β’ Separate databases for critical services β
β β’ Finance gets dedicated instance β
β β’ AI gets dedicated instance + Qdrant β
β β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
π Repository Structureβ
Monorepo with Turborepoβ
edupulse/
βββ apps/
β βββ shell/ # Shell MFE (Host)
β βββ mfe-core/ # Core MFE
β βββ mfe-academic/ # Academic MFE
β βββ mfe-finance/ # Finance MFE
β βββ mfe-ai/ # AI MFE
β βββ mfe-portal/ # Portal MFE
β βββ mfe-ops/ # Ops MFE
β
βββ services/
β βββ auth-service/ # Node.js Auth
β βββ sis-service/ # Node.js SIS
β βββ finance-service/ # Node.js Finance
β βββ academic-service/ # Node.js Academic
β βββ ai-service/ # Python AI
β βββ ops-service/ # Node.js Ops
β βββ engine-service/ # Go Engine
β