# nikhil210206/skipp architecture

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

- Interactive diagram: https://gitdiagram.com/nikhil210206/skipp
- Repository: https://github.com/nikhil210206/skipp

## Overview

#### Purpose and entry points
Skipp is a privacy-oriented SRM student companion: it converts portal attendance, marks, timetable, and academic-planner pages into a local-first installable PWA. The browser entry is the Next.js App Router root at `frontend/src/app/layout.tsx` and landing/login route at `frontend/src/app/page.tsx`. The server entry is FastAPI in `backend/main.py`, with Vercel’s Python handler at `backend/api/index.py`.

#### Client application shell and session boundary
The authenticated application is organized beneath the `(app)` route group, whose layout provides the persistent shell/navigation: `frontend/src/app/(app)/layout.tsx`, `frontend/src/components/AppShell.tsx`, and `frontend/src/context/SessionContext.tsx`. The session context is the main client-side boundary between login/refresh state and feature pages. Credentials and refreshed portal data remain device-side; the frontend sends credentials only for a refresh request.

#### Secure local persistence and backend API client
The client API and persistence layer mediates all server calls and cached snapshots: `frontend/src/lib/api.ts`, `frontend/src/lib/crypto.ts`, and `frontend/src/lib/__devFixture.ts`. Web Crypto AES-GCM and IndexedDB protect cached credentials/data locally. This cache prevents page navigation and reopening from repeatedly authenticating against SRM, which is important because the upstream portal applies CAPTCHA and daily login limits.

#### Portal authentication and scraping backend
FastAPI receives refresh/login work, then performs the cross-origin portal interaction server-side. Core request/session/client responsibilities are separated in `backend/core/client.py`, `backend/core/session.py`, and `backend/core/student_portal_client.py`. These components use the student’s supplied credentials in request memory, establish portal session/cookies, retrieve upstream HTML, parse it, return normalized JSON, and discard credentials/data rather than persisting them.

#### Domain models and normalized snapshot
Backend schemas define the contract returned to the PWA: `backend/models/snapshot.py`, `backend/models/attendance.py`, and `backend/models/student_portal.py`. The snapshot is the aggregate refresh payload; attendance, marks, schedule/timetable, and portal-planner data are transformed from portal-specific HTML into frontend-consumable structures. This model boundary isolates UI and prediction logic from changes in SRM markup.

#### Academic data pipelines and planning logic
Feature services independently parse or derive the key academic views: attendance in `backend/services/attendance.py`, marks in `backend/services/marks.py`, and timetable in `backend/services/unified_timetable.py`. `backend/services/academic_planner.py` builds calendar/day-order/holiday planning data. Client pages consume the cached snapshot for dashboard and dedicated workflows, including `frontend/src/app/(app)/attendance/page.tsx`, `frontend/src/app/(app)/calendar/page.tsx`, and `frontend/src/app/(app)/timetable/page.tsx`.

#### Predictions, customization, and device features
Attendance/leave and grade calculations are split between backend-oriented services such as `backend/services/predictor.py` and frontend interaction utilities such as `frontend/src/lib/predictor.ts` and `frontend/src/lib/leavePredictor.ts`. User-only adjustments—custom or optional classes—are local concerns via `frontend/src/lib/customClasses.ts`. The PWA/runtime layer uses `frontend/public/sw.js` for network-first caching, `frontend/src/components/PWARegister.tsx` for registration, and `frontend/src/lib/notify.ts` for local notifications; no push service or server-side student database exists.

#### Runtime and external dependencies
The frontend runs on Next.js 16/React 19/TypeScript, deployable as web plus Capacitor Android/iOS shells (`frontend/capacitor.config.ts`, `frontend/android/app/src/main/java/life/skipp/app/MainActivity.java`, `frontend/ios/App/App/AppDelegate.swift`). The backend is Python/FastAPI deployed through Vercel configuration (`backend/vercel.json`). Its sole material external data service is `academia.srmist.edu.in`; Vercel cookieless analytics/speed insights are the stated telemetry integration.

