# techsyndicate/vscode-dms architecture

> Architecture diagram of the GitHub repository techsyndicate/vscode-dms, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/techsyndicate/vscode-dms
- Repository: https://github.com/techsyndicate/vscode-dms

## Overview

##### Main Components

a. VS Code Extension Layer:
- Main extension components:
- Authentication Handler (from authenticate.ts)
- Sidebar Provider (from DMSidebarProvider.ts)
- DM Panels (ViewDMPanel.ts and ViewGroupDMPanel.ts)
- DM Creation (createGroupDM.ts)

b. Frontend/UI Layer:
- Sidebar Component
- DM Panel Component
- DM Panel Component
- Create Group DM Component

c. External Services:
- GitHub (Authentication)
- Backend API (referenced in README as vscode-dms-api)
- WebSocket Server (implied by receiveSocket.js)

##### Component Relationships

- VS Code Extension → GitHub (Authentication flow)
- Extension → Backend API (Data fetching/sending)
- Extension ↔ WebSocket Server (Real-time messaging)
- UI Components ↔ Extension Host (Event handling)

##### Specific Implementation Details

Key architectural elements:
- WebSocket connection for real-time messaging
- GitHub OAuth flow
- VS Code WebView panels for chat interfaces
- Event handling between WebViews and extension

**[VS Code IDE]**
- ↓
**[Extension Host]**
- ↓
**[UI Components (WebViews)]**
- ↓
**[External Services]**

##### Important Notes

- Separation between extension context and WebView context
- Message flow from user input to WebSocket communication
- Where GitHub authentication integrates
- Notification handling paths
- Image/code snippet sharing functionality

##### Technical Details

- TypeScript as the primary language
- Svelte for UI components
- WebSocket for real-time communication
- VS Code Extension API integration points
- GitHub OAuth implementation

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph VSCode["VS Code IDE"]
        ExtHost["Extension Host"]
        click ExtHost "https://github.com/techsyndicate/vscode-dms/blob/main/src/extension.ts"
    end

    subgraph Extension["Extension Layer"]
        Auth["Authentication Handler"]
        click Auth "https://github.com/techsyndicate/vscode-dms/blob/main/src/authenticate.ts"
        SidebarProv["Sidebar Provider"]
        click SidebarProv "https://github.com/techsyndicate/vscode-dms/blob/main/src/DMSidebarProvider.ts"
        DMPanel["DM Panel"]
        click DMPanel "https://github.com/techsyndicate/vscode-dms/blob/main/src/ViewDMPanel.ts"
        GroupDMPanel["Group DM Panel"]
        click GroupDMPanel "https://github.com/techsyndicate/vscode-dms/blob/main/src/ViewGroupDMPanel.ts"
        CreateGroup["Group DM Creation"]
        click CreateGroup "https://github.com/techsyndicate/vscode-dms/blob/main/src/createGroupDM.ts"
        Utils["Utilities"]
        click Utils "https://github.com/techsyndicate/vscode-dms/blob/main/src/util.ts"
        Constants["Constants"]
        click Constants "https://github.com/techsyndicate/vscode-dms/blob/main/src/constants.ts"
    end

    subgraph Frontend["Frontend/UI Layer"]
        SidebarUI["Sidebar Component"]
        click SidebarUI "https://github.com/techsyndicate/vscode-dms/blob/main/svelte/components/Sidebar.svelte"
        DMPanelUI["DM Panel Component"]
        click DMPanelUI "https://github.com/techsyndicate/vscode-dms/blob/main/svelte/components/DMPanel.svelte"
        GroupDMUI["Group DM Panel Component"]
        click GroupDMUI "https://github.com/techsyndicate/vscode-dms/blob/main/svelte/components/GroupDMPanel.svelte"
        CreateGroupUI["Create Group DM Component"]
        click CreateGroupUI "https://github.com/techsyndicate/vscode-dms/blob/main/svelte/components/createGroupDM.svelte"
        
        subgraph Styles["Styling"]
            DMStyles["DM Panel Styles"]
            click DMStyles "https://github.com/techsyndicate/vscode-dms/blob/main/media/dmpanel.css"
            VSStyles["VS Code Integration Styles"]
            click VSStyles "https://github.com/techsyndicate/vscode-dms/blob/main/media/vscode.css"
            ResetStyles["Reset Styles"]
            click ResetStyles "https://github.com/techsyndicate/vscode-dms/blob/main/media/reset.css"
        end
    end

    subgraph External["External Services"]
        GitHub["GitHub Auth"]
        Backend["Backend API"]
        WSServer["WebSocket Server"]
        click WSServer "https://github.com/techsyndicate/vscode-dms/blob/main/media/receiveSocket.js"
    end

    %% Connections
    ExtHost --> Auth
    Auth --> GitHub
    ExtHost --> SidebarProv
    ExtHost --> DMPanel
    ExtHost --> GroupDMPanel
    ExtHost --> CreateGroup
    ExtHost --> Utils
    ExtHost --> Constants

    SidebarProv --> SidebarUI
    DMPanel --> DMPanelUI
    GroupDMPanel --> GroupDMUI
    CreateGroup --> CreateGroupUI

    SidebarUI --> Backend
    DMPanelUI --> Backend
    GroupDMUI --> Backend
    CreateGroupUI --> Backend

    DMPanelUI --> WSServer
    GroupDMUI --> WSServer

    %% Styling
    classDef vscode fill:#2C2C32,stroke:#fff,stroke-width:2px,color:#fff
    classDef extension fill:#007ACC,stroke:#fff,stroke-width:2px,color:#fff
    classDef frontend fill:#3B8739,stroke:#fff,stroke-width:2px,color:#fff
    classDef external fill:#FF6B6B,stroke:#fff,stroke-width:2px,color:#fff
    classDef styles fill:#6B4FBB,stroke:#fff,stroke-width:2px,color:#fff

    class VSCode vscode
    class ExtHost,Auth,SidebarProv,DMPanel,GroupDMPanel,CreateGroup,Utils,Constants extension
    class SidebarUI,DMPanelUI,GroupDMUI,CreateGroupUI frontend
    class GitHub,Backend,WSServer external
    class Styles,DMStyles,VSStyles,ResetStyles styles
```
