# symaiotics/mpersona-vue-v1 architecture

> Architecture diagram of the GitHub repository symaiotics/mpersona-vue-v1, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/symaiotics/mpersona-vue-v1
- Repository: https://github.com/symaiotics/mpersona-vue-v1

## Overview

##### Project type and purpose
- From the README and file tree, mPersona is a full-stack persona-management tool. This package is the Vue.js single-page frontend (deployed as an Azure Static Web App) that communicates with a Node.js API/WebSocket backend and Azure Blob Storage, and in turn orchestrates calls to external LLM services (OpenAI, Anthropic).

##### File structure
- Top-level:
- staticwebapp.config.json, GitHub Actions workflow → deployment on Azure Static Web Apps
- public/ → static assets and redirect rules
- index.html → SPA entry point
- vite.config.js, postcss.config.js, tailwind.config.js → build & styling pipeline
- src/:
- main.js, App.vue → application bootstrap
- router.js → route definitions (Home, Chat, KnowledgeProfiles, etc.)
- pages/ → page-level Vue components (views)
- components/ → UI widgets, panels, file-draggers, persona editors, chat windows, etc.
- composables/ → Vue Composition API hooks that encapsulate all API, WebSocket, and Storage interactions (useAxios, useWebsockets, useFiles, useKnowledgeProfiles, etc.)
- utils/ → shared utilities (axios instance, JSON/code extractor, chart helpers)
- css/ → Tailwind + custom styles

##### README for additional insights
- Key environment variables:
- SELF: front-end host URL
- API_URL: REST endpoint for Node.js server
- WEBSOCKET_URL: WebSocket endpoint
- STORAGE_URL: Azure Blob Storage base URL
- Build scripts: npm run dev/build, automated via GitHub Actions

