How dharansjit/nptel_score_checker works
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: App.tsx Application shell · useComposition.ts Calculator state · vite.config.ts Vite build · main.tsx Client bootstrap
Components 19
React SPA
- Client bootstrap
client/src/main.tsx - Application shell
client/src/App.tsx - Theme state
client/src/contexts/ThemeContext.tsx - Calculator page
client/src/pages/Home.tsx - Information pages · Calculation guidance, NPTEL guidelines, and not-found views.
- UI safety & feedback
Scoring workflow
- Score input
client/src/components/ScoreInput.tsx - Calculator state
client/src/hooks/useComposition.ts - Score calculator · Selects required top scores and computes the assignment score out of 25.
client/src/lib/scoreCalculator.ts - Course patterns
shared/const.ts - Result card
client/src/components/ResultCard.tsx
Local history
- History page
client/src/pages/History.tsx - History panel · Reopens saved calculations and exports records to CSV.
client/src/components/HistoryPanel.tsx - Browser local storage · Records are browser-local and can be cleared by the user.
client/src/lib/storage.ts - Persistence hook
client/src/hooks/usePersistFn.ts
Build & delivery
- SPA HTML entry
client/index.html - Vite build
vite.config.ts - Production server · Serves built SPA assets in production.
server/index.ts - Vercel deployment
vercel.json
Connections 19
- 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