# rithusona35-cpu/ncct-final-website-and-app architecture

> Architecture diagram of the GitHub repository rithusona35-cpu/ncct-final-website-and-app, 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/rithusona35-cpu/ncct-final-website-and-app
- Repository: https://github.com/rithusona35-cpu/ncct-final-website-and-app

## Overview

NCCT Skill Ecosystem is a role-based training and employment frontend delivered as a Next.js PWA. Its user journey spans trainee learning and assessment, skill-gap and passport outcomes, and employer matching; trainer and admin workspaces support delivery and operations. The frontend also provides authenticated API access, offline caching and queued synchronization, and on-device AI features. Several portal routes and integrations are represented at directory level from the tree and README; their individual implementations were not sampled, so only documented or indexed relationships are shown.

Main entry points: [`src/lib/api.ts`](https://github.com/rithusona35-cpu/ncct-final-website-and-app/blob/ncct-front/src/lib/api.ts) (Backend API client), [`lib/local-runtime/local-db.ts`](https://github.com/rithusona35-cpu/ncct-final-website-and-app/blob/ncct-front/lib/local-runtime/local-db.ts) (IndexedDB cache), [`lib/sync-engine/sync-orchestrator.ts`](https://github.com/rithusona35-cpu/ncct-final-website-and-app/blob/ncct-front/lib/sync-engine/sync-orchestrator.ts) (Sync orchestration), [`lib/hooks/useOfflineFirstQuery.ts`](https://github.com/rithusona35-cpu/ncct-final-website-and-app/blob/ncct-front/lib/hooks/useOfflineFirstQuery.ts) (Offline-first queries)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Role Portals"]
  node_trainee["Trainee workspace"]
  node_trainer["Trainer workspace"]
  node_employer["Employer workspace"]
  node_admin["Admin workspace"]
  node_kiosk["Attendance kiosk<br/>[page.tsx]"]
end

subgraph group_learning["Learning Outcomes"]
  node_learning["Courses and assessments<br/>[page.tsx]"]
  node_skillgap["Skill-gap analysis"]
  node_passport["Skill passport<br/>[page.tsx]"]
  node_matching["Employment matching<br/>[page.tsx]"]
  node_verification["Credential verification"]
end

subgraph group_runtime["Offline Runtime"]
  node_query["Offline-first queries"]
  node_database[("IndexedDB cache<br/>[local-db.ts]")]
  node_sync["Sync orchestration"]
  node_queue["Pending write queue<br/>[sync-queue.ts]"]
  node_network["Network monitor<br/>[network-monitor.ts]"]
  node_ai["Local chatbot<br/>[local-chatbot.ts]"]
  node_model["On-device model loader"]
end

subgraph group_platform["App Platform"]
  node_auth["Authentication<br/>[AuthContext.tsx]"]
  node_api["Backend API client<br/>[api.ts]"]
  node_serviceworker["PWA service worker<br/>[sw.js]"]
end

node_user(("Portal user"))
node_backend["NCCT backend"]

node_user -->|"signs in"| node_auth
node_auth -->|"verifies session"| node_api
node_user -->|"uses portal"| node_trainee
node_user -->|"uses portal"| node_trainer
node_user -->|"uses portal"| node_employer
node_user -->|"uses portal"| node_admin
node_trainee -.->|"accesses courses"| node_learning
node_learning -.->|"computes gaps"| node_skillgap
node_skillgap -->|"reads cached skills"| node_database
node_trainee -.->|"views passport"| node_passport
node_employer -->|"reviews candidates"| node_matching
node_user -.->|"verifies credential"| node_verification
node_learning -->|"loads course data"| node_api
node_matching -->|"loads matches"| node_api
node_api -->|"sends requests"| node_backend
node_query -->|"reads and caches"| node_database
node_query -->|"fetches online data"| node_api
node_query -->|"tracks sync status"| node_sync
node_sync -->|"checks connectivity"| node_network
node_sync -->|"updates cache"| node_database
node_sync -->|"pushes pending writes"| node_queue
node_queue -->|"stores queued writes"| node_database
node_ai -->|"loads model"| node_model
node_ai -->|"uses local data"| node_database
node_serviceworker -->|"supports offline app"| node_user

click node_auth "https://github.com/rithusona35-cpu/ncct-final-website-and-app/blob/ncct-front/src/context/AuthContext.tsx"
click node_trainee "https://github.com/rithusona35-cpu/ncct-final-website-and-app/tree/ncct-front/src/app/trainee"
click node_trainer "https://github.com/rithusona35-cpu/ncct-final-website-and-app/tree/ncct-front/src/app/trainer"
click node_employer "https://github.com/rithusona35-cpu/ncct-final-website-and-app/tree/ncct-front/src/app/employer"
click node_admin "https://github.com/rithusona35-cpu/ncct-final-website-and-app/tree/ncct-front/src/app/admin"
click node_kiosk "https://github.com/rithusona35-cpu/ncct-final-website-and-app/blob/ncct-front/src/app/kiosk/page.tsx"
click node_learning "https://github.com/rithusona35-cpu/ncct-final-website-and-app/blob/ncct-front/src/app/trainee/courses/page.tsx"
click node_skillgap "https://github.com/rithusona35-cpu/ncct-final-website-and-app/blob/ncct-front/lib/local-runtime/local-skill-gap-engine.ts"
click node_passport "https://github.com/rithusona35-cpu/ncct-final-website-and-app/blob/ncct-front/src/app/trainee/skill-passport/page.tsx"
click node_matching "https://github.com/rithusona35-cpu/ncct-final-website-and-app/blob/ncct-front/src/app/employer/matches/page.tsx"
click node_verification "https://github.com/rithusona35-cpu/ncct-final-website-and-app/tree/ncct-front/src/app/verify"
click node_api "https://github.com/rithusona35-cpu/ncct-final-website-and-app/blob/ncct-front/src/lib/api.ts"
click node_query "https://github.com/rithusona35-cpu/ncct-final-website-and-app/blob/ncct-front/lib/hooks/useOfflineFirstQuery.ts"
click node_database "https://github.com/rithusona35-cpu/ncct-final-website-and-app/blob/ncct-front/lib/local-runtime/local-db.ts"
click node_sync "https://github.com/rithusona35-cpu/ncct-final-website-and-app/blob/ncct-front/lib/sync-engine/sync-orchestrator.ts"
click node_queue "https://github.com/rithusona35-cpu/ncct-final-website-and-app/blob/ncct-front/lib/sync-engine/sync-queue.ts"
click node_network "https://github.com/rithusona35-cpu/ncct-final-website-and-app/blob/ncct-front/lib/sync-engine/network-monitor.ts"
click node_ai "https://github.com/rithusona35-cpu/ncct-final-website-and-app/blob/ncct-front/lib/local-runtime/local-chatbot.ts"
click node_model "https://github.com/rithusona35-cpu/ncct-final-website-and-app/blob/ncct-front/lib/local-runtime/local-model-loader.ts"
click node_serviceworker "https://github.com/rithusona35-cpu/ncct-final-website-and-app/blob/ncct-front/public/sw.js"

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_trainee,node_trainer,node_employer,node_admin,node_kiosk,node_user toneBlue
class node_learning,node_skillgap,node_passport,node_matching,node_verification toneAmber
class node_query,node_database,node_sync,node_queue,node_network,node_ai,node_model toneMint
class node_auth,node_api,node_serviceworker toneRose
class node_backend toneIndigo
```

## Components

### Role Portals

- [Trainee workspace](https://github.com/rithusona35-cpu/ncct-final-website-and-app/tree/ncct-front/src/app/trainee): `src/app/trainee`
- [Trainer workspace](https://github.com/rithusona35-cpu/ncct-final-website-and-app/tree/ncct-front/src/app/trainer): `src/app/trainer`
- [Employer workspace](https://github.com/rithusona35-cpu/ncct-final-website-and-app/tree/ncct-front/src/app/employer): `src/app/employer`
- [Admin workspace](https://github.com/rithusona35-cpu/ncct-final-website-and-app/tree/ncct-front/src/app/admin): `src/app/admin`
- [Attendance kiosk](https://github.com/rithusona35-cpu/ncct-final-website-and-app/blob/ncct-front/src/app/kiosk/page.tsx): `src/app/kiosk/page.tsx`

### Learning Outcomes

- [Courses and assessments](https://github.com/rithusona35-cpu/ncct-final-website-and-app/blob/ncct-front/src/app/trainee/courses/page.tsx): `src/app/trainee/courses/page.tsx`
- [Skill-gap analysis](https://github.com/rithusona35-cpu/ncct-final-website-and-app/blob/ncct-front/lib/local-runtime/local-skill-gap-engine.ts): `lib/local-runtime/local-skill-gap-engine.ts`
- [Skill passport](https://github.com/rithusona35-cpu/ncct-final-website-and-app/blob/ncct-front/src/app/trainee/skill-passport/page.tsx): `src/app/trainee/skill-passport/page.tsx`
- [Employment matching](https://github.com/rithusona35-cpu/ncct-final-website-and-app/blob/ncct-front/src/app/employer/matches/page.tsx): `src/app/employer/matches/page.tsx`
- [Credential verification](https://github.com/rithusona35-cpu/ncct-final-website-and-app/tree/ncct-front/src/app/verify): `src/app/verify`

### Offline Runtime

- [Offline-first queries](https://github.com/rithusona35-cpu/ncct-final-website-and-app/blob/ncct-front/lib/hooks/useOfflineFirstQuery.ts): `lib/hooks/useOfflineFirstQuery.ts`
- [IndexedDB cache](https://github.com/rithusona35-cpu/ncct-final-website-and-app/blob/ncct-front/lib/local-runtime/local-db.ts): `lib/local-runtime/local-db.ts`
- [Sync orchestration](https://github.com/rithusona35-cpu/ncct-final-website-and-app/blob/ncct-front/lib/sync-engine/sync-orchestrator.ts): `lib/sync-engine/sync-orchestrator.ts`
- [Pending write queue](https://github.com/rithusona35-cpu/ncct-final-website-and-app/blob/ncct-front/lib/sync-engine/sync-queue.ts): `lib/sync-engine/sync-queue.ts`
- [Network monitor](https://github.com/rithusona35-cpu/ncct-final-website-and-app/blob/ncct-front/lib/sync-engine/network-monitor.ts): `lib/sync-engine/network-monitor.ts`
- [Local chatbot](https://github.com/rithusona35-cpu/ncct-final-website-and-app/blob/ncct-front/lib/local-runtime/local-chatbot.ts): `lib/local-runtime/local-chatbot.ts`
- [On-device model loader](https://github.com/rithusona35-cpu/ncct-final-website-and-app/blob/ncct-front/lib/local-runtime/local-model-loader.ts): `lib/local-runtime/local-model-loader.ts`

### App Platform

- [Authentication](https://github.com/rithusona35-cpu/ncct-final-website-and-app/blob/ncct-front/src/context/AuthContext.tsx): `src/context/AuthContext.tsx`
- [Backend API client](https://github.com/rithusona35-cpu/ncct-final-website-and-app/blob/ncct-front/src/lib/api.ts): `src/lib/api.ts`
- [PWA service worker](https://github.com/rithusona35-cpu/ncct-final-website-and-app/blob/ncct-front/public/sw.js): `public/sw.js`

### Other components

- **Portal user**
- **NCCT backend**

## Connections

- Portal user → Authentication: signs in (evidence: `src/context/AuthContext.tsx`)
- Authentication → Backend API client: verifies session (evidence: `src/context/AuthContext.tsx`)
- Portal user → Trainee workspace: uses portal (evidence: `README.md`)
- Portal user → Trainer workspace: uses portal (evidence: `README.md`)
- Portal user → Employer workspace: uses portal (evidence: `README.md`)
- Portal user → Admin workspace: uses portal (evidence: `README.md`)
- Trainee workspace → Courses and assessments: accesses courses
- Courses and assessments → Skill-gap analysis: computes gaps
- Skill-gap analysis → IndexedDB cache: reads cached skills (evidence: `lib/local-runtime/local-skill-gap-engine.ts`)
- Trainee workspace → Skill passport: views passport
- Employer workspace → Employment matching: reviews candidates (evidence: `src/app/employer/matches/page.tsx`)
- Portal user → Credential verification: verifies credential
- Courses and assessments → Backend API client: loads course data (evidence: `src/app/trainee/courses/page.tsx`)
- Employment matching → Backend API client: loads matches (evidence: `src/app/employer/matches/page.tsx`)
- Backend API client → NCCT backend: sends requests (evidence: `src/lib/api.ts`)
- Offline-first queries → IndexedDB cache: reads and caches (evidence: `lib/hooks/useOfflineFirstQuery.ts`)
- Offline-first queries → Backend API client: fetches online data (evidence: `lib/hooks/useOfflineFirstQuery.ts`)
- Offline-first queries → Sync orchestration: tracks sync status (evidence: `lib/hooks/useOfflineFirstQuery.ts`)
- Sync orchestration → Network monitor: checks connectivity (evidence: `lib/sync-engine/sync-orchestrator.ts`)
- Sync orchestration → IndexedDB cache: updates cache (evidence: `lib/sync-engine/sync-orchestrator.ts`)
- Sync orchestration → Pending write queue: pushes pending writes (evidence: `lib/sync-engine/sync-orchestrator.ts`)
- Pending write queue → IndexedDB cache: stores queued writes (evidence: `lib/sync-engine/sync-queue.ts`)
- Local chatbot → On-device model loader: loads model (evidence: `lib/local-runtime/local-chatbot.ts`)
- Local chatbot → IndexedDB cache: uses local data (evidence: `lib/local-runtime/local-chatbot.ts`)
- PWA service worker → Portal user: supports offline app (evidence: `README.md`)