Main entry points: [`frontend/src/app/(app)/attendance/page.tsx`](https://github.com/nikhil210206/skipp/blob/main/frontend/src/app/(app)/attendance/page.tsx) (Academic views), [`backend/core/student_portal_client.py`](https://github.com/nikhil210206/skipp/blob/main/backend/core/student_portal_client.py) (Portal scraper), [`frontend/src/app/layout.tsx`](https://github.com/nikhil210206/skipp/blob/main/frontend/src/app/layout.tsx) (App root & login), [`frontend/src/lib/api.ts`](https://github.com/nikhil210206/skipp/blob/main/frontend/src/lib/api.ts) (API & cache mediator)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Next.js PWA"]
  node_web_entry["App root &amp; login<br/>Next.js routes<br/>[layout.tsx]"]
  node_app_shell["Authenticated shell<br/>route layout<br/>[layout.tsx]"]
  node_session["Session context<br/>client state<br/>[SessionContext.tsx]"]
  node_feature_pages["Academic views<br/>route pages<br/>[page.tsx]"]
  node_api_client["API &amp; cache mediator<br/>client data layer<br/>[api.ts]"]
  node_encrypted_cache[("Encrypted local cache<br/>IndexedDB + AES-GCM<br/>[crypto.ts]")]
  node_client_predictions["Client predictions<br/>interaction logic<br/>[leavePredictor.ts]"]
  node_custom_classes["Custom classes<br/>local customization<br/>[customClasses.ts]"]
  node_pwa_runtime["PWA runtime<br/>service worker<br/>[sw.js]"]
  node_pwa_registration["PWA registration<br/>runtime setup<br/>[PWARegister.tsx]"]
end

subgraph group_backend["FastAPI refresh service"]
  node_fastapi_entry["FastAPI API<br/>server entry<br/>[main.py]"]
  node_vercel_handler["Vercel Python handler<br/>serverless entry<br/>[index.py]"]
  node_portal_session["Portal session client<br/>request/session layer<br/>[session.py]"]
  node_portal_scraper["Portal scraper<br/>upstream client"]
  node_academic_services["Academic parsers<br/>domain services<br/>[attendance.py]"]
  node_planner_service["Academic planner<br/>planning service"]
  node_backend_predictor["Backend predictor<br/>calculation service<br/>[predictor.py]"]
  node_snapshot_contract["Normalized snapshot<br/>response schemas<br/>[snapshot.py]"]
end

subgraph group_portal["SRM portal"]
  node_srm_portal{{"academia.srmist.edu.in<br/>external academic portal"}}
end

subgraph group_mobile["Native shells"]
  node_native_shells["Android &amp; iOS shells<br/>Capacitor hosts"]
end

node_telemetry["Vercel telemetry<br/>analytics integration"]

node_web_entry -->|"enters after login"| node_app_shell
node_app_shell -->|"provides session"| node_session
node_app_shell -->|"hosts"| node_feature_pages
node_session -->|"requests refresh"| node_api_client
node_api_client -->|"reads and writes"| node_encrypted_cache
node_feature_pages -->|"uses cached snapshot"| node_encrypted_cache
node_feature_pages -->|"calculates scenarios"| node_client_predictions
node_feature_pages -->|"applies adjustments"| node_custom_classes
node_pwa_registration -->|"registers"| node_pwa_runtime
node_pwa_runtime -->|"caches runtime"| node_web_entry
node_api_client -->|"refresh request"| node_fastapi_entry
node_vercel_handler -->|"invokes"| node_fastapi_entry
node_fastapi_entry -->|"starts request session"| node_portal_session
node_portal_session -->|"supplies session cookies"| node_portal_scraper
node_portal_scraper -->|"fetches portal HTML"| node_srm_portal
node_portal_scraper -->|"source HTML"| node_academic_services
node_portal_scraper -->|"source HTML"| node_planner_service
node_academic_services -->|"normalizes data"| node_snapshot_contract
node_planner_service -->|"adds planning data"| node_snapshot_contract
node_backend_predictor -->|"adds derived results"| node_snapshot_contract
node_snapshot_contract -->|"normalized JSON"| node_api_client
node_native_shells -->|"hosts web app"| node_web_entry
node_web_entry -.->|"reports anonymous metrics"| node_telemetry

click node_web_entry "https://github.com/nikhil210206/skipp/blob/main/frontend/src/app/layout.tsx"
click node_app_shell "https://github.com/nikhil210206/skipp/blob/main/frontend/src/app/(app)/layout.tsx"
click node_session "https://github.com/nikhil210206/skipp/blob/main/frontend/src/context/SessionContext.tsx"
click node_feature_pages "https://github.com/nikhil210206/skipp/blob/main/frontend/src/app/(app)/attendance/page.tsx"
click node_api_client "https://github.com/nikhil210206/skipp/blob/main/frontend/src/lib/api.ts"
click node_encrypted_cache "https://github.com/nikhil210206/skipp/blob/main/frontend/src/lib/crypto.ts"
click node_client_predictions "https://github.com/nikhil210206/skipp/blob/main/frontend/src/lib/leavePredictor.ts"
click node_custom_classes "https://github.com/nikhil210206/skipp/blob/main/frontend/src/lib/customClasses.ts"
click node_pwa_runtime "https://github.com/nikhil210206/skipp/blob/main/frontend/public/sw.js"
click node_pwa_registration "https://github.com/nikhil210206/skipp/blob/main/frontend/src/components/PWARegister.tsx"
click node_fastapi_entry "https://github.com/nikhil210206/skipp/blob/main/backend/main.py"
click node_vercel_handler "https://github.com/nikhil210206/skipp/blob/main/backend/api/index.py"
click node_portal_session "https://github.com/nikhil210206/skipp/blob/main/backend/core/session.py"
click node_portal_scraper "https://github.com/nikhil210206/skipp/blob/main/backend/core/student_portal_client.py"
click node_academic_services "https://github.com/nikhil210206/skipp/blob/main/backend/services/attendance.py"
click node_planner_service "https://github.com/nikhil210206/skipp/blob/main/backend/services/academic_planner.py"
click node_backend_predictor "https://github.com/nikhil210206/skipp/blob/main/backend/services/predictor.py"
click node_snapshot_contract "https://github.com/nikhil210206/skipp/blob/main/backend/models/snapshot.py"
click node_native_shells "https://github.com/nikhil210206/skipp/blob/main/frontend/capacitor.config.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_web_entry,node_app_shell,node_session,node_feature_pages,node_api_client,node_encrypted_cache,node_client_predictions,node_custom_classes,node_pwa_runtime,node_pwa_registration toneBlue
class node_fastapi_entry,node_vercel_handler,node_portal_session,node_portal_scraper,node_academic_services,node_planner_service,node_backend_predictor,node_snapshot_contract toneAmber
class node_srm_portal toneMint
class node_native_shells toneRose
class node_telemetry toneNeutral
```

## Components

### Next.js PWA

- [App root & login](https://github.com/nikhil210206/skipp/blob/main/frontend/src/app/layout.tsx): Next.js routes · `frontend/src/app/layout.tsx`
- [Authenticated shell](https://github.com/nikhil210206/skipp/blob/main/frontend/src/app/(app)/layout.tsx): route layout · `frontend/src/app/(app)/layout.tsx`
- [Session context](https://github.com/nikhil210206/skipp/blob/main/frontend/src/context/SessionContext.tsx): client state · Controls login and refresh state for feature pages. · `frontend/src/context/SessionContext.tsx`
- [Academic views](https://github.com/nikhil210206/skipp/blob/main/frontend/src/app/(app)/attendance/page.tsx): route pages · Attendance, calendar, and timetable workflows consume snapshots. · `frontend/src/app/(app)/attendance/page.tsx`
- [API & cache mediator](https://github.com/nikhil210206/skipp/blob/main/frontend/src/lib/api.ts): client data layer · `frontend/src/lib/api.ts`
- [Encrypted local cache](https://github.com/nikhil210206/skipp/blob/main/frontend/src/lib/crypto.ts): IndexedDB + AES-GCM · Keeps credentials and refreshed snapshots device-local. · `frontend/src/lib/crypto.ts`
- [Client predictions](https://github.com/nikhil210206/skipp/blob/main/frontend/src/lib/leavePredictor.ts): interaction logic · Leave and attendance prediction utilities. · `frontend/src/lib/leavePredictor.ts`
- [Custom classes](https://github.com/nikhil210206/skipp/blob/main/frontend/src/lib/customClasses.ts): local customization · `frontend/src/lib/customClasses.ts`
- [PWA runtime](https://github.com/nikhil210206/skipp/blob/main/frontend/public/sw.js): service worker · Provides network-first caching. · `frontend/public/sw.js`
- [PWA registration](https://github.com/nikhil210206/skipp/blob/main/frontend/src/components/PWARegister.tsx): runtime setup · `frontend/src/components/PWARegister.tsx`

### FastAPI refresh service

- [FastAPI API](https://github.com/nikhil210206/skipp/blob/main/backend/main.py): server entry · Receives login and refresh work. · `backend/main.py`
- [Vercel Python handler](https://github.com/nikhil210206/skipp/blob/main/backend/api/index.py): serverless entry · `backend/api/index.py`
- [Portal session client](https://github.com/nikhil210206/skipp/blob/main/backend/core/session.py): request/session layer · Uses supplied credentials only in request memory. · `backend/core/session.py`
- [Portal scraper](https://github.com/nikhil210206/skipp/blob/main/backend/core/student_portal_client.py): upstream client · Fetches and parses portal HTML and cookies. · `backend/core/student_portal_client.py`
- [Academic parsers](https://github.com/nikhil210206/skipp/blob/main/backend/services/attendance.py): domain services · Parses attendance, marks, and unified timetable data. · `backend/services/attendance.py`
- [Academic planner](https://github.com/nikhil210206/skipp/blob/main/backend/services/academic_planner.py): planning service · Builds calendar, day-order, and holiday data. · `backend/services/academic_planner.py`
- [Backend predictor](https://github.com/nikhil210206/skipp/blob/main/backend/services/predictor.py): calculation service · `backend/services/predictor.py`
- [Normalized snapshot](https://github.com/nikhil210206/skipp/blob/main/backend/models/snapshot.py): response schemas · Aggregate API contract isolating clients from portal markup. · `backend/models/snapshot.py`

### SRM portal

- **academia.srmist.edu.in**: external academic portal · Sole material external data source.

### Native shells

- [Android & iOS shells](https://github.com/nikhil210206/skipp/blob/main/frontend/capacitor.config.ts): Capacitor hosts · `frontend/capacitor.config.ts`

### Other components

- **Vercel telemetry**: analytics integration · Cookieless analytics and speed insights.

## Connections

- App root & login → Authenticated shell: enters after login
- Authenticated shell → Session context: provides session
- Authenticated shell → Academic views: hosts
- Session context → API & cache mediator: requests refresh
- API & cache mediator → Encrypted local cache: reads and writes
- Academic views → Encrypted local cache: uses cached snapshot
- Academic views → Client predictions: calculates scenarios
- Academic views → Custom classes: applies adjustments
- PWA registration → PWA runtime: registers
- PWA runtime → App root & login: caches runtime
- API & cache mediator → FastAPI API: refresh request · Credentials are sent only for refresh.
- Vercel Python handler → FastAPI API: invokes
- FastAPI API → Portal session client: starts request session
- Portal session client → Portal scraper: supplies session cookies
- Portal scraper → academia.srmist.edu.in: fetches portal HTML
- Portal scraper → Academic parsers: source HTML
- Portal scraper → Academic planner: source HTML
- Academic parsers → Normalized snapshot: normalizes data
- Academic planner → Normalized snapshot: adds planning data
- Backend predictor → Normalized snapshot: adds derived results
- Normalized snapshot → API & cache mediator: normalized JSON
- Android & iOS shells → App root & login: hosts web app
- App root & login → Vercel telemetry: reports anonymous metrics
