# jayaramachandranaugustin/chatapplication architecture

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

- Interactive diagram: https://gitdiagram.com/jayaramachandranaugustin/chatapplication
- Repository: https://github.com/jayaramachandranaugustin/chatapplication

## Overview

##### Project type and purpose
- This is a full-stack chat application. The frontend is a ReactJS single-page app under `react-client`, and the backend is a Spring Boot WebSocket server under `spring-ws-server`.
- Its purpose is to allow multiple clients to connect over WebSocket, send chat messages, and have the server broadcast them to all subscribers.

##### File structure
- Top-level directories:
- `react-client/` – contains a standard React project (`public/`, `src/`, `package.json`).
- `spring-ws-server/` – contains a Maven-based Spring Boot project (`src/main/java`, `src/main/resources`, `pom.xml`).
- Key backend packages:
- `config/` – WebSocketConfig for STOMP endpoints and message broker setup.
- `controller/` – ChatController handling inbound messages and broadcasting.
- `model/` – POJOs (Message, Status).
- No external database or persistence – it uses the in-memory message broker provided by Spring’s `enableSimpleBroker`.

##### README for additional insights
- Confirms the stack: Spring Boot WebSocket backend, ReactJS client.
- Provides start‐up instructions (`npm install && npm start` for client, `mvn spring-boot:run` for server).
- Shows a screenshot of the chat screen.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Frontend Layer
    subgraph "Frontend (ReactJS)" 
        direction TB
        Browser["Browser"]:::frontend
        StaticHTML["Static HTML Shell<br/>index.html"]:::frontend
        ReactIndex["React Entry Point<br/>index.js"]:::frontend
        ReactApp["React App Component<br/>App.js"]:::frontend
        ChatRoom["ChatRoom Component<br/>ChatRoom.js"]:::frontend
        STOMPClient["SockJS + @stomp/stompjs"]:::frontend
    end

    %% Backend Layer
    subgraph "Backend (Spring Boot)" 
        direction TB
        SpringApp["Spring Boot App<br/>ChatApplication.java"]:::backend
        WebSocketCfg["WebSocketConfig<br/>(/ws endpoint)"]:::backend
        ChatCtrl["ChatController"]:::backend
        subgraph "Models"
            direction TB
            MessageModel["Message.java"]:::backend
            StatusModel["Status.java"]:::backend
        end
        Broker["In-Memory Message Broker"]:::broker
    end

    %% Build Tools
    npm["npm<br/>package.json"]:::tool
    maven["Maven<br/>pom.xml"]:::tool

    %% Connections - Frontend load
    Browser -->|"HTTP GET\nport 3000"| StaticHTML
    StaticHTML --> ReactIndex
    ReactIndex --> ReactApp
    ReactApp --> ChatRoom

    %% WebSocket Setup
    ChatRoom -->|"WS CONNECT\nws://localhost:8080/ws"| WebSocketCfg
    ChatRoom -->|"SUBSCRIBE\n/topic/public"| Broker
    ChatRoom -->|"STOMP SEND\n/app/chat.sendMessage"| ChatCtrl

    %% Backend flows
    WebSocketCfg --> ChatCtrl
    ChatCtrl -->|"FORWARD\nto broker"| Broker
    Broker -->|"BROADCAST\n/topic/public"| ChatRoom

    %% Build tool links
    npm -.-> StaticHTML
    npm -.-> ReactIndex
    maven -.-> SpringApp
    maven -.-> WebSocketCfg

    %% Click Events
    click StaticHTML "https://github.com/jayaramachandranaugustin/chatapplication/blob/main/react-client/public/index.html"
    click ReactIndex "https://github.com/jayaramachandranaugustin/chatapplication/blob/main/react-client/src/index.js"
    click ReactApp "https://github.com/jayaramachandranaugustin/chatapplication/blob/main/react-client/src/App.js"
    click ChatRoom "https://github.com/jayaramachandranaugustin/chatapplication/blob/main/react-client/src/components/ChatRoom.js"
    click Browser "https://github.com/jayaramachandranaugustin/chatapplication/tree/main/react-client/"
    click npm "https://github.com/jayaramachandranaugustin/chatapplication/blob/main/react-client/package.json"
    click SpringApp "https://github.com/jayaramachandranaugustin/chatapplication/blob/main/spring-ws-server/src/main/java/com/involveininnovation/chat/ChatApplication.java"
    click WebSocketCfg "https://github.com/jayaramachandranaugustin/chatapplication/blob/main/spring-ws-server/src/main/java/com/involveininnovation/chat/config/WebSocketConfig.java"
    click ChatCtrl "https://github.com/jayaramachandranaugustin/chatapplication/blob/main/spring-ws-server/src/main/java/com/involveininnovation/chat/controller/ChatController.java"
    click MessageModel "https://github.com/jayaramachandranaugustin/chatapplication/blob/main/spring-ws-server/src/main/java/com/involveininnovation/chat/model/Message.java"
    click StatusModel "https://github.com/jayaramachandranaugustin/chatapplication/blob/main/spring-ws-server/src/main/java/com/involveininnovation/chat/model/Status.java"
    click Broker "https://github.com/jayaramachandranaugustin/chatapplication/blob/main/spring-ws-server/src/main/resources/application.properties"
    click maven "https://github.com/jayaramachandranaugustin/chatapplication/blob/main/spring-ws-server/pom.xml"

    %% Styles
    classDef frontend fill:#D0E8FF,stroke:#0366d6,stroke-width:1px
    classDef backend fill:#D0FFD0,stroke:#22863a,stroke-width:1px
    classDef broker fill:#FFE8A0,stroke:#dbab09,stroke-width:1px
    classDef tool fill:#E0E0E0,stroke:#6a737d,stroke-width:1px,dashed:true
```
