# aws-samples/amazon-bedrock-client-for-mac architecture

> Architecture diagram of the GitHub repository aws-samples/amazon-bedrock-client-for-mac, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-16). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/aws-samples/amazon-bedrock-client-for-mac
- Repository: https://github.com/aws-samples/amazon-bedrock-client-for-mac

## Overview

##### Main Components

A. Client-Side Components (Core Layer):
- Main Application Container
- Core Data Stack (for persistence)
- UI Layer (SwiftUI Views)
- Managers Layer
- Models Layer

B. External Services:
- AWS Bedrock Service
- AWS SSO/Authentication
- GitHub (for updates)

##### Detailed Component Breakdown

UI Layer:
- MainView
- ChatView
- SidebarView
- SettingsView
- MessageView
- HomeView

Managers Layer:
- AppCoordinator (Central coordinator)
- BedrockClient (AWS communication)
- ChatManager
- MessageManager
- SSOManager (Authentication)
- SettingsManager
- ImageManager
- UpdateManager

Data Layer:
- CoreDataStack
- ChatModel (Data model)
- MessageData
- ChatViewModel

External Services Layer:
- AWS Bedrock API
- AWS Authentication
- GitHub API (updates)

Use these visual elements:
- Blue rectangles for UI components
- Green rectangles for managers
- Yellow rectangles for data components
- Purple rectangles for external services

##### Key Relationships to Highlight

- AppCoordinator → All Managers (coordination)
- BedrockClient → AWS Bedrock (API communication)
- ChatManager → CoreDataStack (persistence)
- Views → ViewModels (data binding)
- SSOManager → AWS Authentication
- UpdateManager → GitHub API

##### Implementation Notes

- Use a top-down layout
- Related components visually
- Brief component descriptions
- Version/release management flow
- Error handling paths

##### Technical Details

