# rajivanandkhanal/student-resource-hub architecture

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

- Interactive diagram: https://gitdiagram.com/rajivanandkhanal/student-resource-hub
- Repository: https://github.com/rajivanandkhanal/student-resource-hub

## Overview

##### Project type + purpose (from file tree + README)
This is a **Qt 6 C++ desktop application** (“StudentResourcehub”) that appears to provide a **student resource hub UI** with multiple screens (landing page, register, profile, update info, about/contact pages).
It uses a **local SQLite database file**: `StudentResourceHubDB/StudentResourceHubDB.db`. There is **no server/backend** in the repo; everything is local to the desktop runtime.

Key indicators in the tree:
- Qt project file: `StudentResourcehub/StudentResourcehub.pro`
- Qt Designer UI files: `*.ui` (e.g., `mainwindow.ui`, `register.ui`, etc.)
- C++ Qt classes: `*.cpp` / `*.h` matching those UI screens
- Qt resource system: `ProjectResources.qrc` + `Img/`
- Build outputs: `StudentResourcehub/build/...` (should not be treated as architecture; they’re artifacts)

##### How to think about the architecture for diagramming this repo
- **Actor (User)**
- **Desktop Application (Qt runtime + compiled exe)**
- **Presentation layer (Qt Widgets screens)**
- **Data layer (SQLite file access)**

##### Desktop Application Container
**StudentResourcehub.exe (Qt Widgets app)**
- Entry point: `main.cpp`
- Main shell window: `mainwindow.h/.cpp/.ui`

##### Resource bundle (static assets)
- `ProjectResources.qrc`

##### Persistence / Database
- `StudentResourceHubDB.db` (SQLite)

##### Build/Tooling (keep separate or omit from main architecture)
- `StudentResourcehub/build/...`, Makefiles, `moc_*.cpp`, `qrc_*.cpp`, generated `ui_*.h`
- omit them, or

##### Architectural patterns/design principles to highlight (based on structure)
What the tree suggests:
- **Qt Widgets + Designer-based UI**: `.ui` forms compiled to `ui_*.h`
- **Signal/slot event-driven interactions** (typical Qt): user actions trigger slots in each screen class
- **Single-process, local-first architecture**: no network services in repo; persistence is local SQLite

- “Event-driven UI (Qt signals/slots)”
- “Embedded persistence (SQLite DB file)”
- “Resource-compiled assets (.qrc)”