1. End User & Browser (runs the Vue SPA)
2. Vue SPA layers:
– Router & Views (src/pages)
– UI Components (src/components)
– State & API layers (src/composables + src/utils/axios)
3. Static Web App Hosting (Azure Static Web Apps / CDN)
4. Node.js Backend:
– REST API (HTTP)
– WebSocket Server
5. Azure Blob Storage
6. External LLM Services (OpenAI, Anthropic)
7. CI/CD Pipeline (GitHub Actions)
b. Relationships & interactions:
– Browser →[HTTP(S)]→ Azure CDN → serves index.html & JS bundles → Browser
– Vue SPA →[HTTP REST]→ Node.js REST API →[DB/Logic]→ External LLM
– Vue SPA →[WebSocket]→ Node.js WS Server → pushes chat updates back → Browser
– Node.js API →[HTTPS]→ Azure Blob Storage for file uploads/downloads
– CI/CD →[push to Main branch]→ GitHub Actions → build & deploy to Azure Static Web Apps
c. Architectural patterns & design principles:
– Single-Page Application (SPA) with clear separation: presentation (components), state/data (composables), routing (router.js)
– Composition API for modular, reusable data‐fetching hooks
– Two-channel communication: REST for CRUD, WebSocket for live chat events
– Static hosting of UI, dynamic interactions via API & WS
d. Key technologies to annotate:
– Vue.js 3, Vite, Tailwind CSS
– Axios (custom instance in src/utils/axios)
– Composition API (src/composables)
– GitHub Actions & Azure Static Web Apps
– Node.js (external), Azure Blob Storage, OpenAI/Anthropic LLM services

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% User and Hosting
    User(("End User")):::external
    Browser["Browser"]:::frontend
    AzureCDN["Azure Static Web Apps / CDN"]:::frontend

    %% Vue SPA Subgraph
    subgraph "Vue SPA (Static Files & App)" 
        direction TB
        Index["index.html"]:::frontend
        Main["src/main.js"]:::frontend
        AppVue["src/App.vue"]:::frontend
        Router["Router & Views\n(src/router.js + src/pages/)"]:::frontend
        Components["UI Components\n(src/components/)"]:::frontend
        StateAPI["State & API Layers\n(src/composables/)"]:::frontend
        UtilsAxios["HTTP Client Utility\nsrc/utils/axios.js"]:::frontend
        UtilsExtract["JSON/Code Extractor\nsrc/utils/extractJsonAndCode.js"]:::frontend
        UtilsChart["Chart Helper\nsrc/utils/amChartsScatter.js"]:::frontend
        CSSBuild["Styling & Build Config\n(postcss.config.js,\ntailwind.config.js,\nvite.config.js,\nsrc/css/)"]:::frontend
        EnvLoader["Environment Loader\nsrc/env.js"]:::frontend
        Public["Static Assets & Redirect Rules\npublic/"]:::frontend
        Redirects["public/_redirects"]:::frontend
        Images["public/images/"]:::frontend
        SWAConfig["staticwebapp.config.json"]:::frontend
    end

    %% Backend and Services
    subgraph "Node.js Backend" 
        direction TB
        RESTAPI["Node.js REST API"]:::backend
        WebSocket["WebSocket Server"]:::backend
    end

    BlobStorage[(Azure Blob Storage)]:::storage

    subgraph "External LLM Services"
        direction TB
        OpenAI["OpenAI GPT-4"]:::external
        Anthropic["Anthropic Claude"]:::external
    end

    CICD["GitHub Actions CI/CD"]:::cicd

    %% Connections
    User -->|uses| Browser
    Browser -->|HTTPS| AzureCDN
    AzureCDN -->|serves SPA| Browser
    Browser -->|HTTP REST| RESTAPI
    Browser -->|WebSocket| WebSocket
    RESTAPI -->|HTTPS| BlobStorage
    RESTAPI -->|HTTPS REST| OpenAI
    RESTAPI -->|HTTPS REST| Anthropic
    WebSocket -->|push updates| Browser
    CICD -->|deploy| AzureCDN

    %% Click Events
    click Index "https://github.com/symaiotics/mpersona-vue-v1/blob/main/index.html"
    click Main "https://github.com/symaiotics/mpersona-vue-v1/blob/main/src/main.js"
    click AppVue "https://github.com/symaiotics/mpersona-vue-v1/blob/main/src/App.vue"
    click Router "https://github.com/symaiotics/mpersona-vue-v1/blob/main/src/router.js"
    click Components "https://github.com/symaiotics/mpersona-vue-v1/tree/main/src/components/"
    click StateAPI "https://github.com/symaiotics/mpersona-vue-v1/tree/main/src/composables/"
    click UtilsAxios "https://github.com/symaiotics/mpersona-vue-v1/blob/main/src/utils/axios.js"
    click UtilsExtract "https://github.com/symaiotics/mpersona-vue-v1/blob/main/src/utils/extractJsonAndCode.js"
    click UtilsChart "https://github.com/symaiotics/mpersona-vue-v1/blob/main/src/utils/amChartsScatter.js"
    click CSSBuild "https://github.com/symaiotics/mpersona-vue-v1/blob/main/postcss.config.js"
    click CSSBuild "https://github.com/symaiotics/mpersona-vue-v1/blob/main/tailwind.config.js"
    click CSSBuild "https://github.com/symaiotics/mpersona-vue-v1/blob/main/vite.config.js"
    click CSSBuild "https://github.com/symaiotics/mpersona-vue-v1/tree/main/src/css/"
    click EnvLoader "https://github.com/symaiotics/mpersona-vue-v1/blob/main/src/env.js"
    click Public "https://github.com/symaiotics/mpersona-vue-v1/tree/main/public/"
    click Redirects "https://github.com/symaiotics/mpersona-vue-v1/tree/main/public/_redirects"
    click Images "https://github.com/symaiotics/mpersona-vue-v1/tree/main/public/images/"
    click SWAConfig "https://github.com/symaiotics/mpersona-vue-v1/blob/main/staticwebapp.config.json"
    click CICD "https://github.com/symaiotics/mpersona-vue-v1/blob/main/.github/workflows/azure-static-web-apps-orange-dune-0e416940f.yml"

    %% Styles
    classDef frontend fill:#bbdefb,stroke:#1e88e5,color:#0d47a1
    classDef backend fill:#c8e6c9,stroke:#2e7d32,color:#1b5e20
    classDef storage fill:#fff9c4,stroke:#f9a825,color:#f57f17
    classDef external fill:#ffe0b2,stroke:#f4511e,color:#bf360c
    classDef cicd fill:#e0e0e0,stroke:#616161,color:#212121
```
