# earsokchan/school-management-system-dynamic-school-website architecture

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

- Interactive diagram: https://gitdiagram.com/earsokchan/school-management-system-dynamic-school-website
- Repository: https://github.com/earsokchan/school-management-system-dynamic-school-website

## Overview

HSKTH is a bilingual school website and management platform. Visitors browse localized school pages and public information, while administrators sign in to edit content and manage academic records; changes flow through server actions or API routes to MongoDB, with uploads stored in Vercel Blob. The graph retains public news/events and results, admin operations, authentication, localization, and persistence. Public page loading and several unsampled admin/API connections are documented at subsystem level; those links are dashed where source excerpts do not establish the exact caller.

Main entry points: [`src/lib/server/actions.ts`](https://github.com/earsokchan/school-management-system-dynamic-school-website/blob/main/src/lib/server/actions.ts) (Server actions), [`src/app/[lang]`](https://github.com/earsokchan/school-management-system-dynamic-school-website/tree/main/src/app/%5Blang%5D) (Localized pages), [`src/app/admin`](https://github.com/earsokchan/school-management-system-dynamic-school-website/tree/main/src/app/admin) (Admin pages), [`src/lib/server/admin-auth.ts`](https://github.com/earsokchan/school-management-system-dynamic-school-website/blob/main/src/lib/server/admin-auth.ts) (Session security)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_public["Public website"]
  node_public_pages["Localized pages"]
  node_public_sections["Website sections"]
  node_public_layout["Site navigation"]
  node_search["Site search<br/>[SearchOverlay.tsx]"]
  node_news_events["News and events<br/>[news.ts]"]
  node_results["Student results<br/>[results.ts]"]
end

subgraph group_admin["Admin management"]
  node_admin_pages["Admin pages"]
  node_admin_shell["Admin workspace<br/>[AdminShell.tsx]"]
  node_content_managers["Content managers<br/>[NewsManager.tsx]"]
  node_school_managers["School records<br/>[StudentManager.tsx]"]
  node_collection_hook["Collection client<br/>[use-collection.ts]"]
end

subgraph group_server["Server services"]
  node_i18n["Localization<br/>[i18n.ts]"]
  node_auth_routes["Login and sessions<br/>[route.ts]"]
  node_auth_service["Session security<br/>[admin-auth.ts]"]
  node_api_routes["Content API<br/>[route.ts]"]
  node_page_content_api["Page content APIs<br/>[route.ts]"]
  node_actions["Server actions<br/>[actions.ts]"]
  node_validation["Content validation"]
  node_blob_service["Image storage<br/>[blob.ts]"]
  node_seed["Content seeding<br/>[seed.ts]"]
end

subgraph group_data["Content and storage"]
  node_collections["Collection access<br/>[collections.ts]"]
  node_mongodb["MongoDB client<br/>[mongodb.ts]"]
  node_mongo_store[("MongoDB")]
  node_blob_store[("Vercel Blob")]
end

node_visitor(("School visitor"))
node_admin_user(("Administrator"))

node_visitor -->|"browses"| node_public_pages
node_public_pages -.->|"renders"| node_public_sections
node_public_pages -.->|"localizes"| node_i18n
node_public_pages -.->|"uses layout"| node_public_layout
node_public_sections -.->|"displays"| node_news_events
node_public_sections -.->|"displays"| node_results
node_search -->|"searches"| node_news_events
node_search -->|"localizes"| node_i18n
node_admin_user -->|"signs in"| node_auth_routes
node_auth_routes -->|"validates credentials"| node_auth_service
node_admin_user -->|"manages"| node_admin_pages
node_admin_pages -.->|"uses workspace"| node_admin_shell
node_admin_shell -->|"sets locale"| node_i18n
node_admin_pages -.->|"hosts editors"| node_content_managers
node_admin_pages -.->|"hosts managers"| node_school_managers
node_content_managers -->|"edits collections"| node_collection_hook
node_school_managers -.->|"manages records"| node_collection_hook
node_collection_hook -->|"calls actions"| node_actions
node_actions -->|"checks session"| node_auth_service
node_actions -->|"validates data"| node_validation
node_actions -->|"reads and writes"| node_collections
node_api_routes -->|"requires admin"| node_auth_service
node_api_routes -->|"validates payload"| node_validation
node_api_routes -->|"accesses data"| node_collections
node_page_content_api -->|"requires admin"| node_auth_service
node_page_content_api -->|"reads and writes"| node_mongodb
node_collections -->|"uses client"| node_mongodb
node_mongodb -.->|"connects"| node_mongo_store
node_content_managers -->|"uploads images"| node_blob_service
node_blob_service -.->|"stores files"| node_blob_store
node_actions -->|"uploads images"| node_blob_service
node_actions -->|"seeds content"| node_seed

click node_public_pages "https://github.com/earsokchan/school-management-system-dynamic-school-website/tree/main/src/app/%5Blang%5D"
click node_public_sections "https://github.com/earsokchan/school-management-system-dynamic-school-website/tree/main/src/components/home"
click node_public_layout "https://github.com/earsokchan/school-management-system-dynamic-school-website/tree/main/src/components/layout"
click node_search "https://github.com/earsokchan/school-management-system-dynamic-school-website/blob/main/src/components/layout/SearchOverlay.tsx"
click node_news_events "https://github.com/earsokchan/school-management-system-dynamic-school-website/blob/main/src/data/news.ts"
click node_results "https://github.com/earsokchan/school-management-system-dynamic-school-website/blob/main/src/data/results.ts"
click node_i18n "https://github.com/earsokchan/school-management-system-dynamic-school-website/blob/main/src/lib/i18n.ts"
click node_admin_pages "https://github.com/earsokchan/school-management-system-dynamic-school-website/tree/main/src/app/admin"
click node_admin_shell "https://github.com/earsokchan/school-management-system-dynamic-school-website/blob/main/src/components/admin/AdminShell.tsx"
click node_content_managers "https://github.com/earsokchan/school-management-system-dynamic-school-website/blob/main/src/components/admin/NewsManager.tsx"
click node_school_managers "https://github.com/earsokchan/school-management-system-dynamic-school-website/blob/main/src/components/admin/StudentManager.tsx"
click node_collection_hook "https://github.com/earsokchan/school-management-system-dynamic-school-website/blob/main/src/hooks/use-collection.ts"
click node_auth_routes "https://github.com/earsokchan/school-management-system-dynamic-school-website/blob/main/src/app/api/auth/login/route.ts"
click node_auth_service "https://github.com/earsokchan/school-management-system-dynamic-school-website/blob/main/src/lib/server/admin-auth.ts"
click node_api_routes "https://github.com/earsokchan/school-management-system-dynamic-school-website/blob/main/src/app/api/content/%5Bcollection%5D/route.ts"
click node_page_content_api "https://github.com/earsokchan/school-management-system-dynamic-school-website/blob/main/src/app/api/academics-content/route.ts"
click node_actions "https://github.com/earsokchan/school-management-system-dynamic-school-website/blob/main/src/lib/server/actions.ts"
click node_validation "https://github.com/earsokchan/school-management-system-dynamic-school-website/blob/main/src/lib/server/content-validation.ts"
click node_collections "https://github.com/earsokchan/school-management-system-dynamic-school-website/blob/main/src/lib/server/collections.ts"
click node_mongodb "https://github.com/earsokchan/school-management-system-dynamic-school-website/blob/main/src/lib/server/mongodb.ts"
click node_blob_service "https://github.com/earsokchan/school-management-system-dynamic-school-website/blob/main/src/lib/server/blob.ts"
click node_seed "https://github.com/earsokchan/school-management-system-dynamic-school-website/blob/main/src/lib/server/seed.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_public_pages,node_public_sections,node_public_layout,node_search,node_news_events,node_results toneBlue
class node_admin_pages,node_admin_shell,node_content_managers,node_school_managers,node_collection_hook toneAmber
class node_i18n,node_auth_routes,node_auth_service,node_api_routes,node_page_content_api,node_actions,node_validation,node_blob_service,node_seed toneMint
class node_collections,node_mongodb,node_mongo_store,node_blob_store toneRose
class node_visitor,node_admin_user toneIndigo
```

## Components

### Public website

- [Localized pages](https://github.com/earsokchan/school-management-system-dynamic-school-website/tree/main/src/app/%5Blang%5D): `src/app/[lang]`
- [Website sections](https://github.com/earsokchan/school-management-system-dynamic-school-website/tree/main/src/components/home): `src/components/home`
- [Site navigation](https://github.com/earsokchan/school-management-system-dynamic-school-website/tree/main/src/components/layout): `src/components/layout`
- [Site search](https://github.com/earsokchan/school-management-system-dynamic-school-website/blob/main/src/components/layout/SearchOverlay.tsx): `src/components/layout/SearchOverlay.tsx`
- [News and events](https://github.com/earsokchan/school-management-system-dynamic-school-website/blob/main/src/data/news.ts): `src/data/news.ts`
- [Student results](https://github.com/earsokchan/school-management-system-dynamic-school-website/blob/main/src/data/results.ts): `src/data/results.ts`

### Admin management

- [Admin pages](https://github.com/earsokchan/school-management-system-dynamic-school-website/tree/main/src/app/admin): `src/app/admin`
- [Admin workspace](https://github.com/earsokchan/school-management-system-dynamic-school-website/blob/main/src/components/admin/AdminShell.tsx): `src/components/admin/AdminShell.tsx`
- [Content managers](https://github.com/earsokchan/school-management-system-dynamic-school-website/blob/main/src/components/admin/NewsManager.tsx): `src/components/admin/NewsManager.tsx`
- [School records](https://github.com/earsokchan/school-management-system-dynamic-school-website/blob/main/src/components/admin/StudentManager.tsx): `src/components/admin/StudentManager.tsx`
- [Collection client](https://github.com/earsokchan/school-management-system-dynamic-school-website/blob/main/src/hooks/use-collection.ts): `src/hooks/use-collection.ts`

### Server services

- [Localization](https://github.com/earsokchan/school-management-system-dynamic-school-website/blob/main/src/lib/i18n.ts): `src/lib/i18n.ts`
- [Login and sessions](https://github.com/earsokchan/school-management-system-dynamic-school-website/blob/main/src/app/api/auth/login/route.ts): `src/app/api/auth/login/route.ts`
- [Session security](https://github.com/earsokchan/school-management-system-dynamic-school-website/blob/main/src/lib/server/admin-auth.ts): `src/lib/server/admin-auth.ts`
- [Content API](https://github.com/earsokchan/school-management-system-dynamic-school-website/blob/main/src/app/api/content/%5Bcollection%5D/route.ts): `src/app/api/content/[collection]/route.ts`
- [Page content APIs](https://github.com/earsokchan/school-management-system-dynamic-school-website/blob/main/src/app/api/academics-content/route.ts): `src/app/api/academics-content/route.ts`
- [Server actions](https://github.com/earsokchan/school-management-system-dynamic-school-website/blob/main/src/lib/server/actions.ts): `src/lib/server/actions.ts`
- [Content validation](https://github.com/earsokchan/school-management-system-dynamic-school-website/blob/main/src/lib/server/content-validation.ts): `src/lib/server/content-validation.ts`
- [Image storage](https://github.com/earsokchan/school-management-system-dynamic-school-website/blob/main/src/lib/server/blob.ts): `src/lib/server/blob.ts`
- [Content seeding](https://github.com/earsokchan/school-management-system-dynamic-school-website/blob/main/src/lib/server/seed.ts): `src/lib/server/seed.ts`

### Content and storage

- [Collection access](https://github.com/earsokchan/school-management-system-dynamic-school-website/blob/main/src/lib/server/collections.ts): `src/lib/server/collections.ts`
- [MongoDB client](https://github.com/earsokchan/school-management-system-dynamic-school-website/blob/main/src/lib/server/mongodb.ts): `src/lib/server/mongodb.ts`
- **MongoDB**
- **Vercel Blob**

### Other components

- **School visitor**
- **Administrator**

## Connections

- School visitor → Localized pages: browses
- Localized pages → Website sections: renders
- Localized pages → Localization: localizes
- Localized pages → Site navigation: uses layout
- Website sections → News and events: displays
- Website sections → Student results: displays
- Site search → News and events: searches (evidence: `src/components/layout/SearchOverlay.tsx`)
- Site search → Localization: localizes (evidence: `src/components/layout/SearchOverlay.tsx`)
- Administrator → Login and sessions: signs in
- Login and sessions → Session security: validates credentials (evidence: `src/app/api/auth/login/route.ts`)
- Administrator → Admin pages: manages
- Admin pages → Admin workspace: uses workspace
- Admin workspace → Localization: sets locale (evidence: `src/components/admin/AdminShell.tsx`)
- Admin pages → Content managers: hosts editors
- Admin pages → School records: hosts managers
- Content managers → Collection client: edits collections (evidence: `src/components/admin/NewsManager.tsx`)
- School records → Collection client: manages records
- Collection client → Server actions: calls actions (evidence: `src/hooks/use-collection.ts`)
- Server actions → Session security: checks session (evidence: `src/lib/server/actions.ts`)
- Server actions → Content validation: validates data (evidence: `src/lib/server/actions.ts`)
- Server actions → Collection access: reads and writes (evidence: `src/lib/server/actions.ts`)
- Content API → Session security: requires admin (evidence: `src/app/api/content/[collection]/route.ts`)
- Content API → Content validation: validates payload (evidence: `src/app/api/content/[collection]/route.ts`)
- Content API → Collection access: accesses data (evidence: `src/app/api/content/[collection]/route.ts`)
- Page content APIs → Session security: requires admin (evidence: `src/app/api/academics-content/route.ts`)
- Page content APIs → MongoDB client: reads and writes (evidence: `src/app/api/academics-content/route.ts`)
- Collection access → MongoDB client: uses client (evidence: `src/lib/server/collections.ts`)
- MongoDB client → MongoDB: connects
- Content managers → Image storage: uploads images (evidence: `src/components/admin/NewsManager.tsx`)
- Image storage → Vercel Blob: stores files
- Server actions → Image storage: uploads images (evidence: `src/lib/server/actions.ts`)
- Server actions → Content seeding: seeds content (evidence: `src/lib/server/actions.ts`)
