# nehasreenidhi/interns-skill-management architecture

> Architecture diagram of the GitHub repository nehasreenidhi/interns-skill-management, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-02-19). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/nehasreenidhi/interns-skill-management
- Repository: https://github.com/nehasreenidhi/interns-skill-management

## Overview

##### What this project is (type + purpose)
This is a **monolithic Flask web application** (single `app.py`) serving **server-rendered HTML pages (Jinja templates)** with static assets, backed by **MongoDB** for persistence. It adds a **semantic search subsystem** using **Sentence-Transformers embeddings** + **FAISS vector index** so mentors can search interns by intent rather than exact keyword match.

Core purpose: **intern skill portfolio management + mentor discovery/search**.

##### What the file tree tells you about architecture
From the tree:

- `app.py`
Likely contains **Flask app initialization, route handlers, auth logic, DB access, and FAISS/embedding integration**. Since there’s no `blueprints/`, `services/`, or `models/` directories, expect a **single-file “modular-by-functions”** structure.

- `templates/*.html`
Server-rendered UI. Templates map closely to **user-facing modules/pages**, which is useful for diagramming functional components:
- `landingPage.html`
- `login.html`, `register.html`, `reset_password.html` (auth flows)
- `intern_dashboard.html`, `intern_profile.html`
- `mentor_dashboard.html`, `search_interns.html`
- `profile_settings.html`

- `static/styles.css`, `static/images/*`
Frontend static assets. Charting is likely done in templates via **Chart.js** (even if not shown in tree, README states it).

- A single deployable Flask service
- Server-rendered HTML views
- MongoDB for document storage
- Embedding model + FAISS index for semantic search
- Password hashing using bcrypt

##### What the README adds (runtime components and flows)
The README defines a **two-role system** (Intern vs Mentor) and a **data/ML pipeline**:
- Skills stored in MongoDB
- Skill names embedded via Sentence-Transformers (`all-MiniLM-L6-v2`)
- Embeddings indexed in FAISS for fast similarity search
- Mentors query -> embedded -> searched in FAISS -> matching interns returned
- Visualizations: pie charts + activity heatmap (frontend rendering, backend provides data)

##### Semantic search path (embedding + indexing + querying)

- Actors: Intern, Mentor
- System: Intern Skill Management System (Flask)
- External: MongoDB, Sentence-Transformers model, FAISS index
- Purpose: communicate boundaries and who uses what

- Browser (HTML/Chart.js)
- Flask web app
- MongoDB
- FAISS index store
- Embedding model component

- Intern updates skills → embedding → FAISS update
- Mentor search → embedding → FAISS query → MongoDB hydrate

##### When and how the FAISS index updates
- On every skill change? scheduled rebuild? startup build?

##### Identifier mapping
- FAISS returns vector IDs → those map to intern/user IDs in MongoDB. Show this hydration step explicitly.

##### Where Chart.js runs
- In browser; Flask only supplies the data. Show Chart.js on the client side.

##### Security boundary
- Password hashing with bcrypt in Flask before MongoDB write; never store plaintext passwords.

## Diagram (Mermaid)

