# oliviacoding/easyapplyai architecture

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

- Interactive diagram: https://gitdiagram.com/oliviacoding/easyapplyai
- Repository: https://github.com/oliviacoding/easyapplyai

## Overview

##### Main Components
- User Interface (UI) / Frontend: Represented by the Streamlit application (app.py). This component handles user inputs and displays the generated resumes and cover letters.
- Business Logic & Controller: The core of the app (also in app.py) which processes user input, coordinates between various internal components, and manages overall workflow.
- Template Rendering: The templates directory (with resume_template.html and cover_letter_template.html) is used to format the final output.
- External Services:
- AI Content Generation Service: Integration with the OpenAI API (using GPT-3.5) for generating AI-optimized content.
- PDF Generation Service: Using WeasyPrint to convert the rendered HTML output into PDF files.
- Dependency & Configuration Management: Represented by requirements.txt (and in the README, additional directories like .streamlit and secrets.toml are mentioned for configuration and credentials management).

##### Relationships and Interactions
- A flow from the User node to the Streamlit UI node, indicating how user input (personal information, work history, etc.) is captured.
- From the controller, branch out to:
- A “Template Renderer” node which utilizes HTML templates for building the final resume/cover letter.
- An “AI Service Integration” node where the application calls the OpenAI API to generate content such as bullet points and tailored narratives.
- A “PDF Converter” node that involves WeasyPrint to produce formatted PDF outputs.

##### Architectural Patterns & Design Principles
- Although this is a relatively small project, it follows a separation of concerns: UI/Rendering, Business Logic, and External Service Integration are distinctly separated.
- The use of modular HTML templates (for resumes and cover letters) indicates a template-based rendering approach.
- The integration with third-party services (like OpenAI API and WeasyPrint) emphasizes a loosely coupled external dependency architecture.

##### Relevant Technologies/Frameworks
- Python 3.9+ as the primary programming language.
- Streamlit as the UI framework.
- OpenAI API for AI-powered content generation.
- WeasyPrint for PDF generation.
- lru_cache for optimizing API calls.
- HTML and CSS (implied in the templates) to build the final resume and cover letter formats.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% User Interaction Layer
    U["User"]:::frontend

    %% Application Layer
    A["App (Streamlit UI & Controller)"]:::backend
    T["Template Renderer (templates)"]:::backend
    AI["OpenAI API (GPT-3.5)"]:::external
    PDF["PDF Generator (WeasyPrint)"]:::external
    C["Configuration Management (requirements.txt)"]:::config

    %% Data Flow
    U -->|"submits_input"| A
    A -->|"calls_AI"| AI
    AI -->|"returns_text"| A
    A -->|"renders_HTML"| T
    T -->|"converts_to_PDF"| PDF
    PDF -->|"pdf_output"| U
    C -->|"provides_config"| A

    %% Click Events
    click A "https://github.com/oliviacoding/easyapplyai/blob/main/app.py"
    click T "https://github.com/oliviacoding/easyapplyai/tree/main/templates/"
    click AI "https://github.com/oliviacoding/easyapplyai/blob/main/app.py"
    click PDF "https://github.com/oliviacoding/easyapplyai/blob/main/app.py"
    click C "https://github.com/oliviacoding/easyapplyai/blob/main/requirements.txt"

    %% Styles
    classDef frontend fill:#ffebcd,stroke:#000,stroke-width:2px;
    classDef backend fill:#add8e6,stroke:#000,stroke-width:2px;
    classDef external fill:#ffe4e1,stroke:#000,stroke-width:2px;
    classDef config fill:#d3ffd3,stroke:#000,stroke-width:2px;
```
