# kuljotsb/copilotfullstackapp architecture

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

- Interactive diagram: https://gitdiagram.com/kuljotsb/copilotfullstackapp
- Repository: https://github.com/kuljotsb/copilotfullstackapp

## Overview

##### Project Type and Purpose
- This is a full‑stack web application (“Custom Copilot Full Stack App”) that demonstrates a proof‑of‑concept of the Copilot Stack.
- Frontend is React/Vite; backend is a .NET 8 Web API augmented by the Semantic Kernel SDK; it orchestrates calls to Azure OpenAI, Azure AI Search (RAG), and various plugins.
- An Azure Function listens to a Storage Queue to persist chat history into Cosmos DB.

##### File Structure
Top‑level directories:
- frontend/frontend – React app (components, CSS, index.html, vite.config.js)
- backend – .NET C# Web API (Program.cs, controllers, Dtos, plugin code)
– backend/AISearch – scripts & JSONs to provision AI Search (data ingestion, index, skillset)
– backend/pluginFunctions & backend/plugins – native and prompt‑template plugins loaded by Semantic Kernel
- azureFunctions/StorageQueueFunction – Azure Function (queue trigger) that writes to Cosmos DB
- infrastructure_setup – PowerShell script (deploy.ps1) to provision Azure infra (storage, function, search, cosmos, OpenAI)
- solution file copilot_stack_app.sln

##### Extract Additional Insights from README
- Architecture uses: React front‑end, .NET Web API, Semantic Kernel as orchestration layer, Azure OpenAI for LLM, Azure Storage (blobs for AI Search docs, queues for chat events), Azure AI Search, Cosmos DB for persistence and audit, Bing Searcher Plugin, Microsoft Graph Plugin.
- Provides step‑by‑step local run instructions, infra deployment, AI Search provisioning, Function run locally.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "User Interface"
        UI["React UI"]:::ui
        click UI "https://github.com/kuljotsb/copilotfullstackapp/tree/main/frontend/frontend"
    end

    subgraph "Backend / API"
        API[".NET 8 Web API"]:::compute
        click API "https://github.com/kuljotsb/copilotfullstackapp/blob/main/backend/Program.cs"
        click API "https://github.com/kuljotsb/copilotfullstackapp/blob/main/backend/backend.csproj"
        click API "https://github.com/kuljotsb/copilotfullstackapp/blob/main/backend/appsettings.json"
        click API "https://github.com/kuljotsb/copilotfullstackapp/blob/main/backend/appsettings.Development.json"

        subgraph "Kernel Orchestration"
            Kernel["Semantic Kernel"]:::compute
        end

        subgraph "Plugin Library"
            subgraph "Native Plugins"
                AISearchPlugin["AISearchPlugin"]:::compute
                click AISearchPlugin "https://github.com/kuljotsb/copilotfullstackapp/blob/main/backend/plugins/nativePlugins/AISearchPlugin.cs"
                BasicChatPlugin["BasicChatPlugin"]:::compute
                click BasicChatPlugin "https://github.com/kuljotsb/copilotfullstackapp/blob/main/backend/plugins/nativePlugins/BasicChatPlugin.cs"
                GraphPlugin["GraphPlugin"]:::compute
                click GraphPlugin "https://github.com/kuljotsb/copilotfullstackapp/blob/main/backend/plugins/nativePlugins/GraphPlugin.cs"
                WebSearcherPlugin["WebSearcherPlugin"]:::compute
                click WebSearcherPlugin "https://github.com/kuljotsb/copilotfullstackapp/blob/main/backend/plugins/nativePlugins/WebSearcherPlugin.cs"
            end
            subgraph "Prompt-Template Plugins"
                PTPlugins["Prompt-Template Plugins"]:::compute
                click PTPlugins "https://github.com/kuljotsb/copilotfullstackapp/tree/main/backend/plugins/promptTemplatePlugins"
            end
        end

        StorageQueueClient["StorageQueue Client"]:::compute
        click StorageQueueClient "https://github.com/kuljotsb/copilotfullstackapp/blob/main/backend/StorageQueue/StorageQueue.cs"
    end

    subgraph "Azure Cloud"
        BlobStorage["Blob Storage (Blob container)"]:::data
        click BlobStorage "https://github.com/kuljotsb/copilotfullstackapp/tree/main/backend/AISearch/data"
        AzureAIIndex["Azure AI Search (RAG Index)"]:::service
        click AzureAIIndex "https://github.com/kuljotsb/copilotfullstackapp/blob/main/backend/AISearch/index.json"
        StorageQueue["Storage Queue"]:::service
        FunctionApp["Azure Function (Queue Trigger)"]:::compute
        click FunctionApp "https://github.com/kuljotsb/copilotfullstackapp/blob/main/azureFunctions/StorageQueueFunction/QueueStorageFunction.cs"
        click FunctionApp "https://github.com/kuljotsb/copilotfullstackapp/blob/main/azureFunctions/StorageQueueFunction/host.json"
        CosmosDB["Azure Cosmos DB"]:::data
        click CosmosDB "https://github.com/kuljotsb/copilotfullstackapp/blob/main/azureFunctions/StorageQueueFunction/Data/ChatHistoryDB.cs"
        OpenAI["Azure OpenAI Service"]:::service
    end

    ExternalBing["Bing Search API"]:::external
    ExternalGraph["Microsoft Graph API"]:::external

    Infra["Deploy Script (deploy.ps1)"]:::external
    click Infra "https://github.com/kuljotsb/copilotfullstackapp/blob/main/infrastructure_setup/deploy.ps1"
    Solution["Solution File (copilot_stack_app.sln)"]:::external
    click Solution "https://github.com/kuljotsb/copilotfullstackapp/blob/main/copilot_stack_app.sln"

    UI -->|"HTTP request"| API
    API -->|"orchestrates via"| Kernel
    Kernel -->|".Call()"| AISearchPlugin
    Kernel -->|".Call()"| BasicChatPlugin
    Kernel -->|".Call()"| GraphPlugin
    Kernel -->|".Call()"| WebSearcherPlugin
    Kernel -->|"uses"| PTPlugins
    Kernel -->|"SDK call"| OpenAI
    Kernel -->|"RAG retrieval"| AzureAIIndex
    AzureAIIndex -->|"indexes docs from"| BlobStorage
    API -->|"enqueue event"| StorageQueueClient
    StorageQueueClient -->|".Enqueue()"| StorageQueue
    StorageQueue -->|"triggers"| FunctionApp
    FunctionApp -->|"writes"| CosmosDB
    API -->|"reads/writes"| CosmosDB
    Kernel -->|"invokes"| ExternalBing
    Kernel -->|"invokes"| ExternalGraph

    classDef ui fill:#cce5ff,stroke:#004085,color:#004085
    classDef compute fill:#d4edda,stroke:#155724,color:#155724
    classDef data fill:#fff3cd,stroke:#856404,color:#856404
    classDef service fill:#e2e3e5,stroke:#818182,color:#818182
    classDef external fill:#f8d7da,stroke:#721c24,color:#721c24
```
