# ztrimus/resumeflow architecture

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

- Interactive diagram: https://gitdiagram.com/ztrimus/resumeflow
- Repository: https://github.com/ztrimus/resumeflow

## Overview

##### Project Identification
- Name: ResumeFlow – An LLM-facilitated Pipeline for Personalized Resume Generation and Refinement.
- Purpose: Automate the resume generation and refinement process, integrating job posting details with a user’s master resume using large language models (LLMs) and LaTeX for final resume PDF generation.

##### Main Components
A. User Interface Layer
- Web Application Interface (“WebApp”): Represented by the web_app.py, which exposes the tool as an interactive web service (deployed on Streamlit).
- Command Line Interface: Represented by main.py, providing the pipeline’s entry point for command-line usage.

B. Core Processing Module (zlm Package)
- Initialization & Configuration: The zlm/__init__.py, which sets up the module.
- Data Inputs & Demo Data: The demo_data folder (with user_profile.json and user_resume.pdf) that provides sample inputs.
- Prompts: The prompts directory contains resume_prompt.py and sections_prompt.py – these are key for interacting with LLM APIs by framing requests.
- Schema Definitions: The schemas folder (job_details_schema.py and sections_schemas.py) that defines structured representations of job and resume section data.
- Templates: The templates folder includes the LaTeX resume template (resume.cls and resume.tex.jinja) for generating PDF resumes.
- Utility Functions: The utils directory with modules for:
- Data Extraction (data_extraction.py)
- LaTeX Operations (latex_ops.py)
- LLM Model Integration (llm_models.py)
- Performance Metrics (metrics.py)
- General Utilities (utils.py)
- Configuration Variables: For global settings (variables.py).

C. External Dependencies and Integrations
- LLM API Integration: Interaction with external LLM providers like OpenAI and Gemini Pro. This component is primarily invoked via the AutoApplyModel from the zlm package.
- PDF Generation Workflow: Interaction with system-level packages for LaTeX processing (installed externally on Linux/Mac, as indicated in the README).
- External Scripts & Resources: The resources folder (including demo videos, project reports, and shell scripts like publish.sh) that support documentation and deployment aspects.

D. Package and Dependency Management
- Python Package Management: Indicated by packages.txt, pyproject.toml (for Poetry), and resources/requirements.txt. These highlight dependency management and build configuration.
- Development Configurations: The .devcontainer and .vscode directories provide container and IDE-specific configurations for development and debugging.

- Direct these inputs to the Core Processing Module (zlm package), where:
- Data is extracted and formatted using the utilities.
- Prompts are constructed using predefined patterns (from the prompts modules) and sent to the LLM API.
- Response data is validated and restructured using the schemas.
- The resume is rendered by merging the LLM-processed content with LaTeX templates.
- PDF generation occurs through external LaTeX conversion steps (managed by the latex_ops module).
- The generated resume/cover letter is then provided back to the user (downloaded in the specified folder).

