# raghuvartandon15/sih-23-project architecture

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

- Interactive diagram: https://gitdiagram.com/raghuvartandon15/sih-23-project
- Repository: https://github.com/raghuvartandon15/sih-23-project

## Overview

##### Project Type and Purpose
- This is a full-stack Django web application (“Institute Level Verification Portal”) with two Django apps (“users” and “scholar”).
- Purpose: Centralized institute-level inter-state student verification for scholarship benefits, leveraging Aadhaar verification, OCR, blockchain/IPFS storage, and a Dialogflow bot.

##### File Structure
- Top-level:
- manage.py, project/ (Django settings, URLs, ASGI/WGSI)
- db.sqlite3 (development database)
- media/ (user-uploaded docs)
- static/ (compiled front-end assets: JS/CSS likely from Angular or similar SPA)
- templates/ (Django templates – split into templates/scholar and templates/users)
- Two Django apps:
- users/ (authentication, registration, decorators, user models)
- scholar/ (scholarship application models, forms, views, manager, OCR/temp handlers)
- Config files: project/settings.py controls installed apps, middleware, static/media roots; URLs wired in project/urls.py, and each app has its own urls.py.
- Migrations folders indicate relational models for users and scholar.

##### README for Additional Insights
- Features mentioned but not necessarily all implemented:
- Aadhaar-based verification (external UIDAI API)
- Blockchain for tamper-proof document storage + IPFS for NSID storage
- Computer Vision (EasyOCR, PaddleOCR)
- Dialogflow chatbot
- Dashboard interfaces for institute, state, student roles.

##### Main Components
a. Web Client / Browser (UI Layer)
- Loads HTML templates + static JS/CSS (SPA assets + CSS)
- Interacts via HTTP/HTTPS with the Django backend.
b. Django Application Server
- project/ (global URLs, settings)
- users app ( auth, registration, user dashboard )
- scholar app ( scholarship workflows, forms, views, OCR handlers )
- Template engine (rendering base.html, user/scholar templates)
c. Database
- Relational DB (SQLite in dev, replaceable with Postgres/MySQL in prod)
- Tables: User, StudentProfile, ScholarCategory, ScholarshipApplication, etc.
d. File Storage (Media)
- Local file system in dev or cloud object store (e.g., S3) in production
- Stores uploaded documents and Aadhaar scans
e. External Services
- UIDAI Aadhaar Verification API
- IPFS node (storing NSID documents)
- Blockchain network or smart-contract endpoint (hash anchoring)
- OCR Engines (EasyOCR, PaddleOCR as micro-services or direct library calls)
- Dialogflow Bot API for chat support
f. Optional Infrastructure
- Load Balancer (NGINX/HAProxy)
- WSGI/ASGI server (Gunicorn or Uvicorn)
- CDN for static assets

##### Relationships and Data Flows
- Browser → [HTTPS] → Load Balancer → Django WSGI/ASGI → URL router → App views → Template rendering or JSON response.
- Views → ORM → Database (CRUD for users, applications).
- Views → File system/Cloud storage for media uploads.
- Scholarship views → call OCR library or OCR micro-service → extract data → save to DB.
- Views → call Aadhaar API for ID verification → process response → update application status.
- After application submission → backend → IPFS client → upload doc → returns CID → record on blockchain via smart-contract API.
- Client  ↔  Dialogflow via REST/gRPC for live chat.