```mermaid
flowchart TD
  %% =========================
  %% Actors (Context - C4 L1)
  %% =========================
  subgraph "Actors"
    Intern["Intern"]:::actor
    Mentor["Mentor"]:::actor
  end

  %% =========================
  %% Client / Presentation
  %% =========================
  subgraph "Client / Presentation (Browser)"
    Browser["Web Browser"]:::runtime
    SSR["SSR HTML UI (Jinja Templates)"]:::ui
    Charts["Chart.js (Client-side Charts + Heatmap)"]:::clientlib

    subgraph "UI Pages (Templates)"
      TLanding["landingPage.html"]:::template
      TLogin["login.html"]:::template
      TRegister["register.html"]:::template
      TReset["reset_password.html"]:::template
      TInternDash["intern_dashboard.html"]:::template
      TInternProfile["intern_profile.html"]:::template
      TProfileSettings["profile_settings.html"]:::template
      TMentorDash["mentor_dashboard.html"]:::template
      TSearch["search_interns.html"]:::template
    end

    StaticCSS["styles.css"]:::static
    StaticImages["images/*"]:::static
  end

  %% =========================
  %% Application (Container - C4 L2)
  %% =========================
  subgraph "Monolithic Web Application"
    Flask["Flask App (Python)"]:::runtime
    Routes["Route Handlers + Role-based Routing"]:::service
    Render["Template Rendering (Jinja)"]:::service

    subgraph "Auth & Security"
      Auth["Auth Flows (Login/Register/Reset)"]:::service
      Bcrypt["bcrypt (Hash/Verify Passwords)"]:::security
    end

    subgraph "Intern Portfolio Management"
      SkillsCRUD["Skills CRUD + Profile Settings"]:::service
      ActivityLog["Activity Logging (Heatmap Data)"]:::service
    end

    subgraph "Mentor Discovery"
      MentorSearch["Semantic Search Handlers"]:::service
      Hydrate["Hydrate Search Results (IDs → Profiles)"]:::service
    end
  end

  %% =========================
  %% Data Stores
  %% =========================
  subgraph "Persistence"
    Mongo[("MongoDB\nUsers + Skills + Activity")]:::datastore
  end

  %% =========================
  %% Semantic Search Subsystem
  %% =========================
  subgraph "Semantic Search Subsystem"
    Embed["Embedding Generator\nSentence-Transformers (all-MiniLM-L6-v2)"]:::ml
    Faiss[("FAISS Vector Index\n(derived from MongoDB skills)")]:::vectorstore
    IndexUpdate["Index Update Path\n(on skill changes; TBD rebuild policy)"]:::service
  end

  %% =========================
  %% Context relationships
  %% =========================
  Intern -->|"uses"| Browser
  Mentor -->|"uses"| Browser

  %% =========================
  %% Client <-> App interactions (HTTP + SSR)
  %% =========================
  Browser -->|"HTTP GET/POST"| Flask
  Flask -->|"Render HTML (Jinja)"| Browser

  Browser -->|"loads"| StaticCSS
  Browser -->|"loads"| StaticImages
  Browser -->|"renders charts via"| Charts
  Browser -->|"displays"| SSR

  Render -->|"renders"| SSR
  SSR -->|"includes"| TLanding
  SSR -->|"includes"| TLogin
  SSR -->|"includes"| TRegister
  SSR -->|"includes"| TReset
  SSR -->|"includes"| TInternDash
  SSR -->|"includes"| TInternProfile
  SSR -->|"includes"| TProfileSettings
  SSR -->|"includes"| TMentorDash
  SSR -->|"includes"| TSearch

  %% =========================
  %% Internal app wiring
  %% =========================
  Flask -->|"dispatches to"| Routes
  Routes -->|"auth routes"| Auth
  Routes -->|"intern routes"| SkillsCRUD
  Routes -->|"intern routes"| ActivityLog
  Routes -->|"mentor routes"| MentorSearch
  Flask -->|"calls"| Render

  %% =========================
  %% Auth & Role routing flow
  %% =========================
  Auth -->|"hash/verify"| Bcrypt
  Auth <-->|"read/write user"| Mongo

  %% =========================
  %% Intern write path (CRUD → embeddings → FAISS)
  %% =========================
  SkillsCRUD <-->|"read/write skills + profile"| Mongo
  ActivityLog <-->|"write activity events"| Mongo
  SkillsCRUD -->|"on skill change"| IndexUpdate
  IndexUpdate -->|"generate embeddings"| Embed
  Embed -->|"vectors"| Faiss
  Mongo -.->|"skills are source of truth (derived index)"| Faiss

  %% =========================
  %% Mentor search path (query → embedding → FAISS → hydrate from MongoDB)
  %% =========================
  MentorSearch -->|"embed query"| Embed
  MentorSearch -->|"similarity search (top-k)"| Faiss
  Faiss -->|"returns vector IDs"| Hydrate
  Hydrate <-->|"fetch intern profiles by IDs"| Mongo
  Hydrate -->|"results data"| Render

  %% =========================
  %% Page intent hints (vertical callouts)
  %% =========================
  TInternDash -->|"requests dashboard data"| Routes
  TMentorDash -->|"navigates to search"| TSearch
  TSearch -->|"submits query"| Routes
  TProfileSettings -->|"edits skills/profile"| Routes

  %% =========================
  %% Click Events (mapped components)
  %% =========================
  click Flask "https://github.com/nehasreenidhi/interns-skill-management/blob/main/app.py"
  click SSR "https://github.com/nehasreenidhi/interns-skill-management/tree/main/templates/"
  click TLanding "https://github.com/nehasreenidhi/interns-skill-management/blob/main/templates/landingPage.html"
  click TLogin "https://github.com/nehasreenidhi/interns-skill-management/blob/main/templates/login.html"
  click TRegister "https://github.com/nehasreenidhi/interns-skill-management/blob/main/templates/register.html"
  click TReset "https://github.com/nehasreenidhi/interns-skill-management/blob/main/templates/reset_password.html"
  click TInternDash "https://github.com/nehasreenidhi/interns-skill-management/blob/main/templates/intern_dashboard.html"
  click TInternProfile "https://github.com/nehasreenidhi/interns-skill-management/blob/main/templates/intern_profile.html"
  click TProfileSettings "https://github.com/nehasreenidhi/interns-skill-management/blob/main/templates/profile_settings.html"
  click TMentorDash "https://github.com/nehasreenidhi/interns-skill-management/blob/main/templates/mentor_dashboard.html"
  click TSearch "https://github.com/nehasreenidhi/interns-skill-management/blob/main/templates/search_interns.html"
  click StaticCSS "https://github.com/nehasreenidhi/interns-skill-management/blob/main/static/styles.css"
  click StaticImages "https://github.com/nehasreenidhi/interns-skill-management/tree/main/static/images/"

  %% =========================
  %% Styles (Color coding)
  %% =========================
  classDef actor fill:#F3E5F5,stroke:#6A1B9A,stroke-width:1px,color:#2d1640
  classDef runtime fill:#BBDEFB,stroke:#0D47A1,stroke-width:1px,color:#0b2a4a
  classDef service fill:#90CAF9,stroke:#1565C0,stroke-width:1px,color:#0b2a4a
  classDef ui fill:#E3F2FD,stroke:#1976D2,stroke-width:1px,color:#0b2a4a
  classDef template fill:#E8F5E9,stroke:#2E7D32,stroke-width:1px,color:#103b18
  classDef static fill:#E0F7FA,stroke:#006064,stroke-width:1px,color:#063235
  classDef datastore fill:#C8E6C9,stroke:#1B5E20,stroke-width:1px,color:#103b18
  classDef vectorstore fill:#B9F6CA,stroke:#00A152,stroke-width:1px,color:#0b3a22
  classDef ml fill:#FFE0B2,stroke:#E65100,stroke-width:1px,color:#5a2500
  classDef security fill:#EEEEEE,stroke:#424242,stroke-width:1px,color:#1f1f1f
  classDef clientlib fill:#F5F5F5,stroke:#616161,stroke-width:1px,color:#1f1f1f
```