- **App Entry**: `main.cpp` → “Application Startup”
- **Shell / Navigation**: `mainwindow.*` → “MainWindow (navigation host)”
- **Screens**:
- `landingpage.*`
- `register.*`
- `profile.*`
- `updateinfo.*`
- `aboutus.*`
- `contactus.*`
- `firstpage.ui` (screen-only)
- **Resources**: `ProjectResources.qrc`, `Img/`
- **Database**: `StudentResourceHubDB/StudentResourceHubDB.db`
- **Ignore for runtime architecture**: `build/**`, generated `moc_*`, `ui_*`, `qrc_*`

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% =========================
    %% Diagram 1 — System Context (C4 L1)
    %% =========================
    U[/"Student/User"/]:::actor

    subgraph "StudentResourcehub System (Local Desktop)"
        SYS(("StudentResourcehub\n(Qt 6 Desktop App)")):::system
    end

    DB[("SQLite DB File")]:::datastore

    U -->|"uses"| SYS
    SYS -->|"reads/writes"| DB

    NOTE_CTX["Notes:\n- Single-process local-first\n- Event-driven UI (signals/slots)\n- No server/backend"]:::note
    SYS --- NOTE_CTX

    %% =========================
    %% Diagram 2 — Container View (C4 L2)
    %% =========================
    subgraph "Runtime Containers (Inside Desktop App Process)"
        APP(("Qt Application\nStudentResourcehub.exe")):::app

        subgraph "UI Layer (Qt Widgets)"
            UI["UI Layer\n(Qt Widgets + .ui forms)"]:::ui
        end

        DAL["DB Access Layer\n(Qt SQL: QSqlDatabase/QSqlQuery)\n(conceptual)"]:::dal
        RES["Qt Resource System\n(ProjectResources.qrc)"]:::resource
    end

    SYS -->|"runs as"| APP
    APP -->|"renders"| UI
    UI -->|"queries via"| DAL
    DAL -->|"connects to"| DB
    UI -->|"loads images/icons"| RES

    %% =========================
    %% Diagram 3 — UI Components (C4 L3)
    %% =========================
    subgraph "UI Components (Screens)"
        MW["MainWindow\n(navigation host)"]:::shell

        FP["FirstPage\n(welcome view)"]:::ui

        LP["LandingPage"]:::ui
        REG["Register"]:::ui
        PROF["Profile"]:::ui
        UPD["UpdateInfo"]:::ui
        ABOUT["AboutUs"]:::ui
        CONTACT["ContactUs"]:::ui
    end

    UI -->|"hosts"| MW

    MW -->|"shows"| FP
    MW -->|"navigates"| LP
    MW -->|"navigates"| REG
    MW -->|"navigates"| PROF
    MW -->|"navigates"| UPD
    MW -->|"navigates"| ABOUT
    MW -->|"navigates"| CONTACT

    LP -->|"authenticate/load"| DAL
    REG -->|"create user (insert)"| DAL
    PROF -->|"read profile (select)"| DAL
    UPD -->|"update profile (update)"| DAL

    MW -->|"load image/icon"| RES
    FP -->|"load image/icon"| RES
    LP -->|"load image/icon"| RES
    REG -->|"load image/icon"| RES
    PROF -->|"load image/icon"| RES
    UPD -->|"load image/icon"| RES
    ABOUT -->|"load image/icon"| RES
    CONTACT -->|"load image/icon"| RES

    NOTE_UI["Notes:\n- .ui compiled by uic to ui_*.h\n- Slots handle button/menu events"]:::note
    MW --- NOTE_UI

    %% =========================
    %% Project Files (mapped; for click events)
    %% =========================
    subgraph "Project Files (Source of Components)"
        PRO["qmake project file"]:::file
        MAINCPP["Application entry source"]:::file

        MWH["MainWindow header"]:::file
        MWCPP["MainWindow source"]:::file
        MWUI["MainWindow form (.ui)"]:::file

        LPH["LandingPage header"]:::file
        LPCPP["LandingPage source"]:::file
        LPUI["LandingPage form (.ui)"]:::file

        REGH["Register header"]:::file
        REGCPP["Register source"]:::file
        REGUI["Register form (.ui)"]:::file

        PROFH["Profile header"]:::file
        PROFCPP["Profile source"]:::file
        PROFUI["Profile form (.ui)"]:::file

        UPDH["UpdateInfo header"]:::file
        UPDCPP["UpdateInfo source"]:::file
        UPDUI["UpdateInfo form (.ui)"]:::file

        ABH["AboutUs header"]:::file
        ABCPP["AboutUs source"]:::file
        ABUI["AboutUs form (.ui)"]:::file

        CTH["ContactUs header"]:::file
        CTCPP["ContactUs source"]:::file
        CTUI["ContactUs form (.ui)"]:::file

        FPUI["FirstPage form (.ui)"]:::file

        QRC["Qt resource collection (.qrc)"]:::file
        IMGDIR["Images/Icons directory"]:::file

        DBFILE["SQLite database file"]:::file
    end

    PRO -.->|"build config"| APP
    MAINCPP -.->|"defines startup"| APP

    MWH -.-> MW
    MWCPP -.-> MW
    MWUI -.-> MW

    LPH -.-> LP
    LPCPP -.-> LP
    LPUI -.-> LP

    REGH -.-> REG
    REGCPP -.-> REG
    REGUI -.-> REG

    PROFH -.-> PROF
    PROFCPP -.-> PROF
    PROFUI -.-> PROF

    UPDH -.-> UPD
    UPDCPP -.-> UPD
    UPDUI -.-> UPD

    ABH -.-> ABOUT
    ABCPP -.-> ABOUT
    ABUI -.-> ABOUT

    CTH -.-> CONTACT
    CTCPP -.-> CONTACT
    CTUI -.-> CONTACT

    FPUI -.-> FP

    QRC -.-> RES
    IMGDIR -.-> RES

    DBFILE -.-> DB

    %% =========================
    %% Click Events (paths only; do not show in labels)
    %% =========================
    click MAINCPP "https://github.com/rajivanandkhanal/student-resource-hub/blob/main/StudentResourcehub/main.cpp"
    click PRO "https://github.com/rajivanandkhanal/student-resource-hub/blob/main/StudentResourcehub/StudentResourcehub.pro"

    click MWH "https://github.com/rajivanandkhanal/student-resource-hub/blob/main/StudentResourcehub/mainwindow.h"
    click MWCPP "https://github.com/rajivanandkhanal/student-resource-hub/blob/main/StudentResourcehub/mainwindow.cpp"
    click MWUI "https://github.com/rajivanandkhanal/student-resource-hub/blob/main/StudentResourcehub/mainwindow.ui"

    click LPH "https://github.com/rajivanandkhanal/student-resource-hub/blob/main/StudentResourcehub/landingpage.h"
    click LPCPP "https://github.com/rajivanandkhanal/student-resource-hub/blob/main/StudentResourcehub/landingpage.cpp"
    click LPUI "https://github.com/rajivanandkhanal/student-resource-hub/blob/main/StudentResourcehub/landingpage.ui"

    click REGH "https://github.com/rajivanandkhanal/student-resource-hub/blob/main/StudentResourcehub/register.h"
    click REGCPP "https://github.com/rajivanandkhanal/student-resource-hub/blob/main/StudentResourcehub/register.cpp"
    click REGUI "https://github.com/rajivanandkhanal/student-resource-hub/blob/main/StudentResourcehub/register.ui"

    click PROFH "https://github.com/rajivanandkhanal/student-resource-hub/blob/main/StudentResourcehub/profile.h"
    click PROFCPP "https://github.com/rajivanandkhanal/student-resource-hub/blob/main/StudentResourcehub/profile.cpp"
    click PROFUI "https://github.com/rajivanandkhanal/student-resource-hub/blob/main/StudentResourcehub/profile.ui"

    click UPDH "https://github.com/rajivanandkhanal/student-resource-hub/blob/main/StudentResourcehub/updateinfo.h"
    click UPDCPP "https://github.com/rajivanandkhanal/student-resource-hub/blob/main/StudentResourcehub/updateinfo.cpp"
    click UPDUI "https://github.com/rajivanandkhanal/student-resource-hub/blob/main/StudentResourcehub/updateinfo.ui"

    click ABH "https://github.com/rajivanandkhanal/student-resource-hub/blob/main/StudentResourcehub/aboutus.h"
    click ABCPP "https://github.com/rajivanandkhanal/student-resource-hub/blob/main/StudentResourcehub/aboutus.cpp"
    click ABUI "https://github.com/rajivanandkhanal/student-resource-hub/blob/main/StudentResourcehub/aboutus.ui"

    click CTH "https://github.com/rajivanandkhanal/student-resource-hub/blob/main/StudentResourcehub/contactus.h"
    click CTCPP "https://github.com/rajivanandkhanal/student-resource-hub/blob/main/StudentResourcehub/contactus.cpp"
    click CTUI "https://github.com/rajivanandkhanal/student-resource-hub/blob/main/StudentResourcehub/contactus.ui"

    click FPUI "https://github.com/rajivanandkhanal/student-resource-hub/blob/main/StudentResourcehub/firstpage.ui"

    click QRC "https://github.com/rajivanandkhanal/student-resource-hub/blob/main/StudentResourcehub/ProjectResources.qrc"
    click IMGDIR "https://github.com/rajivanandkhanal/student-resource-hub/tree/main/StudentResourcehub/Img/"

    click DBFILE "https://github.com/rajivanandkhanal/student-resource-hub/blob/main/StudentResourceHubDB/StudentResourceHubDB.db"

    %% =========================
    %% Styles
    %% =========================
    classDef actor fill:#ffffff,stroke:#111827,stroke-width:2,color:#111827
    classDef system fill:#ede9fe,stroke:#5b21b6,stroke-width:2,color:#2e1065
    classDef app fill:#ddd6fe,stroke:#6d28d9,stroke-width:2,color:#2e1065
    classDef shell fill:#c4b5fd,stroke:#6d28d9,stroke-width:2,color:#2e1065

    classDef ui fill:#dbeafe,stroke:#1d4ed8,stroke-width:2,color:#0f172a
    classDef dal fill:#fed7aa,stroke:#c2410c,stroke-width:2,color:#7c2d12
    classDef datastore fill:#bbf7d0,stroke:#15803d,stroke-width:2,color:#052e16
    classDef resource fill:#e5e7eb,stroke:#374151,stroke-width:2,color:#111827

    classDef note fill:#fff7ed,stroke:#9a3412,stroke-width:1,color:#7c2d12,stroke-dasharray: 4 3
    classDef file fill:#f3f4f6,stroke:#6b7280,stroke-width:1,color:#111827,stroke-dasharray: 3 3
```
