# launcher-host/mercurius architecture

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

- Interactive diagram: https://gitdiagram.com/launcher-host/mercurius
- Repository: https://github.com/launcher-host/mercurius

## Overview

##### Main Components Identification

The system should be represented with these key components:

a) Frontend Layer:
- Vue.js Components (from resources/js/)
- Conversations Module
- Messages Module
- Core Components
- Sidebar Module
- Asset Pipeline (Webpack/Mix)

b) Backend Layer:
- Laravel Framework
- Controllers (src/Http/Controllers/)
- Events System (src/Events/)
- Repositories (src/Repositories/)
- Authentication System

c) External Services:
- Pusher (Real-time WebSocket service)
- Browser Notifications API

##### Component Relationships

a) Real-time Communication Flow:
**User -> Frontend -> Laravel Backend -> Pusher -> Other Users**

b) Message Flow:
**Composer.vue -> MessagesController -> MessageRepository -> Database**

c) Event System:
**MessageSent Event -> Pusher -> Browser Notifications**

##### Detailed Component Breakdown

Frontend (Vue.js):
- Main components:
- Conversations.vue
- Messages.vue
- Composer.vue
- Sidebar.vue
- Supporting modules:
- notifications.js
- message-sending.js
- conversations-http.js

Backend (Laravel):
- Controllers layer
- Repository pattern implementation
- Event system
- Authentication integration
- Database interactions

##### Implementation Details

Use these symbols:
- Rectangles: Components
- Diamonds: Decision points

##### Additional Elements

Include:
- Configuration management
- Multilingual support system
- Asset compilation pipeline
- Authentication flow
- Browser notification system

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Frontend
        VueApp["Vue.js Application"]
        ConvMod["Conversations Module"]
        MsgMod["Messages Module"]
        CoreMod["Core Components"]
        SidebarMod["Sidebar Module"]
        
        subgraph Components
            Conv["Conversations Component"]
            Msg["Messages Component"]
            Comp["Composer Component"]
            Side["Sidebar Component"]
        end
        
        subgraph Utilities
            NotifJS["Notifications System"]
            MsgSendJS["Message Sending Module"]
            ConvHTTP["Conversations HTTP Module"]
        end
    end
    
    subgraph Backend
        Laravel["Laravel Framework"]
        
        subgraph Controllers
            Ctrl["Controllers Layer"]
        end
        
        subgraph Services
            Repos["Repositories Layer"]
            Events["Events System"]
            Auth["Authentication System"]
            Lang["Multilingual Support"]
        end
        
        subgraph Storage
            DB[(Database)]
            Migrations["Database Migrations"]
        end
    end
    
    subgraph "External Services"
        Pusher["Pusher WebSocket"]
        BrowserNotif["Browser Notifications API"]
    end
    
    %% Frontend Relationships
    VueApp --> ConvMod
    VueApp --> MsgMod
    VueApp --> CoreMod
    VueApp --> SidebarMod
    
    ConvMod --> Conv
    MsgMod --> Msg
    MsgMod --> Comp
    SidebarMod --> Side
    
    CoreMod --> NotifJS
    MsgMod --> MsgSendJS
    ConvMod --> ConvHTTP
    
    %% Backend Relationships
    Laravel --> Ctrl
    Laravel --> Services
    Repos --> DB
    Migrations --> DB
    
    %% Cross-layer Communication
    MsgSendJS --> Ctrl
    Ctrl --> Repos
    Events --> Pusher
    Pusher --> NotifJS
    NotifJS --> BrowserNotif
    
    %% Styling
    classDef frontend fill:#dae8fc,stroke:#6c8ebf
    classDef backend fill:#d5e8d4,stroke:#82b366
    classDef external fill:#ffe6cc,stroke:#d79b00
    classDef storage fill:#f5f5f5,stroke:#666666
    
    class VueApp,ConvMod,MsgMod,CoreMod,SidebarMod,Conv,Msg,Comp,Side,NotifJS,MsgSendJS,ConvHTTP frontend
    class Laravel,Ctrl,Repos,Events,Auth,Lang,Migrations backend
    class Pusher,BrowserNotif external
    class DB,Storage storage
    
    %% Click Events
    click ConvMod "https://github.com/launcher-host/mercurius/tree/master/resources/js/conversations/"
    click MsgMod "https://github.com/launcher-host/mercurius/tree/master/resources/js/messages/"
    click CoreMod "https://github.com/launcher-host/mercurius/tree/master/resources/js/core/"
    click SidebarMod "https://github.com/launcher-host/mercurius/tree/master/resources/js/sidebar/"
    click Ctrl "https://github.com/launcher-host/mercurius/tree/master/src/Http/Controllers/"
    click Events "https://github.com/launcher-host/mercurius/tree/master/src/Events/"
    click Repos "https://github.com/launcher-host/mercurius/tree/master/src/Repositories/"
    click Auth "https://github.com/launcher-host/mercurius/blob/master/src/MercuriusUser.php"
    click Msg "https://github.com/launcher-host/mercurius/blob/master/resources/js/messages/Messages.vue"
    click Comp "https://github.com/launcher-host/mercurius/blob/master/resources/js/messages/Composer.vue"
    click Conv "https://github.com/launcher-host/mercurius/blob/master/resources/js/conversations/Conversations.vue"
    click Side "https://github.com/launcher-host/mercurius/blob/master/resources/js/sidebar/Sidebar.vue"
    click NotifJS "https://github.com/launcher-host/mercurius/blob/master/resources/js/core/notifications.js"
    click MsgSendJS "https://github.com/launcher-host/mercurius/blob/master/resources/js/messages/message-sending.js"
    click ConvHTTP "https://github.com/launcher-host/mercurius/blob/master/resources/js/conversations/conversations-http.js"
    click Migrations "https://github.com/launcher-host/mercurius/tree/master/publishable/database/migrations/"
    click Lang "https://github.com/launcher-host/mercurius/tree/master/publishable/lang/"
```
