# matt-bentley/stormspace architecture

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

- Interactive diagram: https://gitdiagram.com/matt-bentley/stormspace
- Repository: https://github.com/matt-bentley/stormspace

## Overview

##### Main Components
- Frontend (Client): Represented by the eventstormingboard.client folder. This Angular application handles the user interface, interaction with the HTML Canvas for board manipulation, material design components, and calls to REST APIs as well as SignalR for real-time updates.
- Backend (Server): Represented by the EventStormingBoard.Server folder. It contains REST controllers (like BoardsController), entity models, data transfer objects (DTOs) in the Models folder, a repository for board data management, and an ASP.NET SignalR hub (BoardsHub) for real-time communication.
- Real-Time Communication: The SignalR hub in the backend supports real-time updates between multiple collaborating users.
- In-Memory Cache: Though not a separate service, note that board data is temporarily stored in an in-memory cache (as noted in the README) with a sliding expiry of 60 minutes.
- Docker Container: The presence of Dockerfile and .dockerignore indicates the application can be containerized and deployed as a portable service.

##### Relationships and Data Flow
- The Angular frontend sends REST API calls to the ASP.NET backend’s controllers for operations like creating, updating, or retrieving boards, as well as board actions such as moving or editing sticky notes.
- Real-time communication flows through the SignalR hub (BoardsHub) – requests (or events such as NoteMovedEvent, UserJoinedBoardEvent, etc.) are pushed from the backend to all connected frontend clients.
- The backend uses repositories (e.g., BoardsRepository) to manage board data and employs an in-memory cache for temporary state storage.
- Docker acts as the deployment environment encapsulating both the frontend and backend components.

##### Architectural Patterns and Technologies
- N-tier / 2-tier Architecture: Clearly separate the presentation layer (Angular) from the business logic layer (ASP.NET Controllers, Repositories, and SignalR hub).
- Real-time Communication Pattern: Leverage SignalR for bi-directional communication, which is key for the collaborative aspect.
- RESTful API Design: The Angular client interacts with the backend using HTTP REST calls, following standard API design principles.
- Domain Event System: Look at the Events folder with multiple event types (e.g., NoteCreatedEvent, BoardEvent, etc.) – these indicate a domain-event or event-driven approach internally.
- Containerization: Docker-related files imply that the entire system (or at least the backend) is designed to run in a containerized environment.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Docker Container"
        D["Docker Deployment"]:::infra
        D2[".dockerignore"]:::infra

        subgraph "Frontend Layer"
            F1["Angular Frontend"]:::frontend
            F2["Boards SignalR Service"]:::frontend
        end

        subgraph "Backend Layer"
            B1["BoardsController"]:::backend
            B2["BoardsHub"]:::backend
            B3["BoardsRepository"]:::backend
            B4["Models/DTOs"]:::backend
            B5["Domain Events"]:::backend
            B6["In-Memory Cache"]:::infra
        end
    end

    %% Inter-component Relationships
    F1 -->|"RESTAPI"| B1
    F2 -->|"SignalR"| B2
    B2 -->|"RealTimeUpdates"| F1
    B1 -->|"Calls"| B3
    B1 -->|"Uses"| B4
    B1 -->|"Triggers"| B5
    B3 -->|"CacheRW"| B6
    D -->|"Containerizes"| F1
    D -->|"Containerizes"| B1

    %% Click Events
    click F1 "https://github.com/matt-bentley/stormspace/blob/main/eventstormingboard.client"
    click F2 "https://github.com/matt-bentley/stormspace/blob/main/eventstormingboard.client/src/app/_shared/services/boards-signalr.service.ts"
    click B1 "https://github.com/matt-bentley/stormspace/blob/main/EventStormingBoard.Server/Controllers/BoardsController.cs"
    click B2 "https://github.com/matt-bentley/stormspace/blob/main/EventStormingBoard.Server/Hubs/BoardsHub.cs"
    click B3 "https://github.com/matt-bentley/stormspace/blob/main/EventStormingBoard.Server/Repositories/BoardsRepository.cs"
    click B4 "https://github.com/matt-bentley/stormspace/tree/main/EventStormingBoard.Server/Models"
    click B5 "https://github.com/matt-bentley/stormspace/tree/main/EventStormingBoard.Server/Events"
    click D "https://github.com/matt-bentley/stormspace/tree/main/Dockerfile"
    click D2 "https://github.com/matt-bentley/stormspace/blob/main/.dockerignore"

    %% Styles
    classDef frontend fill:#aaddff,stroke:#000,stroke-width:1px;
    classDef backend fill:#aaffaa,stroke:#000,stroke-width:1px;
    classDef infra fill:#ffdd88,stroke:#000,stroke-width:1px;
```
