# aksofttech/school-erp-frontend architecture

> Architecture diagram of the GitHub repository aksofttech/school-erp-frontend, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-18). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/aksofttech/school-erp-frontend
- Repository: https://github.com/aksofttech/school-erp-frontend

## Overview

School ERP Frontend is a Next.js, role-based interface for school administration and school-community users. The user journey begins with authentication, proceeds through role-aware route protection and dashboards, then exposes academic, operational, or student/parent workflows; super-admins manage schools and platform services. Domain screens use a centralized service/API layer to communicate with the backend. The README documents the broad role-based capabilities; individual unsampled page-to-module links are not inferred, and the graph shows only relationships supported by the supplied excerpts, source index, or README.

Main entry points: [`utils/role-config.ts`](https://github.com/aksofttech/school-erp-frontend/blob/main/utils/role-config.ts) (Role routing), [`pages/admin`](https://github.com/aksofttech/school-erp-frontend/tree/main/pages/admin) (Admin portal), [`components/guards/RoleGuard.tsx`](https://github.com/aksofttech/school-erp-frontend/blob/main/components/guards/RoleGuard.tsx) (Role guard), [`pages/super-admin`](https://github.com/aksofttech/school-erp-frontend/tree/main/pages/super-admin) (Super-admin portal)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_access["Identity &amp; Access"]
  node_auth_pages["Sign in and register"]
  node_auth_context["Authentication state<br/>[AuthContext.tsx]"]
  node_auth_service["Authentication service<br/>[auth.service.ts]"]
  node_auth_guard["Authentication guard<br/>[AuthGuard.tsx]"]
  node_role_guard["Role guard<br/>[RoleGuard.tsx]"]
  node_role_config["Role routing<br/>[role-config.ts]"]
end

subgraph group_school["School Operations"]
  node_admin_portal["Admin portal"]
  node_academic["Academic management"]
  node_transport["Transport routes"]
  node_operations["School operations"]
end

subgraph group_community["School Community"]
  node_teacher_portal["Teacher portal"]
  node_student_portal["Student portal"]
  node_parent_portal["Parent portal"]
end

subgraph group_platform["Platform Administration"]
  node_superadmin_portal["Super-admin portal"]
  node_school_registry["School and license management<br/>[LicenseManager.tsx]"]
  node_superadmin_service["Super-admin service"]
end

subgraph group_foundation["Shared Foundation"]
  node_api_client["HTTP API client<br/>[api-client.ts]"]
  node_admin_layout["Protected dashboard layout<br/>[AdminLayout.tsx]"]
  node_use_auth["Auth hook<br/>[useAuth.ts]"]
end

node_user(("School user"))
node_backend{{"ERP backend"}}

node_user -->|"signs in"| node_auth_pages
node_auth_pages -.->|"submits credentials"| node_auth_context
node_auth_context -->|"loads profile"| node_auth_service
node_auth_service -->|"sends auth requests"| node_api_client
node_api_client -->|"sends HTTP requests"| node_backend
node_admin_portal -.->|"requires authentication"| node_auth_guard
node_admin_portal -.->|"checks role"| node_role_guard
node_auth_guard -->|"reads auth state"| node_use_auth
node_role_guard -->|"reads auth state"| node_use_auth
node_role_guard -->|"validates role"| node_role_config
node_use_auth -->|"reads context"| node_auth_context
node_admin_layout -->|"wraps pages"| node_auth_guard
node_admin_layout -->|"wraps pages"| node_role_guard
node_admin_portal -.->|"offers academics"| node_academic
node_admin_portal -.->|"offers operations"| node_operations
node_admin_portal -->|"routes to"| node_transport
node_transport -->|"uses layout"| node_admin_layout
node_teacher_portal -.->|"serves teachers"| node_user
node_student_portal -.->|"serves students"| node_user
node_parent_portal -.->|"serves parents"| node_user
node_superadmin_portal -.->|"manages schools"| node_school_registry
node_superadmin_portal -.->|"uses services"| node_superadmin_service
node_superadmin_service -->|"sends platform requests"| node_api_client
node_role_config -->|"maps admin role"| node_admin_portal
node_role_config -->|"maps teacher role"| node_teacher_portal
node_role_config -->|"maps student role"| node_student_portal
node_role_config -->|"maps parent role"| node_parent_portal
node_role_config -->|"maps platform role"| node_superadmin_portal

click node_auth_pages "https://github.com/aksofttech/school-erp-frontend/tree/main/pages/auth"
click node_auth_context "https://github.com/aksofttech/school-erp-frontend/blob/main/contexts/AuthContext.tsx"
click node_auth_service "https://github.com/aksofttech/school-erp-frontend/blob/main/services/auth.service.ts"
click node_auth_guard "https://github.com/aksofttech/school-erp-frontend/blob/main/components/guards/AuthGuard.tsx"
click node_role_guard "https://github.com/aksofttech/school-erp-frontend/blob/main/components/guards/RoleGuard.tsx"
click node_role_config "https://github.com/aksofttech/school-erp-frontend/blob/main/utils/role-config.ts"
click node_admin_portal "https://github.com/aksofttech/school-erp-frontend/tree/main/pages/admin"
click node_academic "https://github.com/aksofttech/school-erp-frontend/tree/main/modules/admin/academic"
click node_transport "https://github.com/aksofttech/school-erp-frontend/blob/main/modules/admin/transport/routes/TransportRoutes.tsx"
click node_operations "https://github.com/aksofttech/school-erp-frontend/tree/main/pages/admin"
click node_teacher_portal "https://github.com/aksofttech/school-erp-frontend/tree/main/pages/teacher"
click node_student_portal "https://github.com/aksofttech/school-erp-frontend/tree/main/pages/student"
click node_parent_portal "https://github.com/aksofttech/school-erp-frontend/tree/main/pages/parent"
click node_superadmin_portal "https://github.com/aksofttech/school-erp-frontend/tree/main/pages/super-admin"
click node_school_registry "https://github.com/aksofttech/school-erp-frontend/blob/main/modules/super-admin/license/LicenseManager.tsx"
click node_superadmin_service "https://github.com/aksofttech/school-erp-frontend/blob/main/services/super-admin.service.ts"
click node_api_client "https://github.com/aksofttech/school-erp-frontend/blob/main/utils/api-client.ts"
click node_admin_layout "https://github.com/aksofttech/school-erp-frontend/blob/main/components/layouts/AdminLayout.tsx"
click node_use_auth "https://github.com/aksofttech/school-erp-frontend/blob/main/hooks/useAuth.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_auth_pages,node_auth_context,node_auth_service,node_auth_guard,node_role_guard,node_role_config,node_user toneBlue
class node_admin_portal,node_academic,node_transport,node_operations toneAmber
class node_teacher_portal,node_student_portal,node_parent_portal toneMint
class node_superadmin_portal,node_school_registry,node_superadmin_service toneRose
class node_api_client,node_admin_layout,node_use_auth,node_backend toneIndigo
```

## Components

### Identity & Access

- [Sign in and register](https://github.com/aksofttech/school-erp-frontend/tree/main/pages/auth): `pages/auth`
- [Authentication state](https://github.com/aksofttech/school-erp-frontend/blob/main/contexts/AuthContext.tsx): `contexts/AuthContext.tsx`
- [Authentication service](https://github.com/aksofttech/school-erp-frontend/blob/main/services/auth.service.ts): `services/auth.service.ts`
- [Authentication guard](https://github.com/aksofttech/school-erp-frontend/blob/main/components/guards/AuthGuard.tsx): `components/guards/AuthGuard.tsx`
- [Role guard](https://github.com/aksofttech/school-erp-frontend/blob/main/components/guards/RoleGuard.tsx): `components/guards/RoleGuard.tsx`
- [Role routing](https://github.com/aksofttech/school-erp-frontend/blob/main/utils/role-config.ts): `utils/role-config.ts`

### School Operations

- [Admin portal](https://github.com/aksofttech/school-erp-frontend/tree/main/pages/admin): `pages/admin`
- [Academic management](https://github.com/aksofttech/school-erp-frontend/tree/main/modules/admin/academic): `modules/admin/academic`
- [Transport routes](https://github.com/aksofttech/school-erp-frontend/blob/main/modules/admin/transport/routes/TransportRoutes.tsx): `modules/admin/transport/routes/TransportRoutes.tsx`
- [School operations](https://github.com/aksofttech/school-erp-frontend/tree/main/pages/admin): `pages/admin`

### School Community

- [Teacher portal](https://github.com/aksofttech/school-erp-frontend/tree/main/pages/teacher): `pages/teacher`
- [Student portal](https://github.com/aksofttech/school-erp-frontend/tree/main/pages/student): `pages/student`
- [Parent portal](https://github.com/aksofttech/school-erp-frontend/tree/main/pages/parent): `pages/parent`

### Platform Administration

- [Super-admin portal](https://github.com/aksofttech/school-erp-frontend/tree/main/pages/super-admin): `pages/super-admin`
- [School and license management](https://github.com/aksofttech/school-erp-frontend/blob/main/modules/super-admin/license/LicenseManager.tsx): `modules/super-admin/license/LicenseManager.tsx`
- [Super-admin service](https://github.com/aksofttech/school-erp-frontend/blob/main/services/super-admin.service.ts): `services/super-admin.service.ts`

### Shared Foundation

- [HTTP API client](https://github.com/aksofttech/school-erp-frontend/blob/main/utils/api-client.ts): `utils/api-client.ts`
- [Protected dashboard layout](https://github.com/aksofttech/school-erp-frontend/blob/main/components/layouts/AdminLayout.tsx): `components/layouts/AdminLayout.tsx`
- [Auth hook](https://github.com/aksofttech/school-erp-frontend/blob/main/hooks/useAuth.ts): `hooks/useAuth.ts`

### Other components

- **School user**
- **ERP backend**

## Connections

- School user → Sign in and register: signs in
- Sign in and register → Authentication state: submits credentials
- Authentication state → Authentication service: loads profile (evidence: `contexts/AuthContext.tsx`)
- Authentication service → HTTP API client: sends auth requests (evidence: `services/auth.service.ts`)
- HTTP API client → ERP backend: sends HTTP requests (evidence: `utils/api-client.ts`)
- Admin portal → Authentication guard: requires authentication (evidence: `pages/admin/homework/review.tsx`)
- Admin portal → Role guard: checks role (evidence: `pages/admin/homework/review.tsx`)
- Authentication guard → Auth hook: reads auth state (evidence: `components/guards/AuthGuard.tsx`)
- Role guard → Auth hook: reads auth state (evidence: `components/guards/RoleGuard.tsx`)
- Role guard → Role routing: validates role (evidence: `components/guards/RoleGuard.tsx`)
- Auth hook → Authentication state: reads context (evidence: `hooks/useAuth.ts`)
- Protected dashboard layout → Authentication guard: wraps pages (evidence: `components/layouts/AdminLayout.tsx`)
- Protected dashboard layout → Role guard: wraps pages (evidence: `components/layouts/AdminLayout.tsx`)
- Admin portal → Academic management: offers academics
- Admin portal → School operations: offers operations
- Admin portal → Transport routes: routes to (evidence: `pages/admin/transport/routes.tsx`)
- Transport routes → Protected dashboard layout: uses layout (evidence: `modules/admin/transport/routes/TransportRoutes.tsx`)
- Teacher portal → School user: serves teachers
- Student portal → School user: serves students
- Parent portal → School user: serves parents
- Super-admin portal → School and license management: manages schools
- Super-admin portal → Super-admin service: uses services (evidence: `pages/super-admin/users/index.tsx`)
- Super-admin service → HTTP API client: sends platform requests (evidence: `services/super-admin.service.ts`)
- Role routing → Admin portal: maps admin role (evidence: `utils/role-config.ts`)
- Role routing → Teacher portal: maps teacher role (evidence: `utils/role-config.ts`)
- Role routing → Student portal: maps student role (evidence: `utils/role-config.ts`)
- Role routing → Parent portal: maps parent role (evidence: `utils/role-config.ts`)
- Role routing → Super-admin portal: maps platform role (evidence: `utils/role-config.ts`)