- SwiftUI as the UI framework
- CoreData for persistence
- AWS SDK integration points
- Security and authentication flow
- Local and remote data synchronization

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Styles
    classDef ui fill:#3498db,stroke:#2980b9,color:white
    classDef manager fill:#2ecc71,stroke:#27ae60,color:white
    classDef data fill:#f1c40f,stroke:#f39c12,color:black
    classDef external fill:#9b59b6,stroke:#8e44ad,color:white
    classDef core fill:#e74c3c,stroke:#c0392b,color:white

    %% UI Layer
    subgraph UI
        MainView["MainView"]
        ChatView["ChatView"]
        SidebarView["SidebarView"]
        SettingsView["SettingsView"]
        MessageView["MessageView"]
        HomeView["HomeView"]
    end

    %% Managers Layer
    subgraph Managers
        AppCoordinator["AppCoordinator"]
        BedrockClient["BedrockClient"]
        ChatManager["ChatManager"]
        MessageManager["MessageManager"]
        SSOManager["SSOManager"]
        SettingsManager["SettingsManager"]
        ImageManager["ImageManager"]
        UpdateManager["UpdateManager"]
    end

    %% Data Layer
    subgraph Data
        CoreDataStack["CoreDataStack"]
        ChatModel["ChatModel"]
        MessageData["MessageData"]
        ChatViewModel["ChatViewModel"]
    end

    %% Core Layer
    subgraph Core
        AppContainer["Main App Container"]
        AppDelegate["App Delegate"]
    end

    %% External Services
    subgraph External
        AWSBedrock["AWS Bedrock API"]
        AWSAuth["AWS Authentication"]
        GitHubAPI["GitHub API"]
    end

    %% Utilities
    subgraph Utils
        Markdown["Markdown Support"]
        EnvExt["Environment Extensions"]
        GithubTheme["GitHub Theme"]
    end

    %% Relationships
    AppContainer --> AppCoordinator
    AppCoordinator --> MainView
    AppCoordinator --> ChatManager
    AppCoordinator --> MessageManager
    AppCoordinator --> SSOManager
    AppCoordinator --> SettingsManager
    AppCoordinator --> ImageManager
    AppCoordinator --> UpdateManager

    BedrockClient -.-> AWSBedrock
    SSOManager -.-> AWSAuth
    UpdateManager -.-> GitHubAPI

    ChatManager --> CoreDataStack
    MessageManager --> MessageData
    ChatView --> ChatViewModel
    ChatViewModel --> ChatModel

    %% Click Events
    click MainView "https://github.com/aws-samples/amazon-bedrock-client-for-mac/blob/main/Amazon Bedrock Client for Mac/Views/MainView.swift"
    click ChatView "https://github.com/aws-samples/amazon-bedrock-client-for-mac/blob/main/Amazon Bedrock Client for Mac/Views/ChatView.swift"
    click SidebarView "https://github.com/aws-samples/amazon-bedrock-client-for-mac/blob/main/Amazon Bedrock Client for Mac/Views/SidebarView.swift"
    click SettingsView "https://github.com/aws-samples/amazon-bedrock-client-for-mac/blob/main/Amazon Bedrock Client for Mac/Views/SettingsView.swift"
    click MessageView "https://github.com/aws-samples/amazon-bedrock-client-for-mac/blob/main/Amazon Bedrock Client for Mac/Views/MessageView.swift"
    click HomeView "https://github.com/aws-samples/amazon-bedrock-client-for-mac/blob/main/Amazon Bedrock Client for Mac/Views/HomeView.swift"
    
    click AppCoordinator "https://github.com/aws-samples/amazon-bedrock-client-for-mac/blob/main/Amazon Bedrock Client for Mac/Managers/AppCoordinator.swift"
    click BedrockClient "https://github.com/aws-samples/amazon-bedrock-client-for-mac/blob/main/Amazon Bedrock Client for Mac/Managers/BedrockClient.swift"
    click ChatManager "https://github.com/aws-samples/amazon-bedrock-client-for-mac/blob/main/Amazon Bedrock Client for Mac/Managers/ChatManager.swift"
    click MessageManager "https://github.com/aws-samples/amazon-bedrock-client-for-mac/blob/main/Amazon Bedrock Client for Mac/Managers/MessageManager.swift"
    click SSOManager "https://github.com/aws-samples/amazon-bedrock-client-for-mac/blob/main/Amazon Bedrock Client for Mac/Managers/SSOManager.swift"
    click SettingsManager "https://github.com/aws-samples/amazon-bedrock-client-for-mac/blob/main/Amazon Bedrock Client for Mac/Managers/SettingManager.swift"
    click ImageManager "https://github.com/aws-samples/amazon-bedrock-client-for-mac/blob/main/Amazon Bedrock Client for Mac/Managers/ImageManager.swift"
    click UpdateManager "https://github.com/aws-samples/amazon-bedrock-client-for-mac/blob/main/Amazon Bedrock Client for Mac/Managers/UpdateManager.swift"
    
    click CoreDataStack "https://github.com/aws-samples/amazon-bedrock-client-for-mac/blob/main/Amazon Bedrock Client for Mac/Core/CoreDataStack.swift"
    click ChatModel "https://github.com/aws-samples/amazon-bedrock-client-for-mac/blob/main/Amazon Bedrock Client for Mac/Models/ChatModel.swift"
    click MessageData "https://github.com/aws-samples/amazon-bedrock-client-for-mac/blob/main/Amazon Bedrock Client for Mac/Models/MessageData.swift"
    click ChatViewModel "https://github.com/aws-samples/amazon-bedrock-client-for-mac/blob/main/Amazon Bedrock Client for Mac/Models/ChatViewModel.swift"
    
    click AppContainer "https://github.com/aws-samples/amazon-bedrock-client-for-mac/blob/main/Amazon Bedrock Client for Mac/Core/Amazon_Bedrock_Client_for_MacApp.swift"
    click AppDelegate "https://github.com/aws-samples/amazon-bedrock-client-for-mac/blob/main/Amazon Bedrock Client for Mac/Core/AppDelegate.swift"
    
    click Markdown "https://github.com/aws-samples/amazon-bedrock-client-for-mac/blob/main/Amazon Bedrock Client for Mac/Utils/Markdown.swift"
    click EnvExt "https://github.com/aws-samples/amazon-bedrock-client-for-mac/blob/main/Amazon Bedrock Client for Mac/Utils/EnvironmentExtensions.swift"
    click GithubTheme "https://github.com/aws-samples/amazon-bedrock-client-for-mac/blob/main/Amazon Bedrock Client for Mac/Utils/GithubTheme.swift"

    %% Style Applications
    class MainView,ChatView,SidebarView,SettingsView,MessageView,HomeView ui
    class AppCoordinator,BedrockClient,ChatManager,MessageManager,SSOManager,SettingsManager,ImageManager,UpdateManager manager
    class CoreDataStack,ChatModel,MessageData,ChatViewModel data
    class AWSBedrock,AWSAuth,GitHubAPI external
    class AppContainer,AppDelegate core
    class Markdown,EnvExt,GithubTheme data
```