##### Architectural Patterns and Design Principles
- Layered Architecture: Clearly distinguish between presentation (CLI and WebApp), domain processing (LLM integration, resume generation), and infrastructure layers (PDF conversion, external API calls).
- Modular Design: Use Python modules (prompts, schemas, utils) to ensure separation of concerns – each module handles distinct functionalities.
- External Service Integration: Emphasize the role of third-party LLM providers and the LaTeX engine as external services that the system relies on.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% User Interface Layer
    subgraph "User Interface Layer"
        UI_WebApp["WebApp (Interactive Interface)"]
        UI_CLI["CLI (Command Line Interface)"]
    end

    %% ResumeFlow Core Module
    subgraph "ResumeFlow Core Module"
        core_init["Initialization (zlm/__init__.py)"]
        core_demo["Demo Data (zlm/demo_data)"]
        core_vars["Configuration Variables (zlm/variables.py)"]
        core_data["Data Extraction (zlm/utils/data_extraction.py)"]
        core_prompt["Prompt Generation (zlm/prompts)"]
        core_schema["Schema Validation (zlm/schemas)"]
        core_template["Template Rendering (zlm/templates)"]
        core_pdf["PDF Generation (zlm/utils/latex_ops.py)"]
        final_output["Resume PDF Output"]
    end

    %% External Processing Services
    subgraph "External Processing"
        ext_llm["LLM API Integration (OpenAI/Gemini)"]
        ext_latex["LaTeX Processing Engine"]
    end

    %% Support & Dependency Management
    subgraph "Support & Config"
        ext_pkg1["Packages File (packages.txt)"]
        ext_pkg2["Poetry Config (pyproject.toml)"]
        ext_pkg3["Requirements (resources/requirements.txt)"]
        ext_dev1["Dev Container (.devcontainer)"]
        ext_dev2["VSCode Config (.vscode)"]
        ext_res["External Resources (resources)"]
    end

    %% Main Data Flow
    UI_CLI -->|"input"| core_init
    UI_WebApp -->|"input"| core_init

    core_init -->|"loads"| core_demo
    core_init -- "config"--> core_vars

    core_demo -->|"provides data"| core_data
    core_data -->|"prepares prompts"| core_prompt
    core_prompt -->|"calls"| ext_llm
    ext_llm -->|"returns response"| core_schema
    core_schema -->|"validates data"| core_template
    core_template -->|"merges content"| core_pdf
    core_pdf -->|"invokes"| ext_latex
    ext_latex -->|"generates PDF"| final_output

    final_output -->|"delivers output"| UI_WebApp
    final_output -->|"delivers output"| UI_CLI

    %% Support Dependencies (Dotted connections)
    core_init --- ext_pkg1
    core_init --- ext_pkg2
    core_init --- ext_pkg3
    core_init --- ext_dev1
    core_init --- ext_dev2
    core_init --- ext_res

    %% Styles
    class UI_WebApp,UI_CLI ui;
    class core_init,core_demo,core_vars,core_data,core_prompt,core_schema,core_template,core_pdf,final_output core;
    class ext_llm,ext_latex external;
    class ext_pkg1,ext_pkg2,ext_pkg3,ext_dev1,ext_dev2,ext_res support;

    %% Class Definitions
    classDef ui fill:#AEDFF7,stroke:#333,stroke-width:2px;
    classDef core fill:#C1F0C1,stroke:#333,stroke-width:2px;
    classDef external fill:#FFD1A9,stroke:#333,stroke-width:2px;
    classDef support fill:#E6A9EC,stroke:#333,stroke-width:2px;

    %% Click Events
    click UI_WebApp "https://github.com/ztrimus/resumeflow/blob/main/web_app.py"
    click UI_CLI "https://github.com/ztrimus/resumeflow/blob/main/main.py"
    click core_init "https://github.com/ztrimus/resumeflow/blob/main/zlm/__init__.py"
    click core_demo "https://github.com/ztrimus/resumeflow/tree/main/zlm/demo_data"
    click core_vars "https://github.com/ztrimus/resumeflow/blob/main/zlm/variables.py"
    click core_data "https://github.com/ztrimus/resumeflow/blob/main/zlm/utils/data_extraction.py"
    click core_prompt "https://github.com/ztrimus/resumeflow/tree/main/zlm/prompts"
    click core_schema "https://github.com/ztrimus/resumeflow/tree/main/zlm/schemas"
    click core_template "https://github.com/ztrimus/resumeflow/tree/main/zlm/templates"
    click core_pdf "https://github.com/ztrimus/resumeflow/blob/main/zlm/utils/latex_ops.py"
    click ext_pkg1 "https://github.com/ztrimus/resumeflow/blob/main/packages.txt"
    click ext_pkg2 "https://github.com/ztrimus/resumeflow/blob/main/pyproject.toml"
    click ext_pkg3 "https://github.com/ztrimus/resumeflow/blob/main/resources/requirements.txt"
    click ext_dev1 "https://github.com/ztrimus/resumeflow/blob/main/.devcontainer"
    click ext_dev2 "https://github.com/ztrimus/resumeflow/blob/main/.vscode"
    click ext_res "https://github.com/ztrimus/resumeflow/tree/main/resources"
```
