# halilkoseh/llm-agent-project architecture

> Architecture diagram of the GitHub repository halilkoseh/llm-agent-project, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-06-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/halilkoseh/llm-agent-project
- Repository: https://github.com/halilkoseh/llm-agent-project

## Overview

##### Project type and purpose
- This is a full-stack monolithic web application built on Laravel (PHP) with Blade templates (and Vue/JS assets via Vite).
- Its purpose is to provide an LLM-powered interactive code analysis, testing, and commentary platform supporting multiple languages.

##### File structure
- Top-level directories:
- app/Http/Controllers → HTTP entry points (Auth, Chat, CodeRun, Comments, Feedback, QuickQuestion, History, Profile, Dashboard, etc.)
- app/Models → Eloquent models (User, Chat, Message, Request, ModelOutput, UserFeedback, Contact)
- resources/views → Blade templates for pages & UI components
- resources/js & resources/css → frontend assets (Vue or plain JS)
- database/migrations & seeders → schema and initial data
- config, bootstrap, routes → framework config, service providers, routes
- public/ → web root (index.php bootstraps Laravel)
- External integration is implied by CodeRunController and ChatController (calls to OpenAI or other LLM APIs).
- Background jobs/queues may be used (config/queue.php).

##### README for additional insights
- Uses Laravel backend, Vue.js (or similar) frontend, MySQL database.
- Integrates with OpenAI GPT/Codex for code analysis, unit test generation, UI testing.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Client
    Client["Client (Browser)"]:::frontend
    subgraph "Frontend Assets"
        AppJS["app.js"]:::frontend
        AppCSS["app.css"]:::frontend
        Vite["vite.config.js"]:::frontend
    end

    %% Web Server
    subgraph "Web Server"
        IndexPHP["index.php"]:::backend
        HTAccess[".htaccess"]:::backend
    end

    %% Laravel Application
    subgraph "Laravel App"
        subgraph "HTTP Layer"
            RoutesWeb["routes/web.php"]:::backend
            RoutesAuth["routes/auth.php"]:::backend
            subgraph "Controllers"
                ChatController["ChatController"]:::backend
                CodeRunController["CodeRunController"]:::backend
                CommentController["CommentController"]:::backend
                FeedbackController["FeedbackController"]:::backend
                QuickQuestionController["QuickQuestionController"]:::backend
                HistoryController["HistoryController"]:::backend
                ProfileController["ProfileController"]:::backend
                DashboardController["DashboardController"]:::backend
            end
        end

        subgraph "Service & Queue Layer"
            ServicesConfig["config/services.php"]:::service
            QueueConfig["config/queue.php"]:::service
            LLMClient["LLMClient"]:::service
            CodeAnalysis["CodeAnalysisService"]:::service
            TestGeneration["TestGenerationService"]:::service
            subgraph "Queue Worker"
                Worker["Queue Worker"]:::service
            end
        end

        subgraph "Data Layer"
            subgraph "Models"
                UserModel["User"]:::model
                ChatModel["Chat"]:::model
                MessageModel["Message"]:::model
                RequestModel["Request"]:::model
                ModelOutputModel["ModelOutput"]:::model
                UserFeedbackModel["UserFeedback"]:::model
                ContactModel["Contact"]:::model
            end
            subgraph "Migrations"
                MChat["create_chats_table"]:::database
                MMessage["create_messages_table"]:::database
                MRequest["create_requests_table"]:::database
                MOutput["create_model_outputs_table"]:::database
                MFeedback["create_user_feedbacks_table"]:::database
                MContact["create_contacts_table"]:::database
            end
            DB["MySQL Database"]:::database
        end

        FileStorage["File Storage\n(storage/app/private,\nstorage/logs)"]:::database
        Cache["Cache (Redis/File)"]:::database
    end

    %% External Services
    subgraph "External Services"
        OpenAI["OpenAI API"]:::external
        Sandbox["Code Sandbox"]:::external
    end

    %% Connections
    Client -->|"HTTP Request"| IndexPHP
    AppJS --> Client
    AppCSS --> Client
    Vite --> AppJS
    IndexPHP -->|"Routes"| RoutesWeb
    RoutesWeb --> ChatController
    RoutesWeb --> CodeRunController
    RoutesWeb --> CommentController
    RoutesAuth --> FeedbackController
    RoutesWeb --> QuickQuestionController
    RoutesWeb --> HistoryController
    RoutesWeb --> ProfileController
    RoutesWeb --> DashboardController

    ChatController -->|calls| LLMClient
    CodeRunController -->|calls| CodeAnalysis
    CodeRunController -->|dispatches job| Worker
    Worker -->|executes| Sandbox
    Worker -->|stores output| ModelOutputModel
    Worker -->|stores logs| FileStorage

    LLMClient -->|API Call| OpenAI
    CodeAnalysis -->|API Call| OpenAI
    TestGeneration -->|API Call| OpenAI

    ChatController -->|reads/writes| ChatModel
    ChatController -->|reads/writes| MessageModel
    FeedbackController -->|reads/writes| UserFeedbackModel
    QuickQuestionController -->|reads/writes| RequestModel
    ProfileController -->|reads/writes| UserModel
    HistoryController -->|reads/writes| RequestModel
    DashboardController -->|reads aggregates| ModelOutputModel

    Models --> DB
    MChat --> DB
    MMessage --> DB
    MRequest --> DB
    MOutput --> DB
    MFeedback --> DB
    MContact --> DB

    ChatController -->|"View Rendering"| FileStorage
    Client -->|"AJAX"| ChatController
    Client -->|"AJAX"| CodeRunController

    %% Click Events
    click AppJS "https://github.com/halilkoseh/llm-agent-project/blob/main/resources/js/app.js"
    click AppCSS "https://github.com/halilkoseh/llm-agent-project/blob/main/resources/css/app.css"
    click Vite "https://github.com/halilkoseh/llm-agent-project/blob/main/vite.config.js"
    click IndexPHP "https://github.com/halilkoseh/llm-agent-project/blob/main/public/index.php"
    click HTAccess "https://github.com/halilkoseh/llm-agent-project/blob/main/public/.htaccess"
    click RoutesWeb "https://github.com/halilkoseh/llm-agent-project/blob/main/routes/web.php"
    click RoutesAuth "https://github.com/halilkoseh/llm-agent-project/blob/main/routes/auth.php"
    click ChatController "https://github.com/halilkoseh/llm-agent-project/blob/main/app/Http/Controllers/ChatController.php"
    click CodeRunController "https://github.com/halilkoseh/llm-agent-project/blob/main/app/Http/Controllers/CodeRunController.php"
    click CommentController "https://github.com/halilkoseh/llm-agent-project/blob/main/app/Http/Controllers/CommentController.php"
    click FeedbackController "https://github.com/halilkoseh/llm-agent-project/blob/main/app/Http/Controllers/FeedbackController.php"
    click QuickQuestionController "https://github.com/halilkoseh/llm-agent-project/blob/main/app/Http/Controllers/QuickQuestionController.php"
    click HistoryController "https://github.com/halilkoseh/llm-agent-project/blob/main/app/Http/Controllers/HistoryController.php"
    click ProfileController "https://github.com/halilkoseh/llm-agent-project/blob/main/app/Http/Controllers/ProfileController.php"
    click DashboardController "https://github.com/halilkoseh/llm-agent-project/blob/main/app/Http/Controllers/DashboardController.php"
    click ServicesConfig "https://github.com/halilkoseh/llm-agent-project/blob/main/config/services.php"
    click QueueConfig "https://github.com/halilkoseh/llm-agent-project/blob/main/config/queue.php"
    click UserModel "https://github.com/halilkoseh/llm-agent-project/blob/main/app/Models/User.php"
    click ChatModel "https://github.com/halilkoseh/llm-agent-project/blob/main/app/Models/Chat.php"
    click MessageModel "https://github.com/halilkoseh/llm-agent-project/blob/main/app/Models/Message.php"
    click RequestModel "https://github.com/halilkoseh/llm-agent-project/blob/main/app/Models/Request.php"
    click ModelOutputModel "https://github.com/halilkoseh/llm-agent-project/blob/main/app/Models/ModelOutput.php"
    click UserFeedbackModel "https://github.com/halilkoseh/llm-agent-project/blob/main/app/Models/UserFeedback.php"
    click ContactModel "https://github.com/halilkoseh/llm-agent-project/blob/main/app/Models/Contact.php"
    click MChat "https://github.com/halilkoseh/llm-agent-project/blob/main/database/migrations/*create_chats_table.php"
    click MMessage "https://github.com/halilkoseh/llm-agent-project/blob/main/database/migrations/*create_messages_table.php"
    click MRequest "https://github.com/halilkoseh/llm-agent-project/blob/main/database/migrations/*create_requests_table.php"
    click MOutput "https://github.com/halilkoseh/llm-agent-project/blob/main/database/migrations/*create_model_outputs_table.php"
    click MFeedback "https://github.com/halilkoseh/llm-agent-project/blob/main/database/migrations/*create_user_feedbacks_table.php"
    click MContact "https://github.com/halilkoseh/llm-agent-project/blob/main/database/migrations/*create_contacts_table.php"
    click FileStorage "https://github.com/halilkoseh/llm-agent-project/tree/main/storage/app/private"
    click FileStorage "https://github.com/halilkoseh/llm-agent-project/tree/main/storage/logs"
    click Cache "https://github.com/halilkoseh/llm-agent-project/blob/main/config/cache.php"
    click Cache "https://github.com/halilkoseh/llm-agent-project/blob/main/config/database.php"

    %% Styles
    classDef frontend fill:#D0E8FF,stroke:#0366d6,color:#0366d6;
    classDef backend fill:#E2E8F0,stroke:#1E293B,color:#1E293B;
    classDef service fill:#FEF3C7,stroke:#D97706,color:#92400E;
    classDef model fill:#F0FDF4,stroke:#047857,color:#065F46;
    classDef database fill:#ECFDF5,stroke:#10B981,color:#065F46;
    classDef external fill:#F0F9FF,stroke:#0284C7,color:#0369A1;
```
