# malicknnd/school-admin architecture

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

- Interactive diagram: https://gitdiagram.com/malicknnd/school-admin
- Repository: https://github.com/malicknnd/school-admin

## Overview

School Manager Platform Admin is a SUPER_ADMIN-only frontend for platform oversight, separate from the school-facing application. The main workflow is sign-in, then dashboard review and school administration: browse/search schools, inspect a school and its derived administrator accounts, or create a school with an administrator. The README also documents status, password-reset, and hard-delete actions on school details. The sampled source shows the session, API client, school hooks, and detail-page derivation; connections for unsampled dashboard and some auth internals are limited to documented or indexed evidence.

Main entry points: [`src/routes`](https://github.com/malicknnd/school-admin/tree/main/src/routes) (Route entrypoints), [`src/routes/schools.index.tsx`](https://github.com/malicknnd/school-admin/blob/main/src/routes/schools.index.tsx) (School listing), [`src/routes/schools.$id.tsx`](https://github.com/malicknnd/school-admin/blob/main/src/routes/schools.%24id.tsx) (School detail), [`src/features/auth/hooks.ts`](https://github.com/malicknnd/school-admin/blob/main/src/features/auth/hooks.ts) (Auth hooks)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_navigation["Portal navigation"]
  node_routes["Route entrypoints"]
  node_shell["Platform shell<br/>[PlatformShell.tsx]"]
  node_dashboard["Dashboard<br/>[dashboard.tsx]"]
  node_states["Loading and errors<br/>[StateBlocks.tsx]"]
end

subgraph group_identity["Identity and session"]
  node_login["Login page<br/>[login.tsx]"]
  node_authhooks["Auth hooks<br/>[hooks.ts]"]
  node_authapi["Login API<br/>[api.ts]"]
  node_authcontext["Auth context<br/>[AuthContext.tsx]"]
  node_session[("Local session<br/>[session.ts]")]
end

subgraph group_schools["School administration"]
  node_schoolslist["School listing<br/>[schools.index.tsx]"]
  node_schoolstable["Schools table<br/>[SchoolsTable.tsx]"]
  node_schooldetail["School detail<br/>[schools.$id.tsx]"]
  node_schoolcreate["School creation"]
  node_schoolhooks["School hooks<br/>[hooks.ts]"]
  node_schoolapi["School API<br/>[api.ts]"]
end

subgraph group_platformdata["Platform data"]
  node_api["API client<br/>[apiClient.ts]"]
  node_userhooks["User hooks<br/>[hooks.ts]"]
  node_userapi["User API<br/>[api.ts]"]
  node_derive["Account derivation<br/>[derive.ts]"]
  node_stats["Dashboard statistics<br/>[stats.ts]"]
end

node_admin(("SUPER_ADMIN"))
node_backend{{"Backend API"}}

node_admin -->|"signs in"| node_login
node_login -->|"submits credentials"| node_authhooks
node_authhooks -->|"calls login"| node_authapi
node_authhooks -->|"uses auth state"| node_authcontext
node_authcontext -->|"reads session"| node_session
node_authapi -->|"posts login"| node_backend
node_api -->|"gets token"| node_session
node_api -.->|"sends requests"| node_backend
node_routes -->|"routes to"| node_dashboard
node_routes -->|"routes to"| node_login
node_routes -->|"routes to"| node_schoolslist
node_routes -->|"routes to"| node_schooldetail
node_routes -->|"routes to"| node_schoolcreate
node_shell -->|"checks identity"| node_authhooks
node_shell -->|"clears session"| node_session
node_schoolslist -->|"loads schools"| node_schoolhooks
node_schoolslist -->|"loads users"| node_userhooks
node_schoolslist -->|"renders table"| node_schoolstable
node_schooldetail -->|"loads school"| node_schoolhooks
node_schooldetail -->|"loads users"| node_userhooks
node_schooldetail -->|"derives accounts"| node_derive
node_schoolcreate -->|"renders states"| node_states
node_schoolhooks -->|"calls operations"| node_schoolapi
node_schoolapi -->|"uses client"| node_api
node_userhooks -->|"calls user API"| node_userapi
node_derive -.->|"filters loaded users"| node_userhooks
node_dashboard -.->|"calculates totals"| node_stats
node_stats -->|"uses account derivation"| node_derive
node_stats -.->|"summarizes platform"| node_schoolstable

click node_routes "https://github.com/malicknnd/school-admin/tree/main/src/routes"
click node_shell "https://github.com/malicknnd/school-admin/blob/main/src/components/layout/PlatformShell.tsx"
click node_dashboard "https://github.com/malicknnd/school-admin/blob/main/src/routes/dashboard.tsx"
click node_login "https://github.com/malicknnd/school-admin/blob/main/src/routes/login.tsx"
click node_authhooks "https://github.com/malicknnd/school-admin/blob/main/src/features/auth/hooks.ts"
click node_authapi "https://github.com/malicknnd/school-admin/blob/main/src/features/auth/api.ts"
click node_authcontext "https://github.com/malicknnd/school-admin/blob/main/src/features/auth/AuthContext.tsx"
click node_session "https://github.com/malicknnd/school-admin/blob/main/src/lib/session.ts"
click node_api "https://github.com/malicknnd/school-admin/blob/main/src/lib/apiClient.ts"
click node_schoolslist "https://github.com/malicknnd/school-admin/blob/main/src/routes/schools.index.tsx"
click node_schoolstable "https://github.com/malicknnd/school-admin/blob/main/src/features/schools/components/SchoolsTable.tsx"
click node_schooldetail "https://github.com/malicknnd/school-admin/blob/main/src/routes/schools.%24id.tsx"
click node_schoolcreate "https://github.com/malicknnd/school-admin/blob/main/src/features/schools/components/CreateSchoolForm.tsx"
click node_schoolhooks "https://github.com/malicknnd/school-admin/blob/main/src/features/schools/hooks.ts"
click node_schoolapi "https://github.com/malicknnd/school-admin/blob/main/src/features/schools/api.ts"
click node_userhooks "https://github.com/malicknnd/school-admin/blob/main/src/features/users/hooks.ts"
click node_userapi "https://github.com/malicknnd/school-admin/blob/main/src/features/users/api.ts"
click node_derive "https://github.com/malicknnd/school-admin/blob/main/src/features/users/derive.ts"
click node_stats "https://github.com/malicknnd/school-admin/blob/main/src/features/dashboard/stats.ts"
click node_states "https://github.com/malicknnd/school-admin/blob/main/src/components/layout/StateBlocks.tsx"

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_routes,node_shell,node_dashboard,node_states toneBlue
class node_login,node_authhooks,node_authapi,node_authcontext,node_session toneAmber
class node_schoolslist,node_schoolstable,node_schooldetail,node_schoolcreate,node_schoolhooks,node_schoolapi,node_backend toneMint
class node_api,node_userhooks,node_userapi,node_derive,node_stats toneRose
class node_admin toneIndigo
```

## Components

### Portal navigation

- [Route entrypoints](https://github.com/malicknnd/school-admin/tree/main/src/routes): `src/routes`
- [Platform shell](https://github.com/malicknnd/school-admin/blob/main/src/components/layout/PlatformShell.tsx): `src/components/layout/PlatformShell.tsx`
- [Dashboard](https://github.com/malicknnd/school-admin/blob/main/src/routes/dashboard.tsx): `src/routes/dashboard.tsx`
- [Loading and errors](https://github.com/malicknnd/school-admin/blob/main/src/components/layout/StateBlocks.tsx): `src/components/layout/StateBlocks.tsx`

### Identity and session

- [Login page](https://github.com/malicknnd/school-admin/blob/main/src/routes/login.tsx): `src/routes/login.tsx`
- [Auth hooks](https://github.com/malicknnd/school-admin/blob/main/src/features/auth/hooks.ts): `src/features/auth/hooks.ts`
- [Login API](https://github.com/malicknnd/school-admin/blob/main/src/features/auth/api.ts): `src/features/auth/api.ts`
- [Auth context](https://github.com/malicknnd/school-admin/blob/main/src/features/auth/AuthContext.tsx): `src/features/auth/AuthContext.tsx`
- [Local session](https://github.com/malicknnd/school-admin/blob/main/src/lib/session.ts): `src/lib/session.ts`

### School administration

- [School listing](https://github.com/malicknnd/school-admin/blob/main/src/routes/schools.index.tsx): `src/routes/schools.index.tsx`
- [Schools table](https://github.com/malicknnd/school-admin/blob/main/src/features/schools/components/SchoolsTable.tsx): `src/features/schools/components/SchoolsTable.tsx`
- [School detail](https://github.com/malicknnd/school-admin/blob/main/src/routes/schools.%24id.tsx): `src/routes/schools.$id.tsx`
- [School creation](https://github.com/malicknnd/school-admin/blob/main/src/features/schools/components/CreateSchoolForm.tsx): `src/features/schools/components/CreateSchoolForm.tsx`
- [School hooks](https://github.com/malicknnd/school-admin/blob/main/src/features/schools/hooks.ts): `src/features/schools/hooks.ts`
- [School API](https://github.com/malicknnd/school-admin/blob/main/src/features/schools/api.ts): `src/features/schools/api.ts`

### Platform data

- [API client](https://github.com/malicknnd/school-admin/blob/main/src/lib/apiClient.ts): `src/lib/apiClient.ts`
- [User hooks](https://github.com/malicknnd/school-admin/blob/main/src/features/users/hooks.ts): `src/features/users/hooks.ts`
- [User API](https://github.com/malicknnd/school-admin/blob/main/src/features/users/api.ts): `src/features/users/api.ts`
- [Account derivation](https://github.com/malicknnd/school-admin/blob/main/src/features/users/derive.ts): `src/features/users/derive.ts`
- [Dashboard statistics](https://github.com/malicknnd/school-admin/blob/main/src/features/dashboard/stats.ts): `src/features/dashboard/stats.ts`

### Other components

- **SUPER_ADMIN**
- **Backend API**

## Connections

- SUPER_ADMIN → Login page: signs in
- Login page → Auth hooks: submits credentials (evidence: `src/routes/login.tsx`)
- Auth hooks → Login API: calls login (evidence: `src/features/auth/hooks.ts`)
- Auth hooks → Auth context: uses auth state (evidence: `src/features/auth/hooks.ts`)
- Auth context → Local session: reads session (evidence: `src/features/auth/AuthContext.tsx`)
- Login API → Backend API: posts login
- API client → Local session: gets token (evidence: `src/lib/apiClient.ts`)
- API client → Backend API: sends requests
- Route entrypoints → Dashboard: routes to (evidence: `src/routeTree.gen.ts`)
- Route entrypoints → Login page: routes to (evidence: `src/routeTree.gen.ts`)
- Route entrypoints → School listing: routes to (evidence: `src/routeTree.gen.ts`)
- Route entrypoints → School detail: routes to (evidence: `src/routeTree.gen.ts`)
- Route entrypoints → School creation: routes to
- Platform shell → Auth hooks: checks identity (evidence: `src/components/layout/PlatformShell.tsx`)
- Platform shell → Local session: clears session (evidence: `src/components/layout/PlatformShell.tsx`)
- School listing → School hooks: loads schools (evidence: `src/routes/schools.index.tsx`)
- School listing → User hooks: loads users (evidence: `src/routes/schools.index.tsx`)
- School listing → Schools table: renders table (evidence: `src/routes/schools.index.tsx`)
- School detail → School hooks: loads school (evidence: `src/routes/schools.$id.tsx`)
- School detail → User hooks: loads users (evidence: `src/routes/schools.$id.tsx`)
- School detail → Account derivation: derives accounts (evidence: `src/routes/schools.$id.tsx`)
- School creation → Loading and errors: renders states (evidence: `src/features/schools/components/CreateSchoolForm.tsx`)
- School hooks → School API: calls operations (evidence: `src/features/schools/hooks.ts`)
- School API → API client: uses client (evidence: `src/features/schools/api.ts`)
- User hooks → User API: calls user API (evidence: `src/features/users/hooks.ts`)
- Account derivation → User hooks: filters loaded users
- Dashboard → Dashboard statistics: calculates totals
- Dashboard statistics → Account derivation: uses account derivation (evidence: `src/features/dashboard/stats.ts`)
- Dashboard statistics → Schools table: summarizes platform
