# duybaohuynhtan/careeragent architecture

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

- Interactive diagram: https://gitdiagram.com/duybaohuynhtan/careeragent
- Repository: https://github.com/duybaohuynhtan/careeragent

## Overview

##### Project Type & Purpose
- This is a full-stack, AI-powered career assistant (“CareerAgent”) with a React/Next.js frontend, a FastAPI backend, and an agentic layer built with LangChain and Groq.
- Purpose: Parse an uploaded resume, extract structured data, then perform a LinkedIn job search via Google CSE, all orchestrated through a conversational chat interface.

##### File-Structure Analysis
- Top level:
- backend/ – Python code: FastAPI server (fastapi_server.py), agent logic (job_search_agent.py), CV parser tools, LinkedIn search tools, config, schema, models.json
- frontend/ – Next.js app (TypeScript, Tailwind CSS), components (ChatInterface, ChatInput, FileUpload, ModelSelector, ChatMessage), client-side API wrappers (api.ts), global layout and page
- tester/ – Jupyter notebooks for end-to-end and unit tests
- Patterns:
- Layered architecture (UI → API → Agent → Tools → External Services)
- Tool-based agent pattern in LangChain

##### README Insights
- Frontend → FastAPI /chat and /upload endpoints
- FastAPI → JobSearchAgent (LangChain)
- Agent → CV Parser Tool (PyPDF2 + Groq) and LinkedIn Search Tool (Google CSE)
- External services: Groq LLM API, Google Custom Search API
- Tech stack is clearly listed under Backend and Frontend sections.

