System architecture
All roles use the same Next.js app in the browser. It calls a single Express API (JSON over HTTPS). The API validates JWTs, resolves school scope, then reads and writes PostgreSQL and local file storage. Nothing in the database is shared across schools without an explicit schoolId filter.
Request path
Role-based users
Browsers ยท desktop & mobile
Next.js web application
App Router ยท React ยท Tailwind ยท client auth & school headers
Express API
One HTTP service: routes per module (students, fees, exams, HR, โฆ). Every school-scoped call is checked against the signed-in user and active school context.
Middleware chain
- JWT validation
- Resolve school / scope
- Zod validation
- Prisma data access
PostgreSQL
Single database, schoolId on rows for tenant isolation.
File storage
Uploads (documents, ID assets, exam media) on disk or compatible storage, paths referenced from the API.
Optional services (e.g. Redis cache, email SMTP, payment gateways) connect from the API layer only โ not from the browser.

๐ Save asset at:
frontend/public/images/guide/architecture-overview.pngEnd-to-end flows
Step-by-step visuals for the main journeys in the product. Each diagram renders inline โ no external engine required.
Sign-in and school context
Most routes require authentication; super-admin flows add an explicit school context step.
Authentication path
Open login
MDH School ERP sign-in
Email & password
Submitted to /auth/login
Dashboard
Shell & nav by primaryRole
After login โ school context
Schools โ Open as context
Sets X-School-Id for this session
School-scoped screens
Fees, students, exams, etc. for that tenant
Other roles
School is already on the JWT and/or header from login โ no extra context step.
Admission โ enrollment โ class
Public enrollment forms feed admin review; approved students become first-class records in the school.
Admission โ enrollment โ class
Public / parent
Submit admission
Open enrollment form for school code
System
Queue application
Visible in student registrations
School admin
Review & approve
Check documents & eligibility
System
Create student
Profile + section assignment
Family
Access portals
Student / parent login linked
Fees: structure โ assignment โ payment
Accountants configure structures; families pay through the portal when gateways are enabled.
Fee lifecycle
Setup
- Fee structure
- Assign to class / student
Payment
- Open Fees (parent or student)
- Pay online or record offline
Post-payment
- Receipt & ledger
๐ Save asset at:
frontend/public/images/guide/flows-admission.png | frontend/public/videos/guide/flows-walkthrough.mp4Super admin platform loop
Monitor platform SaaS health across schools first; switch into tenant-scoped work only when needed.
School admin operational loop
Run the school day: setup academic structure, manage students, handle operations, and coordinate HR/finance.
Teacher daily teaching loop
Assignments, attendance, assessments, and online exams share the same section-aware permissions.
Accountant finance loop
Keep fee collection and invoices consistent: configure structures, record payments, and reconcile receipts.
HR staff-org loop
Organize employees by department and job title, then manage leave and payroll/letters from the HR workspace.
Student visibility loop
View timetable, attendance, fees, exams, and homework through personal, academic-year-scoped screens.
Parent visibility loop
Parents stay on child-specific surfaces plus fees and school messages.
Migrating from another ERP
Schools often replace an older product mid-year or between sessions. MDH is multi-tenant: every row is scoped to a schoolId, and admission, registration, and employee numbers are generated per school so you will not collide with other tenants.
Signed-in schools
After login, open Data migration to initiate the checklist and update your school's migration phase.
๐ Save asset at:
frontend/public/images/guide/migration-roadmap.png | frontend/public/videos/guide/migration-walkthrough.mp4Actions by role
Navigation in the app is filtered by primaryRole. The list below matches the modules wired in the shell.
SUPER ADMIN
Platform owner
SCHOOL ADMIN
Principal / operations
TEACHER
Class & subject teacher
ACCOUNTANT
Finance office
HR
Human resources
STUDENT
Learner portal
PARENT
Guardian portal
๐ Save asset at:
frontend/public/images/guide/roles-overview.png | frontend/public/videos/guide/roles-walkthrough.mp4Departments & titles (HR)
HR uses a staff-org catalog to group employees by department and designation / job title. This matches the HR โAdd employeeโ form and the fields stored on each employee record.
Departments + job titles model
Expand for catalog + save rules
๐ Save asset at:
frontend/public/images/guide/departments-catalog.png | frontend/public/videos/guide/departments-walkthrough.mp4Training video
Record your walkthrough, upload it to YouTube or another host, then point the app at the public URL.
Embed your video
Set NEXT_PUBLIC_ERP_TRAINING_VIDEO in frontend/.env.local to a full YouTube watch URL or embed URL. Rebuild or restart next dev after changing.
Video placeholder
Add NEXT_PUBLIC_ERP_TRAINING_VIDEO to show an embedded video here.
Ready to get started?
Sign in to your account or subscribe to set up your school in minutes.