##### Architectural Patterns and Design Principles
- Layered MVT (Model-View-Template) architecture (Django’s built-in MVC variant).
- Separation of concerns:
- Presentation (templates + static)
- Business logic (views, managers, forms)
- Data layer (models + migrations)
- Extensibility points: pluggable “users” and “scholar” apps, external service clients, OCR abstractions.
- Security: HTTPS, authentication via Django Auth, permissions via decorators.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Title
    subgraph "Institute Level Verification Portal – System Architecture" 
    end

    %% Frontend Layer
    Browser["Web Client / SPA Assets"]:::frontend
    Static["Static Assets (CSS/JS Bundles)"]:::frontend
    Templates["HTML Templates"]:::frontend

    Browser -->|"HTTP/HTTPS"| Static
    Browser -->|"HTTP/HTTPS"| Templates
    Browser -->|"HTTP/HTTPS"| LB

    click Static "https://github.com/raghuvartandon15/sih-23-project/tree/main/static/"
    click Templates "https://github.com/raghuvartandon15/sih-23-project/tree/main/templates/"

    %% Load Balancer and Server
    LB["Load Balancer (NGINX/HAProxy)"]:::infra
    LB -->|"WSGI/ASGI"| WSGI
    LB -->|"WSGI/ASGI"| ASGI

    WSGI["WSGI Server (Gunicorn)"]:::infra
    ASGI["ASGI Server (Uvicorn)"]:::infra

    %% Django Application Server
    subgraph "Django Application Server" 
        direction TB
        ProjectConfig["project/"]:::config
        Settings["settings.py"]:::config
        Urls["urls.py"]:::config
        ASGIModule["asgi.py"]:::config
        WSIGModule["wsgi.py"]:::config

        subgraph "Users App" 
            direction TB
            UsersURLs["urls.py"]:::app
            UsersViews["views.py"]:::app
            UsersForms["forms.py"]:::app
            UsersModels["models.py"]:::app
            UsersDecorators["decorators.py"]:::app
            UsersAdmin["admin.py"]:::app
            UsersMigrations["migrations/"]:::app
        end

        subgraph "Scholar App" 
            direction TB
            ScholarURLs["urls.py"]:::app
            ScholarViews["views.py"]:::app
            ScholarForms["forms.py"]:::app
            ScholarManager["manager.py"]:::app
            ScholarModels["models.py"]:::app
            ScholarAdmin["admin.py"]:::app
            ScholarTemp["tempCodeRunnerFile.py"]:::app
            ScholarMigrations["migrations/"]:::app
        end

        ProjectConfig --> Settings
        ProjectConfig --> Urls
        ProjectConfig --> ASGIModule
        ProjectConfig --> WSIGModule
        ProjectConfig --> UsersURLs
        ProjectConfig --> ScholarURLs
    end

    click ProjectConfig "https://github.com/raghuvartandon15/sih-23-project/tree/main/project/"
    click Settings "https://github.com/raghuvartandon15/sih-23-project/blob/main/project/settings.py"
    click Urls "https://github.com/raghuvartandon15/sih-23-project/blob/main/project/urls.py"
    click ASGIModule "https://github.com/raghuvartandon15/sih-23-project/blob/main/project/asgi.py"
    click WSIGModule "https://github.com/raghuvartandon15/sih-23-project/blob/main/project/wsgi.py"

    click UsersURLs "https://github.com/raghuvartandon15/sih-23-project/blob/main/users/urls.py"
    click UsersViews "https://github.com/raghuvartandon15/sih-23-project/blob/main/users/views.py"
    click UsersForms "https://github.com/raghuvartandon15/sih-23-project/blob/main/users/forms.py"
    click UsersModels "https://github.com/raghuvartandon15/sih-23-project/blob/main/users/models.py"
    click UsersDecorators "https://github.com/raghuvartandon15/sih-23-project/blob/main/users/decorators.py"
    click UsersAdmin "https://github.com/raghuvartandon15/sih-23-project/blob/main/users/admin.py"
    click UsersMigrations "https://github.com/raghuvartandon15/sih-23-project/tree/main/users/migrations/"

    click ScholarURLs "https://github.com/raghuvartandon15/sih-23-project/blob/main/scholar/urls.py"
    click ScholarViews "https://github.com/raghuvartandon15/sih-23-project/blob/main/scholar/views.py"
    click ScholarForms "https://github.com/raghuvartandon15/sih-23-project/blob/main/scholar/forms.py"
    click ScholarManager "https://github.com/raghuvartandon15/sih-23-project/blob/main/scholar/manager.py"
    click ScholarModels "https://github.com/raghuvartandon15/sih-23-project/blob/main/scholar/models.py"
    click ScholarAdmin "https://github.com/raghuvartandon15/sih-23-project/blob/main/scholar/admin.py"
    click ScholarTemp "https://github.com/raghuvartandon15/sih-23-project/blob/main/scholar/tempCodeRunnerFile.py"
    click ScholarMigrations "https://github.com/raghuvartandon15/sih-23-project/tree/main/scholar/migrations/"

    %% Database and Storage
    DB["Relational Database (SQLite/Postgres)"]:::database
    Media["Media Storage (Uploaded Docs)"]:::storage

    WSGI --> ORM
    ASGI --> ORM
    ORM["Django ORM"]:::logic --> DB
    ORM --> Media

    click DB "https://github.com/raghuvartandon15/sih-23-project/blob/main/db.sqlite3"
    click Media "https://github.com/raghuvartandon15/sih-23-project/tree/main/media/"

    %% External Services
    subgraph "External Services" 
        direction TB
        AadhaarAPI["UIDAI Aadhaar Verification API"]:::external
        OCRService["OCR Engines (EasyOCR/PaddleOCR)"]:::external
        IPFS["IPFS Node"]:::external
        Blockchain["Blockchain Network/Smart Contract"]:::external
        Dialogflow["Dialogflow Bot API"]:::external
    end

    ScholarViews -->|"Invoke OCR"| OCRService
    ScholarManager -->|"Upload to IPFS"| IPFS
    ScholarManager -->|"Anchor Hash"| Blockchain
    UsersViews -->|"Verify Aadhaar"| AadhaarAPI
    Browser <-->|"REST/gRPC"| Dialogflow

    %% Legend
    classDef frontend fill:#D0E8FF,stroke:#0366D6,color:#0366D6;
    classDef infra fill:#E8F0FE,stroke:#1967D2,color:#1967D2;
    classDef config fill:#E6F4EA,stroke:#298A08,color:#298A08;
    classDef app fill:#FCE8E6,stroke:#D93025,color:#D93025;
    classDef database fill:#FFF4DE,stroke:#A5673F,color:#A5673F;
    classDef storage fill:#F3E8FF,stroke:#6F2DBD,color:#6F2DBD;
    classDef external fill:#FDE7E9,stroke:#A50E0E,color:#A50E0E;
    classDef logic fill:#E8F5E9,stroke:#34A853,color:#34A853;
```
