How vivekrai-gif/multi-tenant-erp works
1. This is a React single-page application bootstrapped with Create React App. The runtime is entirely client-side, with public/index.html as the host shell and src/index.js mounting the app.
2. The application is organized as a multi-role ERP/portal UI rather than a single-purpose app. The major product surfaces are:
- public landing and login
- global admin
- school admin
- teacher
- parent
- student
3. Navigation and page composition are centralized in src/routes/AppRoutes.jsx, src/App.jsx, and src/layouts/MainLayout.jsx. Each role then has its own layout and shell components, which strongly suggests route-level separation by persona.
4. The shared design system lives under src/components/shared, src/components/ui, and src/components/erp/global. These folders contain reusable UI primitives and app shell pieces such as sidebars, top bars, headers, cards, pagination, charts, and table components.
5. State that crosses multiple screens is handled with React context providers in src/context: ThemeContext, ParentProvider, SchoolAdminProvider, and StudentProvider. This indicates role-specific state hydration and theme handling at the top of the component tree.
6. The service layer is concentrated under src/services. axiosClient.js, apiClient.js, and api.js appear to be the shared HTTP foundation, while parentAPIs.js, schoolAdminApi.js, and studentAPIs.js split API access by role. exportService.js suggests a separate reporting/export flow. The UI pages likely fetch and mutate data through these wrappers rather than calling backend endpoints directly.
7. The global admin area is a platform-management subsystem. Its pages cover schools, domains, subscriptions, payment infrastructure, AI configuration, email configuration, security/access, notifications, settings, and school creation. This is the clearest boundary for tenant/platform administration.
8. The school admin area is the operational management subsystem for a school tenant. It includes students, teachers, parents, class levels, academic years, classes/sections, subjects, role/permission setup, teacher assignment, parent-student mapping, and entity detail/edit pages. This is the main data administration layer for the school domain.
9. The teacher area is the instructional workflow subsystem. It includes class hubs, attendance, assignments, exams, grading, student analytics, performance management, notifications, profile/settings, and a substantial AI content workspace. The AI tool pages cover lesson plans, quizzes, worksheets, rubrics, study notes, question papers, presentations, and history.
10. The student area is the learner-facing subsystem. It includes dashboards, subjects, assignments, attendance, grades, learning materials, quizzes, AI tutor, recommendations, fees/payments, help desk, notifications, profile, and settings. This area is oriented around consuming content and submitting/receiving academic results.
11. The parent area is a monitoring and guidance subsystem. Its pages focus on child overview, attendance, grades/assessment, assignments, recommendations/insights, notifications, and portal settings. This role appears read-heavy compared with teacher and school admin roles.
12. The landing experience under src/components/landing and src/pages/Landing.jsx is a separate marketing/public entry path. It contains hero, roles, flow, intelligence, CTA, navbar, and footer sections, implying a public funnel that leads into login and the role-based app.
13. Styling and presentation are layered through src/index.css, src/styles/aiTheme.css, tailwind.config.js, and postcss.config.js. The presence of Tailwind/PostCSS config plus AI-specific theming suggests the UI is built from utility styling with some custom theme treatment for AI workspace screens.
14. src/hooks/useStaleData.js and src/utils/calculations.js provide cross-cutting client logic for data freshness and derived metrics. These are supporting utilities rather than primary domains, but they likely feed dashboards, charts, and summary cards.
15. fix-darkmode.js and fix_student_section.js look like one-off maintenance scripts rather than runtime application code. They should be treated as repo utilities, not as part of the main request/response architecture.
16. For an architecture diagram, the key boundaries are: public landing/auth, shared client shell, role-specific portals, centralized HTTP/service layer, and context-driven state. The main data flow is user action in a role-specific page → service/API wrapper → backend response → contextual state and dashboard/UI rendering.
Main entry points: AppRoutes.jsx Routes · apiClient.js HTTP core · MainLayout.jsx Main layout · Dashboard.jsx School admin
Components 23
Public entry
Marketing site and login entry path
Client core
App bootstrap, routing, layouts, shared state, and design system
- Host shell · Static HTML mount point for the React app
public/index.html - App mount · Client-side runtime entry that mounts React
src/index.js - Routes · Central route map across personas and entry points
src/routes/AppRoutes.jsx - Main layout · Top-level layout composition for the SPA
src/layouts/MainLayout.jsx - Theme context · Global theme and appearance state
src/context/ThemeContext.jsx - Shared UI · Reusable cards, nav, sidebar, and topbar primitives
src/components/shared - ERP shell · Common ERP dashboard chrome and widgets
src/components/erp/global - HTTP core · Shared axios/client wrappers used by all portals
src/services/apiClient.js
Global admin
Platform-level tenant administration
- Global admin · Tenant, billing, security, and platform settings
src/pages/globalAdmin/GlobalDashboard.jsx - Admin pages · Schools, domains, subscriptions, payment, AI, email, security, notifications
src/pages/globalAdmin
School admin
School tenant operational administration
- School admin · School operations, roster, mapping, and roles
src/pages/schoolAdmin/Dashboard.jsx - School screens · Students, teachers, parents, classes, sections, years, mappings, and permissions
src/pages/schoolAdmin - School context · School-admin state hydration across screens
src/context/SchoolAdminProvider.jsx
Teacher portal
Instructional workflow and AI content tools
- Teacher portal · Classroom workflow, grading, analytics, and AI tools
src/pages/teacher/Dashboard.jsx - Teacher tools · Attendance, assignments, exams, grades, analytics, class hubs, and AI workspaces
src/pages/teacher
Student portal
Learner-facing dashboard and study flows
- Student portal · Student dashboard, study materials, assessments, and support
src/pages/student/Dashboard.jsx - Student screens · Subjects, materials, quizzes, AI tutor, fees, help desk, and settings
src/pages/student - Student context · Student state hydration across screens
src/context/StudentProvider.jsx
Parent portal
Monitoring and guidance flows for guardians
- Parent portal · Child progress, attendance, grades, and insights
src/pages/parent/ParentDashboard.jsx - Parent screens · Child overview, attendance, grades, assignments, recommendations, and settings
src/pages/parent - Parent context · Parent state hydration across screens
src/context/ParentProvider.jsx
Connections 26
- Host shell → App mount: mounts · HTML host shell loads the React bundle
- App mount → Routes: renders · Bootstrap hands off to the router
- Routes → Landing: routes to · Public landing path
- Routes → Login: routes to · Authentication path
- Routes → Global admin: routes to · Global admin persona
- Routes → School admin: routes to · School admin persona
- Routes → Teacher portal: routes to · Teacher persona
- Routes → Student portal: routes to · Student persona
- Routes → Parent portal: routes to · Parent persona
- Main layout → Routes: wraps · Shared shell composes routed pages
- Theme context → Main layout: provides · Theme state is injected at the app boundary
- Shared UI → Main layout: supports · Reusable navigation and UI primitives
- ERP shell → Teacher portal: supports · Dashboard and workflow widgets used across ERP screens
- HTTP core → Admin pages: serves · Shared API foundation behind global admin calls
- HTTP core → School screens: serves · Shared API foundation behind school admin calls
- HTTP core → Teacher tools: serves · Shared API foundation behind teacher workflow calls
- HTTP core → Student screens: serves · Shared API foundation behind student calls
- HTTP core → Parent screens: serves · Shared API foundation behind parent calls
- School context → School admin: feeds · Role-specific state provider for school admin screens
- Student context → Student portal: feeds · Role-specific state provider for student screens
- Parent context → Parent portal: feeds · Role-specific state provider for parent screens
- Global admin → Admin pages: contains · Platform management screens
- School admin → School screens: contains · Tenant administration screens
- Teacher portal → Teacher tools: contains · Instructional workflow screens
- Student portal → Student screens: contains · Learner-facing screens
- Parent portal → Parent screens: contains · Guardian-facing screens