- User’s Browser / Mobile App (React/Next.js UI)
- Frontend Components: ChatInterface, FileUpload, ModelSelector
- API Layer: FastAPI Server (fastapi_server.py)
- Agent Core: JobSearchAgent (job_search_agent.py)
- Tool Modules:
- CV Parser Tool (cv_parser_tool.py + PyPDF2 + Groq API)
- LinkedIn Search Tool (linkedin_job_search_tool.py + Google CSE API)
- External Services: Groq LLM Service, Google Custom Search Engine
- Data Artifacts: Uploaded PDF (MyCV.pdf), Structured Resume Data, Job Listings
- User → Frontend UI (user types, uploads PDF)
- Frontend (ChatInput/FileUpload) → HTTP POST → FastAPI (/chat, /upload)
- FastAPI → instantiates JobSearchAgent → calls Tool Modules
- CV Parser Tool → reads PDF → extracts text via PyPDF2 → sends text to Groq LLM → returns structured data
- LinkedIn Search Tool → issues queries to Google CSE → receives job listings
- JobSearchAgent → aggregates tool outputs → returns chat response → FastAPI → HTTP response → Frontend displays in ChatInterface
c. Architectural Patterns & Design Principles:
- Layered separation: UI / API / Domain / Infrastructure
- Agentic design: single “JobSearchAgent” coordinating multiple tools
- Micro-tool pattern: each tool with single responsibility (parsing vs. searching)
- Stateless, request-driven flow (HTTP in, HTTP out)
d. Key Technologies & Frameworks:
- Frontend: Next.js, React, TypeScript, Tailwind CSS
- Backend: Python, FastAPI, Uvicorn, python-dotenv
- LLM / Agent: LangChain, LangChain-Groq, Groq API
- PDF Parsing: PyPDF2
- External Search: Google Custom Search API

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% User Layer
    User((User Browser)):::user

    %% Frontend Layer
    subgraph "Frontend UI" 
        direction TB
        ChatInterface["ChatInterface"]:::frontend
        ChatInput["ChatInput"]:::frontend
        FileUpload["FileUpload"]:::frontend
        ModelSelector["ModelSelector"]:::frontend
        ChatMessage["ChatMessage"]:::frontend
        APIWrapper["API Wrapper (api.ts)"]:::frontend
        Utils["Utilities (utils.ts)"]:::frontend
        Types["Type Definitions (chat.ts)"]:::frontend
        Layout["Global Layout"]:::frontend
        Pages["Page"]:::frontend
        Styling["Styling & Config"]:::frontend
    end

    %% Backend / API Layer
    subgraph "API Layer" 
        direction TB
        FastAPI["FastAPI Server\n(fastapi_server.py)"]:::backend
        Config["Config (config.py)"]:::backend
        Schema["Schemas & Models"]:::backend
    end

    %% Agent & Tools Layer
    subgraph "Agent & Tools" 
        direction TB
        Agent["JobSearchAgent\n(job_search_agent.py)"]:::agent
        CVParserTool["CV Parser Tool\n(cv_parser_tool.py)"]:::agent
        ManualParser["Manual Parser\n(manual_parser.py)"]:::agent
        CVUtils["CV Parsing Utils\n(cv_parser.py)"]:::agent
        LinkedInTool["LinkedIn Search Tool\n(linkedin_job_search_tool.py)"]:::agent
        GoogleCSE["Google CSE Integration\n(google_cse_linkedin_search.py)"]:::agent
    end

    %% External Services
    subgraph "External Services"
        direction TB
        GroqAPI[[Groq LLM API]]:::external
        GoogleCSEAPI[[Google Custom Search API]]:::external
    end

    %% Data Artifacts
    subgraph "Data Artifacts"
        direction TB
        ResumePDF["Uploaded Resume PDF\n(MyCV.pdf)"]:::data
        StructuredData["Structured Resume Data\n(JSON)"]:::data
        JobListings["Job Listings\n(JSON)"]:::data
    end

    %% Connections
    User --> ChatInterface
    User --> FileUpload

    ChatInterface --> ChatInput
    ChatInterface --> ChatMessage
    ChatInterface --> ModelSelector
    ChatInput --> APIWrapper
    FileUpload --> APIWrapper
    ModelSelector --> APIWrapper

    APIWrapper -->|HTTP POST /chat| FastAPI
    APIWrapper -->|HTTP POST /upload| FastAPI

    FastAPI --> Config
    FastAPI --> Schema
    FastAPI --> Agent
    FastAPI -->|loads config & models| Schema

    Agent --> CVParserTool
    Agent --> LinkedInTool

    CVParserTool --> CVUtils
    CVParserTool --> ResumePDF
    CVParserTool -->|extracted text| GroqAPI
    GroqAPI -->|structured data| CVParserTool
    CVParserTool --> StructuredData

    LinkedInTool --> GoogleCSEAPI
    GoogleCSEAPI -->|job results| LinkedInTool
    LinkedInTool --> JobListings

    Agent -->|aggregates outputs| FastAPI
    FastAPI -->|HTTP Response| APIWrapper
    APIWrapper --> ChatInterface

    %% Click events
    click ChatInterface "https://github.com/duybaohuynhtan/careeragent/blob/master/frontend/src/components/ChatInterface.tsx"
    click ChatInput "https://github.com/duybaohuynhtan/careeragent/blob/master/frontend/src/components/ChatInput.tsx"
    click FileUpload "https://github.com/duybaohuynhtan/careeragent/blob/master/frontend/src/components/FileUpload.tsx"
    click ModelSelector "https://github.com/duybaohuynhtan/careeragent/blob/master/frontend/src/components/ModelSelector.tsx"
    click ChatMessage "https://github.com/duybaohuynhtan/careeragent/blob/master/frontend/src/components/ChatMessage.tsx"
    click APIWrapper "https://github.com/duybaohuynhtan/careeragent/blob/master/frontend/src/lib/api.ts"
    click Utils "https://github.com/duybaohuynhtan/careeragent/blob/master/frontend/src/lib/utils.ts"
    click Types "https://github.com/duybaohuynhtan/careeragent/blob/master/frontend/src/types/chat.ts"
    click Layout "https://github.com/duybaohuynhtan/careeragent/blob/master/frontend/src/app/layout.tsx"
    click Pages "https://github.com/duybaohuynhtan/careeragent/blob/master/frontend/src/app/page.tsx"
    click Styling "https://github.com/duybaohuynhtan/careeragent/blob/master/frontend/src/app/globals.css"
    click Styling "https://github.com/duybaohuynhtan/careeragent/blob/master/frontend/tailwind.config.js"
    click Styling "https://github.com/duybaohuynhtan/careeragent/blob/master/frontend/tsconfig.json"
    click Styling "https://github.com/duybaohuynhtan/careeragent/blob/master/frontend/next.config.js"
    click FastAPI "https://github.com/duybaohuynhtan/careeragent/blob/master/backend/fastapi_server.py"
    click Agent "https://github.com/duybaohuynhtan/careeragent/blob/master/backend/job_search_agent.py"
    click CVParserTool "https://github.com/duybaohuynhtan/careeragent/blob/master/backend/cv_parser_tool.py"
    click ManualParser "https://github.com/duybaohuynhtan/careeragent/blob/master/backend/manual_parser.py"
    click CVUtils "https://github.com/duybaohuynhtan/careeragent/blob/master/backend/cv_parser.py"
    click LinkedInTool "https://github.com/duybaohuynhtan/careeragent/blob/master/backend/linkedin_job_search_tool.py"
    click GoogleCSE "https://github.com/duybaohuynhtan/careeragent/blob/master/backend/google_cse_linkedin_search.py"
    click Config "https://github.com/duybaohuynhtan/careeragent/blob/master/backend/config.py"
    click Schema "https://github.com/duybaohuynhtan/careeragent/blob/master/backend/schema.py"
    click Schema "https://github.com/duybaohuynhtan/careeragent/blob/master/backend/models.json"
    click ResumePDF "https://github.com/duybaohuynhtan/careeragent/blob/master/MyCV.pdf"
    click JobListings "https://github.com/duybaohuynhtan/careeragent/blob/master/requirements.txt"
    click JobListings "https://github.com/duybaohuynhtan/careeragent/blob/master/README.md"
    click JobListings "https://github.com/duybaohuynhtan/careeragent/blob/master/.gitignore"
    click JobListings "https://github.com/duybaohuynhtan/careeragent/tree/master/LICENSE"
    click JobListings "https://github.com/duybaohuynhtan/careeragent/blob/master/tester/agent_tools_test.ipynb"
    click JobListings "https://github.com/duybaohuynhtan/careeragent/blob/master/tester/function_tests.ipynb"

    %% Styles
    classDef user fill:#f9f,stroke:#333,stroke-width:1px
    classDef frontend fill:#ADD8E6,stroke:#333,stroke-width:1px
    classDef backend fill:#90EE90,stroke:#333,stroke-width:1px
    classDef agent fill:#FFA500,stroke:#333,stroke-width:1px
    classDef external fill:#DDA0DD,stroke:#333,stroke-width:1px
    classDef data fill:#D3D3D3,stroke:#333,stroke-width:1px
```
