# danish0511/career_conversation_chatbot architecture

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

- Interactive diagram: https://gitdiagram.com/danish0511/career_conversation_chatbot
- Repository: https://github.com/danish0511/career_conversation_chatbot

## Overview

##### Project type and purpose
- This is a lightweight, serverless full-stack web application (“career_conversation”) that uses the Gradio SDK (v5.38.0) to serve a conversational UI on the web.
- The primary entrypoint is app.py (with possible supplemental logic in main.py). The “files” directory holds Jupyter notebooks (lab1-4) for offline experimentation or preprocessing, not part of the live service.
- Deployment is handled via Vercel (see the .vercel folder and project.json).

##### File structure
- Top-level code:
- app.py – Gradio app definition and serverless handler.
- main.py – supplemental business logic or helper functions imported by app.py.
- Config files:
- .env – environment variables (API keys, config).
- pyproject.toml & requirements.txt – dependencies.
- .vercel/project.json – Vercel deployment settings.
- Supporting docs: Profile.pdf/.txt and README.md.
- “files” folder: Jupyter notebooks for lab exercises or data prep (offline only).

##### README
- Confirms: title “career_conversation,” Gradio-based UI, entrypoint app.py, SDK version.
- No mention of database, so assume stateless serverless functions, possibly calling external APIs (e.g., an LLM provider).

##### Main components
a. User’s web browser (Client)
b. Gradio frontend (served as static assets + JS/CSS by Vercel)
c. Serverless backend function (app.py running under Vercel’s Python runtime)
d. Business logic layer (functions in main.py)
e. External services:
- Environment variable store (from .env / Vercel env settings)
- Potential third-party API (e.g., OpenAI, if used in code)
f. Offline notebooks (files/lab*.ipynb) – represent them as “Data Science / Preprocessing” module, not in the live request path.

##### Relationships and interactions
1. User → (HTTP) → Gradio UI served by Vercel
2. Gradio UI → (WebSocket / REST call) → app.py function
3. app.py → main.py functions for processing
4. main.py → external API (if any) using credentials from environment variables
5. Response flows back app.py → UI → User
6. Offline notebooks stand aside for data scientists, not invoked during runtime.

##### Architectural patterns and design principles
- Serverless microservice: each request triggers a fresh app.py invocation.
- Layered separation:
- Presentation layer (Gradio UI)
- Application layer (app.py as handler)
- Domain/Logic layer (main.py functions)
- External integration (third-party APIs, config store)
- 12-factor app compliance: environment variables, single codebase, stateless runtime.

##### Essential elements
- Deployment boundary around Vercel-hosted parts
- Offline/sidecar notebook component drawn outside the runtime path

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Client
    Client["Client (Browser)"]:::ui

    %% Vercel Deployment Boundary
    subgraph "Vercel Deployment"
        direction TB
        VercelUI["Gradio UI (CDN + Edge)"]:::ui
        ServerFunc["Serverless Function<br>(app.py)"]:::backend
    end

    %% Business Logic
    BizLogic["Business Logic<br>(main.py)"]:::backend

    %% External Services
    subgraph "External Services"
        direction TB
        EnvStore["Environment Variables Store<br>(.env / Vercel Env)"]:::external
        ExtAPI["Third-Party API<br>(e.g., OpenAI)"]:::external
    end

    %% Offline Data Science
    subgraph "Offline Data Science / Preprocessing"
        direction TB
        Lab1["lab1.ipynb"]:::offline
        Lab2["lab2.ipynb"]:::offline
        Lab3["lab3.ipynb"]:::offline
        Lab4["lab4.ipynb"]:::offline
    end

    %% Configuration Files
    ConfigReq["requirements.txt"]:::docs
    ConfigPy["pyproject.toml"]:::docs
    VercelConfig["project.json<br>(.vercel/project.json)"]:::docs
    VercelDir[".vercel"]:::docs

    %% Documentation
    README["README.md"]:::docs
    ProfilePDF["Profile.pdf"]:::docs
    ProfileTXT["Profile.txt"]:::docs

    %% Data Flow
    Client -->|"HTTP Request"| VercelUI
    VercelUI -->|"WebSocket/REST"| ServerFunc
    ServerFunc -->|"invoke"| BizLogic
    BizLogic -->|"uses creds"| EnvStore
    BizLogic -->|"calls"| ExtAPI
    ExtAPI -->|"response"| BizLogic
    BizLogic -->|"return data"| ServerFunc
    ServerFunc -->|"update UI"| VercelUI
    VercelUI -->|"HTTP Response"| Client

    %% Click Events
    click ServerFunc "https://github.com/danish0511/career_conversation_chatbot/blob/main/app.py"
    click BizLogic "https://github.com/danish0511/career_conversation_chatbot/blob/main/main.py"
    click EnvStore "https://github.com/danish0511/career_conversation_chatbot/blob/main/.env"
    click VercelConfig "https://github.com/danish0511/career_conversation_chatbot/blob/main/.vercel/project.json"
    click VercelDir "https://github.com/danish0511/career_conversation_chatbot/blob/main/.vercel"
    click Lab1 "https://github.com/danish0511/career_conversation_chatbot/blob/main/files/lab1.ipynb"
    click Lab2 "https://github.com/danish0511/career_conversation_chatbot/blob/main/files/lab2.ipynb"
    click Lab3 "https://github.com/danish0511/career_conversation_chatbot/blob/main/files/lab3.ipynb"
    click Lab4 "https://github.com/danish0511/career_conversation_chatbot/blob/main/files/lab4.ipynb"
    click ConfigReq "https://github.com/danish0511/career_conversation_chatbot/blob/main/requirements.txt"
    click ConfigPy "https://github.com/danish0511/career_conversation_chatbot/blob/main/pyproject.toml"
    click README "https://github.com/danish0511/career_conversation_chatbot/blob/main/README.md"
    click ProfilePDF "https://github.com/danish0511/career_conversation_chatbot/blob/main/Profile.pdf"
    click ProfileTXT "https://github.com/danish0511/career_conversation_chatbot/blob/main/Profile.txt"

    %% Styles
    classDef ui fill:#D0E8FF,stroke:#0366d6,color:#0366d6
    classDef backend fill:#D4F4DD,stroke:#2e7d32,color:#2e7d32
    classDef external fill:#FFE0B2,stroke:#ef6c00,color:#ef6c00
    classDef offline fill:#E0E0E0,stroke:#616161,color:#616161
    classDef docs fill:#F5F5F5,stroke:#888888,color:#333333
```
