# dharansjit/nptel_score_checker architecture

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

- Interactive diagram: https://gitdiagram.com/dharansjit/nptel_score_checker
- Repository: https://github.com/dharansjit/nptel_score_checker

## Overview

#### Purpose and Runtime

NPTEL Score Checker is a browser-based calculator for the assignment portion of NPTEL courses. Users enter weekly marks, select a 4-, 8-, or 12-week pattern, and receive a score out of 25 based on the required highest scores. The primary runtime is a React/TypeScript SPA built by Vite; Express serves the built frontend in production.

Entry points:
- `client/src/main.tsx`
- `client/src/App.tsx`
- `server/index.ts`

#### Application Shell and Navigation

`App.tsx` establishes the client application shell, global providers, route selection, and shared UI behavior. Wouter is the routing layer, separating the interactive calculator from informational and history pages.

Primary page boundaries:
- `client/src/pages/Home.tsx`
- `client/src/pages/History.tsx`
- `client/src/pages/HowToCalculate.tsx`
- `client/src/pages/NptelGuidelines.tsx`
- `client/src/pages/NotFound.tsx`

#### Score Input and Calculation Pipeline

The Home page composes the calculator workflow. `ScoreInput` collects a course duration and assignment values; changes flow through composition/state logic and then into the pure scoring calculation. The calculator selects the applicable number of top weekly scores, normalizes against the selected maximum, and produces the assignment component out of 25 plus pass/fail status.

Core calculation boundary:
- `client/src/components/ScoreInput.tsx`
- `client/src/hooks/useComposition.ts`
- `client/src/lib/scoreCalculator.ts`
- `shared/const.ts`

Keeping calculation logic in `scoreCalculator.ts` makes score rules independent of React rendering and reusable by UI stages.

#### Result Presentation and Interaction Safety

Calculated outputs are rendered as a result card, with animation styling and notification/error containment around user interactions. The UI is componentized around input, results, history access, and feedback rather than a server API.

Key presentation components:
- `client/src/components/ResultCard.tsx`
- `client/src/components/ErrorBoundary.tsx`
- `client/src/components/Toast.tsx`
- `client/src/animations.css`

Reusable design-system primitives are under `client/src/components/ui/`.

#### Local Persistence and History

There is no database or remote history service. Calculation records are persisted in browser local storage, retrieved for the History page/panel, reopened for review, and exported to CSV. This is an important client-storage boundary: saved data is per browser and subject to local-storage availability and clearing.

Persistence/history paths:
- `client/src/lib/storage.ts`
- `client/src/hooks/usePersistFn.ts`
- `client/src/components/HistoryPanel.tsx`
- `client/src/pages/History.tsx`

#### Theme and Client State

Theme preference is maintained through a React context, while calculator state is local to the interactive composition flow. The architecture is predominantly client-side: no indicated backend calculation, authentication, or external service dependency.

Relevant paths:
- `client/src/contexts/ThemeContext.tsx`
- `client/src/hooks/useComposition.ts`
- `client/src/App.tsx`

#### Build and Deployment Boundary

Vite builds the SPA from `client/index.html`; the Express entry point serves production static assets. Deployment is configured for Vercel, while package scripts support local Vite development and compiled-server production startup.

Infrastructure paths:
- `vite.config.ts`
- `server/index.ts`
- `vercel.json`
- `client/index.html`

