# petr-ngn/skill-matcher architecture

> Architecture diagram of the GitHub repository petr-ngn/skill-matcher, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-20). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/petr-ngn/skill-matcher
- Repository: https://github.com/petr-ngn/skill-matcher

## Overview

##### Project type and purpose
- This is a full-stack, serverless web application for skill matching and scoring of volunteers, built on the Flask framework (Python 3.9.16).
- It is designed to run on AWS Lambda (via Serverless framework), connect in real time to a Snowflake data warehouse (loaded by Keboola ETL from sources such as Slack and Airtable), and provide an interactive frontend (HTML/CSS/JavaScript) for non-profit recruitment workflows.

##### File structure
- Top level:
- `.github/workflows/deploy.yml` – CI/CD pipeline for automated deployment.
- `requirements.yml` / `requirements.txt` – Conda and pip dependencies.
- `web_app/` – contains all application logic and assets.
- Inside `web_app/`:
- `app.py` – Flask application entry point (routes for login, form, result, skills hint, email).
- `serverless.yml` – configuration for deploying the Flask app to AWS Lambda + API Gateway.
- `inputs/` – configuration and secret files (`.env`, `config.yaml`, `email.txt`, `skills_map.json`).
- `templates/` – Jinja2 HTML templates (`login.html`, `form.html`, `result.html`, `skills.html`).
- `static/` – client assets: CSS (styling), JS (form handling, result rendering, skills options), fonts, images.

##### Relevant insights from the README
- High-level architecture calls out:
- Flask backend with real-time Snowflake connectivity.
- Keboola ETL pipeline feeding Snowflake from multiple sources.
- Serverless (AWS Lambda + API Gateway) deployment.
- Frontend pages for login, form input, skill hint modal, results table, and email template integration with Gmail (via Bcc and mailto).
- Scoring algorithm implemented in Python: reads skills_map, computes cosine similarity, distance metrics (Euclidean, Manhattan, Mahalanobis), inverts distances to scores, returns ranked results.

##### Detail without overcomplication
- Break the system into the components above, but avoid micro-detailing every file.
- “moving parts” (CI/CD, ETL, database, backend, frontend, external email).

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Client Layer
    subgraph "User"
        Browser["User Browser"]:::client
    end

    %% API Layer
    Browser -->|"HTTP GET/POST"| APIGateway["AWS API Gateway"]:::compute

    %% Compute Layer
    APIGateway -->|"Invokes"| Lambda["AWS Lambda\n(Flask app)"]:::compute

    %% Web_App Code Boundary
    subgraph "Web_App (Lambda Code)"
        direction TB
        App["app.py"]:::backend
        SL["serverless.yml"]:::backend

        subgraph "Inputs"
            direction TB
            Env[".env"]:::config
            Config["config.yaml"]:::config
            EmailT["email.txt"]:::config
            SkillsMap["skills_map.json"]:::config
        end

        subgraph "Templates"
            direction TB
            Login["login.html"]:::view
            Form["form.html"]:::view
            Result["result.html"]:::view
            SkillsHTML["skills.html"]:::view
        end

        subgraph "Static Assets"
            direction TB
            CSS["css"]:::static
            JS["js"]:::static
            Fonts["fonts"]:::static
            Images["pic"]:::static
        end
    end

    Lambda --> App
    App --> SL
    App --> Env
    App --> Config
    App --> EmailT
    App --> SkillsMap
    App --> Login
    App --> Form
    App --> Result
    App --> SkillsHTML
    App --> CSS
    App --> JS
    App --> Fonts
    App --> Images

    %% Database Layer
    Keboola["Keboola ETL Pipeline"]:::compute
    Snowflake["Snowflake Data Warehouse"]:::database

    Keboola -->|"Loads data"| Snowflake
    Lambda -->|"SQL Query"| Snowflake

    %% Email Service
    Browser -->|"mailto Bcc"| Gmail["Gmail (email client)"]:::external

    %% CI/CD Pipeline
    subgraph "CI/CD Pipeline"
        direction TB
        GH["GitHub Actions"]:::ci
    end

    GH -->|"Deploy via Serverless"| SL
    GH -->|"Triggers update"| Lambda

    GH -->|"Watches code"| GitIgnore[".gitignore"]:::config
    GH -->|"Watches code"| Readme["README.md"]:::config

    %% Click Events
    click App "https://github.com/petr-ngn/skill-matcher/blob/main/web_app/app.py"
    click SL "https://github.com/petr-ngn/skill-matcher/blob/main/web_app/serverless.yml"
    click GH "https://github.com/petr-ngn/skill-matcher/blob/main/.github/workflows/deploy.yml"
    click ReqTxt "https://github.com/petr-ngn/skill-matcher/blob/main/web_app/requirements.txt"
    click ReqYml "https://github.com/petr-ngn/skill-matcher/blob/main/requirements.yml"
    click Pkg "https://github.com/petr-ngn/skill-matcher/blob/main/web_app/package.json"
    click Lock "https://github.com/petr-ngn/skill-matcher/blob/main/web_app/package-lock.json"
    click Env "https://github.com/petr-ngn/skill-matcher/blob/main/web_app/inputs/.env"
    click Config "https://github.com/petr-ngn/skill-matcher/blob/main/web_app/inputs/config.yaml"
    click EmailT "https://github.com/petr-ngn/skill-matcher/blob/main/web_app/inputs/email.txt"
    click SkillsMap "https://github.com/petr-ngn/skill-matcher/blob/main/web_app/inputs/skills_map.json"
    click Login "https://github.com/petr-ngn/skill-matcher/blob/main/web_app/templates/login.html"
    click Form "https://github.com/petr-ngn/skill-matcher/blob/main/web_app/templates/form.html"
    click Result "https://github.com/petr-ngn/skill-matcher/blob/main/web_app/templates/result.html"
    click SkillsHTML "https://github.com/petr-ngn/skill-matcher/blob/main/web_app/templates/skills.html"
    click CSS "https://github.com/petr-ngn/skill-matcher/tree/main/web_app/static/css"
    click JS "https://github.com/petr-ngn/skill-matcher/tree/main/web_app/static/js"
    click Fonts "https://github.com/petr-ngn/skill-matcher/tree/main/web_app/static/fonts"
    click Images "https://github.com/petr-ngn/skill-matcher/tree/main/web_app/static/pic"
    click GitIgnore "https://github.com/petr-ngn/skill-matcher/blob/main/.gitignore"
    click Readme "https://github.com/petr-ngn/skill-matcher/blob/main/README.md"

    %% Styles
    classDef client fill:#f9f,stroke:#333,stroke-width:1px
    classDef compute fill:#cfc,stroke:#333,stroke-width:1px
    classDef backend fill:#ccf,stroke:#333,stroke-width:1px
    classDef config fill:#fcf,stroke:#333,stroke-width:1px
    classDef view fill:#cff,stroke:#333,stroke-width:1px
    classDef static fill:#ffc,stroke:#333,stroke-width:1px
    classDef database fill:#eef,stroke:#333,stroke-width:1px,stroke-dasharray: 5 5
    classDef external fill:#fdd,stroke:#333,stroke-width:1px,stroke-dasharray: 2 2
    classDef ci fill:#ddd,stroke:#333,stroke-width:1px,stroke-dasharray: 4 2
```
