# vara910/resumeanalyzer architecture

> Architecture diagram of the GitHub repository vara910/resumeanalyzer, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-06-11). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/vara910/resumeanalyzer
- Repository: https://github.com/vara910/resumeanalyzer

## Overview

##### Project Type and Purpose
- This is a monolithic full-stack Flask web application.

##### File Structure
- Top-level Python modules:
- app.py          – Main Flask application entry point
- auth.py         – Authentication routes
- models.py       – ORM models (SQLAlchemy)
- forms.py        – WTForms definitions
- utils.py        – Helper functions (text extraction, preprocessing, feature extraction, similarity, scoring)
- init.py         – Application factory or initialization logic
- Directories:
- templates/      – Jinja2 HTML templates (base, auth, errors, pages)
- assets/         – Static images (screenshots, UI assets)
- instance/       – Runtime database file (resume_analyzer.db) and configuration overrides
- logs/           – Application logs (app.log)
- Configuration & CI:
- requirements.txt, .env.example – Dependencies and env setup
- .github/, azure-pipelines*.yml – GitHub Actions and Azure Pipelines for CI/CD
- Runtime artifacts (uploads/) are created at runtime.

##### README for Architecture Insights
- Tech stack: Python, Flask, SQLite/PostgreSQL, NLTK, scikit-learn, PyMuPDF, python-docx, textract.
- Workflow stages described: Text Extraction → Preprocessing → Feature Extraction → Similarity Calculation → Weighted Scoring → Visualization.
- External dependencies: SMTP server for email, optional PostgreSQL in production.

##### Main Components & Interactions
a. User Interface (Browser)
– HTML templates, CSS, JS assets delivered by Flask.
b. Flask Application Server
– Blueprints or route modules (app.py, auth.py) handle requests.
– Controllers (routes) invoke:
- Authentication Module (auth.py + Flask-Security)
- Form Handling (forms.py)
- NLP Pipeline (utils.py)
- Data Access Layer (models.py + SQLAlchemy)
c. File Storage
– Uploaded resumes & job descriptions stored on disk (uploads/ or instance/).
d. Database
– SQLite during development (instance/resume_analyzer.db), PostgreSQL in production.
e. NLP & ML Subsystem
– Text Extraction (PyMuPDF, python-docx, textract)
– Preprocessing (NLTK pipelines)
– Feature Extraction (TF-IDF with scikit-learn)
– Scoring Engine (cosine similarity + custom weighting)
f. External Services
– SMTP Email Server for account activation, password reset
– (Optional) External storage or analytics services if integrated
g. CI/CD Pipelines
– GitHub Actions, Azure Pipelines for build/test/deploy

- Browser → Flask (HTTP requests: login, upload, analyze)
- Flask → Database (ORM queries)
- Flask → File Storage (save/upload files, read for analysis)
- Flask → NLP Subsystem (invoke utils.py functions)
- Flask → External SMTP (send emails)
- Flask → CI/CD (trigger build & deploy)

##### Architectural Patterns & Principles
- MVC-like separation:
- Models (models.py) for data
- Views (templates/) for presentation
- Controllers (routes in app.py/auth.py)
- Single-process monolith, can be refactored into microservices (e.g., separate NLP service) later.
- Application Factory pattern (init.py) to support testability and multiple environments.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Web/UI Layer
    subgraph "Web/UI Layer"
        Browser["Browser"]:::ui
        UITemplates["UI Templates"]:::ui
        AuthTemplates["Auth Templates"]:::ui
        ErrorPages["Error Pages"]:::ui
        StaticAssets["Static Assets"]:::ui
    end

    %% Application Layer
    subgraph "Application Layer"
        Init["Application Factory"]:::app
        FlaskServer["Flask App Server"]:::app
        AuthModule["Authentication Module"]:::app
        Forms["Form Handling (WTForms)"]:::app
        Models["Data Access Layer (ORM)"]:::app
    end

    %% Processing Layer
    subgraph "Processing Layer"
        Utils["NLP & ML Subsystem"]:::process
    end

    %% Data Layer
    subgraph "Data Layer"
        FileStorage["File Storage"]:::data
        Database["Database (SQLite/PostgreSQL)"]:::data
        Logs["Logging"]:::data
    end

    %% External Services
    subgraph "External Services"
        SMTP["SMTP Email Server"]:::external
    end

    %% CI/CD
    subgraph "CI/CD Pipelines"
        GHA["GitHub Actions"]:::ci
        AzP["Azure Pipelines"]:::ci
    end

    %% Connections
    Browser -->|"HTTP Requests"| FlaskServer
    FlaskServer -->|"renders"| UITemplates
    FlaskServer -->|"renders"| AuthTemplates
    FlaskServer -->|"renders"| ErrorPages
    FlaskServer -->|"serves"| StaticAssets
    FlaskServer -->|"uses factory"| Init
    FlaskServer -->|"routes to"| AuthModule
    FlaskServer -->|"validates"| Forms
    FlaskServer -->|"queries"| Models
    FlaskServer -->|"invokes"| Utils
    FlaskServer -->|"reads/writes"| FileStorage
    FlaskServer -->|"SELECT/INSERT"| Database
    FlaskServer -->|"writes"| Logs
    FlaskServer -->|"sends email via"| SMTP
    GHA -->|"deploys"| FlaskServer
    AzP -->|"deploys"| FlaskServer

    %% Click Events for component mapping
    click FlaskServer "https://github.com/vara910/resumeanalyzer/blob/master/app.py"
    click Init "https://github.com/vara910/resumeanalyzer/blob/master/init.py"
    click AuthModule "https://github.com/vara910/resumeanalyzer/blob/master/auth.py"
    click Forms "https://github.com/vara910/resumeanalyzer/blob/master/forms.py"
    click Models "https://github.com/vara910/resumeanalyzer/blob/master/models.py"
    click Utils "https://github.com/vara910/resumeanalyzer/blob/master/utils.py"
    click UITemplates "https://github.com/vara910/resumeanalyzer/tree/master/templates/"
    click AuthTemplates "https://github.com/vara910/resumeanalyzer/tree/master/templates/auth/"
    click ErrorPages "https://github.com/vara910/resumeanalyzer/tree/master/templates/errors/"
    click StaticAssets "https://github.com/vara910/resumeanalyzer/tree/master/assets/"
    click FileStorage "https://github.com/vara910/resumeanalyzer/tree/master/instance/"
    click Database "https://github.com/vara910/resumeanalyzer/blob/master/instance/resume_analyzer.db"
    click Logs "https://github.com/vara910/resumeanalyzer/blob/master/logs/app.log"
    click GHA "https://github.com/vara910/resumeanalyzer/blob/master/.github/workflows/master_my-demo-app.yml"
    click GHA "https://github.com/vara910/resumeanalyzer/blob/master/.github/workflows/master_varademoapp.yml"
    click AzP "https://github.com/vara910/resumeanalyzer/blob/master/azure-pipelines.yml"
    click AzP "https://github.com/vara910/resumeanalyzer/blob/master/azure-pipelines-1.yml"

    %% Styles
    classDef ui fill:#cce5ff,stroke:#0366d6,color:#0366d6;
    classDef app fill:#d4edda,stroke:#28a745,color:#155724;
    classDef data fill:#fff3cd,stroke:#e0a800,color:#856404;
    classDef process fill:#f0e68c,stroke:#d39e00,color:#856404;
    classDef external fill:#e2e3e5,stroke:#6c757d,color:#343a40;
    classDef ci fill:#f8d7da,stroke:#721c24,color:#721c24;
```