Main entry points: [`client/src/App.tsx`](https://github.com/dharansjit/nptel_score_checker/blob/main/client/src/App.tsx) (Application shell), [`client/src/hooks/useComposition.ts`](https://github.com/dharansjit/nptel_score_checker/blob/main/client/src/hooks/useComposition.ts) (Calculator state), [`vite.config.ts`](https://github.com/dharansjit/nptel_score_checker/blob/main/vite.config.ts) (Vite build), [`client/src/main.tsx`](https://github.com/dharansjit/nptel_score_checker/blob/main/client/src/main.tsx) (Client bootstrap)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_spa["React SPA"]
  node_main["Client bootstrap<br/>React entry<br/>[main.tsx]"]
  node_app["Application shell<br/>React routes/providers<br/>[App.tsx]"]
  node_theme["Theme state<br/>React context<br/>[ThemeContext.tsx]"]
  node_home["Calculator page<br/>route page<br/>[Home.tsx]"]
  node_info_pages["Information pages<br/>route pages"]
  node_feedback["UI safety &amp; feedback<br/>error and toast UI"]
end

subgraph group_scoring["Scoring workflow"]
  node_score_input["Score input<br/>calculator component<br/>[ScoreInput.tsx]"]
  node_composition["Calculator state<br/>React hook<br/>[useComposition.ts]"]
  node_calculator["Score calculator<br/>pure scoring rules<br/>[scoreCalculator.ts]"]
  node_constants["Course patterns<br/>shared constants<br/>[const.ts]"]
  node_result["Result card<br/>result component<br/>[ResultCard.tsx]"]
end

subgraph group_history["Local history"]
  node_history_page["History page<br/>route page<br/>[History.tsx]"]
  node_history_panel["History panel<br/>history component<br/>[HistoryPanel.tsx]"]
  node_storage[("Browser local storage<br/>client persistence<br/>[storage.ts]")]
  node_persist["Persistence hook<br/>React hook<br/>[usePersistFn.ts]"]
end

subgraph group_delivery["Build &amp; delivery"]
  node_html["SPA HTML entry<br/>Vite entry<br/>[index.html]"]
  node_vite["Vite build<br/>SPA bundler<br/>[vite.config.ts]"]
  node_express["Production server<br/>Express static host<br/>[index.ts]"]
  node_vercel["Vercel deployment<br/>deployment config<br/>[vercel.json]"]
end

node_html -->|"loads"| node_main
node_main -->|"mounts"| node_app
node_app -->|"provides"| node_theme
node_app -->|"routes to"| node_home
node_app -->|"routes to"| node_history_page
node_app -->|"routes to"| node_info_pages
node_home -->|"composes"| node_score_input
node_score_input -->|"updates"| node_composition
node_composition -->|"calculates with"| node_calculator
node_calculator -->|"uses patterns"| node_constants
node_composition -->|"supplies result"| node_result
node_composition -->|"saves calculations"| node_persist
node_persist -->|"reads and writes"| node_storage
node_history_page -->|"renders"| node_history_panel
node_history_panel -->|"loads, reopens, exports"| node_storage
node_app -->|"contains interaction failures"| node_feedback
node_vite -->|"builds from"| node_html
node_vite -->|"produces static assets for"| node_express
node_vercel -.->|"deploys"| node_express

click node_html "https://github.com/dharansjit/nptel_score_checker/blob/main/client/index.html"
click node_main "https://github.com/dharansjit/nptel_score_checker/blob/main/client/src/main.tsx"
click node_app "https://github.com/dharansjit/nptel_score_checker/blob/main/client/src/App.tsx"
click node_theme "https://github.com/dharansjit/nptel_score_checker/blob/main/client/src/contexts/ThemeContext.tsx"
click node_home "https://github.com/dharansjit/nptel_score_checker/blob/main/client/src/pages/Home.tsx"
click node_history_page "https://github.com/dharansjit/nptel_score_checker/blob/main/client/src/pages/History.tsx"
click node_score_input "https://github.com/dharansjit/nptel_score_checker/blob/main/client/src/components/ScoreInput.tsx"
click node_composition "https://github.com/dharansjit/nptel_score_checker/blob/main/client/src/hooks/useComposition.ts"
click node_calculator "https://github.com/dharansjit/nptel_score_checker/blob/main/client/src/lib/scoreCalculator.ts"
click node_constants "https://github.com/dharansjit/nptel_score_checker/blob/main/shared/const.ts"
click node_result "https://github.com/dharansjit/nptel_score_checker/blob/main/client/src/components/ResultCard.tsx"
click node_history_panel "https://github.com/dharansjit/nptel_score_checker/blob/main/client/src/components/HistoryPanel.tsx"
click node_storage "https://github.com/dharansjit/nptel_score_checker/blob/main/client/src/lib/storage.ts"
click node_persist "https://github.com/dharansjit/nptel_score_checker/blob/main/client/src/hooks/usePersistFn.ts"
click node_vite "https://github.com/dharansjit/nptel_score_checker/blob/main/vite.config.ts"
click node_express "https://github.com/dharansjit/nptel_score_checker/blob/main/server/index.ts"
click node_vercel "https://github.com/dharansjit/nptel_score_checker/blob/main/vercel.json"

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_main,node_app,node_theme,node_home,node_info_pages,node_feedback toneBlue
class node_score_input,node_composition,node_calculator,node_constants,node_result toneAmber
class node_history_page,node_history_panel,node_storage,node_persist toneMint
class node_html,node_vite,node_express,node_vercel toneRose
```

## Components

### React SPA

- [Client bootstrap](https://github.com/dharansjit/nptel_score_checker/blob/main/client/src/main.tsx): React entry · `client/src/main.tsx`
- [Application shell](https://github.com/dharansjit/nptel_score_checker/blob/main/client/src/App.tsx): React routes/providers · `client/src/App.tsx`
- [Theme state](https://github.com/dharansjit/nptel_score_checker/blob/main/client/src/contexts/ThemeContext.tsx): React context · `client/src/contexts/ThemeContext.tsx`
- [Calculator page](https://github.com/dharansjit/nptel_score_checker/blob/main/client/src/pages/Home.tsx): route page · `client/src/pages/Home.tsx`
- **Information pages**: route pages · Calculation guidance, NPTEL guidelines, and not-found views.
- **UI safety & feedback**: error and toast UI

### Scoring workflow

- [Score input](https://github.com/dharansjit/nptel_score_checker/blob/main/client/src/components/ScoreInput.tsx): calculator component · `client/src/components/ScoreInput.tsx`
- [Calculator state](https://github.com/dharansjit/nptel_score_checker/blob/main/client/src/hooks/useComposition.ts): React hook · `client/src/hooks/useComposition.ts`
- [Score calculator](https://github.com/dharansjit/nptel_score_checker/blob/main/client/src/lib/scoreCalculator.ts): pure scoring rules · Selects required top scores and computes the assignment score out of 25. · `client/src/lib/scoreCalculator.ts`
- [Course patterns](https://github.com/dharansjit/nptel_score_checker/blob/main/shared/const.ts): shared constants · `shared/const.ts`
- [Result card](https://github.com/dharansjit/nptel_score_checker/blob/main/client/src/components/ResultCard.tsx): result component · `client/src/components/ResultCard.tsx`

### Local history

- [History page](https://github.com/dharansjit/nptel_score_checker/blob/main/client/src/pages/History.tsx): route page · `client/src/pages/History.tsx`
- [History panel](https://github.com/dharansjit/nptel_score_checker/blob/main/client/src/components/HistoryPanel.tsx): history component · Reopens saved calculations and exports records to CSV. · `client/src/components/HistoryPanel.tsx`
- [Browser local storage](https://github.com/dharansjit/nptel_score_checker/blob/main/client/src/lib/storage.ts): client persistence · Records are browser-local and can be cleared by the user. · `client/src/lib/storage.ts`
- [Persistence hook](https://github.com/dharansjit/nptel_score_checker/blob/main/client/src/hooks/usePersistFn.ts): React hook · `client/src/hooks/usePersistFn.ts`

### Build & delivery

- [SPA HTML entry](https://github.com/dharansjit/nptel_score_checker/blob/main/client/index.html): Vite entry · `client/index.html`
- [Vite build](https://github.com/dharansjit/nptel_score_checker/blob/main/vite.config.ts): SPA bundler · `vite.config.ts`
- [Production server](https://github.com/dharansjit/nptel_score_checker/blob/main/server/index.ts): Express static host · Serves built SPA assets in production. · `server/index.ts`
- [Vercel deployment](https://github.com/dharansjit/nptel_score_checker/blob/main/vercel.json): deployment config · `vercel.json`

## Connections

- SPA HTML entry → Client bootstrap: loads
- Client bootstrap → Application shell: mounts
- Application shell → Theme state: provides
- Application shell → Calculator page: routes to
- Application shell → History page: routes to
- Application shell → Information pages: routes to
- Calculator page → Score input: composes
- Score input → Calculator state: updates
- Calculator state → Score calculator: calculates with
- Score calculator → Course patterns: uses patterns
- Calculator state → Result card: supplies result
- Calculator state → Persistence hook: saves calculations
- Persistence hook → Browser local storage: reads and writes
- History page → History panel: renders
- History panel → Browser local storage: loads, reopens, exports
- Application shell → UI safety & feedback: contains interaction failures
- Vite build → SPA HTML entry: builds from
- Vite build → Production server: produces static assets for
- Vercel deployment → Production server: deploys
