# delt4d/echo architecture

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

- Interactive diagram: https://gitdiagram.com/delt4d/echo
- Repository: https://github.com/delt4d/echo

## Overview

##### Project type and purpose
- Echo is a full-stack session-recording and replay system.
- Purpose: capture real-time user interactions in a web page (Recorder), send them to a server (SignalR), store them, and replay them visually (Mimic).

##### File structure
- Top level:
- Docs, Echo.run (run/profiles), docker files, compose, .NET solution.
- Lib/Client: shared client library (recorder, mimic, data, handlers).
- Lib/Server: shared .NET library (EchoLib) and models.
- Preview/Client: standalone React/Vue/vanilla preview web app for recorder & mimic.
- Preview/Server: ASP.NET Core SignalR server with EchoHub and controllers.
- Patterns:
- Client–Server via SignalR (WebSocket).
- Shared libraries separate concerns: client-side logic, server-side logic.
- DevOps:
- Back.Dockerfile and Front.Dockerfile for containerizing preview server and client.
- docker-compose.yml wires up both containers for local testing.

##### README for additional insights
- Real-time recording pipeline and replay pipeline are described.
- No persistent database is mentioned—assume file or in-memory store via EchoLib (extendable).
- Tech stack:
- Frontend: vanilla JS/NPM + custom elements, Rollup build, preview uses standard web stack (HTML/CSS/JS).
- Backend: ASP.NET Core, SignalR hub, C# shared library.

## Diagram (Mermaid)

```mermaid
flowchart TB
  subgraph "Client Side"
    direction TB
    Browser("User's Browser"):::client
    subgraph "Preview Client App"
      direction TB
      UIRec("Recorder UI"):::client
      UIMim("Mimic UI"):::client
      UIRec --> RecorderLib
      UIMim --> MimicLib
      click UIRec "https://github.com/delt4d/echo/blob/master/Preview/Client/public/recorder/index.html"
      click UIMim "https://github.com/delt4d/echo/blob/master/Preview/Client/public/mimic/index.html"
    end
    subgraph "Echo Client Library"
      direction TB
      RecorderLib("EchoRecorder"):::client
      MimicLib("EchoMimic"):::client
      EventBus("EventBus"):::client
      Handlers("Handlers"):::client
      DataModels("Data Models"):::client
      RecorderLib --> EventBus
      MimicLib --> EventBus
      EventBus --> Handlers
      EventBus --> DataModels
      click RecorderLib "https://github.com/delt4d/echo/blob/master/Lib/Client/src/echo/recorder.js"
      click MimicLib "https://github.com/delt4d/echo/blob/master/Lib/Client/src/echo/mimic.js"
      click EventBus "https://github.com/delt4d/echo/blob/master/Lib/Client/src/echo/event-bus.js"
      click Handlers "https://github.com/delt4d/echo/blob/master/Lib/Client/src/echo/handlers.js"
      click DataModels "https://github.com/delt4d/echo/blob/master/Lib/Client/src/echo/data.js"
    end
    Browser --> UIRec
    Browser --> UIMim
  end

  subgraph "SignalR Server"
    direction TB
    Hub("EchoHub (SignalR Hub)\nWebSocket"):::server
    Controller("HTTP Controller\nAPI Endpoints"):::server
    Hub --> SharedLib
    Controller --> SharedLib
    click Hub "https://github.com/delt4d/echo/blob/master/Preview/Server/EchoHub.cs"
    click Controller "https://github.com/delt4d/echo/blob/master/Preview/Server/EchoController.cs"
  end

  subgraph "Shared .NET Library"
    direction TB
    SharedLib("EchoLib & Models"):::shared
    Persister("EchoRecorder (Server)"):::shared
    ReplayerStub("EchoMimic (Server)"):::shared
    SharedLib --> Persister
    SharedLib --> ReplayerStub
    click SharedLib "https://github.com/delt4d/echo/blob/master/Lib/Server/EchoLib.csproj"
    click Persister "https://github.com/delt4d/echo/blob/master/Lib/Server/EchoRecorder.cs"
    click ReplayerStub "https://github.com/delt4d/echo/blob/master/Lib/Server/EchoMimic.cs"
  end

  Storage("Persistent Store\n(File/DB)"):::infra
  infra("docker-compose"):::infra

  SharedLib --> Storage
  infra --> UIRec
  infra --> Hub

  classDef client fill:#bbdefb,stroke:#0d47a1
  classDef server fill:#c8e6c9,stroke:#1b5e20
  classDef shared fill:#e0e0e0,stroke:#424242
  classDef infra fill:#ffe0b2,stroke:#ef6c00
```
