# darshilthakkar/pencilplay architecture

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

- Interactive diagram: https://gitdiagram.com/darshilthakkar/pencilplay
- Repository: https://github.com/darshilthakkar/pencilplay

## Overview

##### Project type and purpose
- This is a full-stack, real-time web application (“PencilPlay”) implemented as a single Spring Boot service.
- Purpose: a scribble/guess game for Bollywood movie names with integrated chat, served via HTTP and WebSocket.

##### File structure
- Top-level “chat” module (Maven project with pom.xml, mvnw scripts, Dockerfile).
- src/main/java:
- com.darshil.chat.ChatApplication.java (Spring Boot entry point)
- com.darshil.chat.chat (ChatController, ChatMessage, MessageType)
- com.darshil.chat.config (WebSocketConfig, WebSocketEventListener)
- com.darshil.chat.game (GameState, Start, WordController)
- src/main/resources/static:
- index.html, main.css, main.js – client UI and SockJS/Stomp client logic
- No external database: state is held in-memory (GameState).
- Tests in src/test/java and build artifacts under target/.

##### README
- Very concise: “A Scribble game for Bollywood Movie Names.”
- Confirms real-time game + chat, no mention of additional services.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Frontend Layer
    subgraph "Frontend Layer"
        direction TB
        Browser["Browser Client\n(HTML/CSS/JS)"]:::frontend
    end

    %% Backend Layer
    subgraph "Backend Service (Spring Boot App)"
        direction TB
        ChatApp["ChatApplication\n(Spring Boot Entry)"]:::backend
        WebSocketCfg["WebSocketConfig"]:::backend
        WebSocketEvt["WebSocketEventListener"]:::backend
        subgraph "Chat Module"
            direction TB
            ChatCtrl["ChatController"]:::backend
            ChatMsg["ChatMessage"]:::backend
            MsgType["MessageType"]:::backend
        end
        subgraph "Game Module"
            direction TB
            WordCtrl["WordController"]:::backend
            GameState["GameState"]:::backend
            StartMsg["Start"]:::backend
        end
        Props["application.properties"]:::backend
    end

    %% Infrastructure Layer
    subgraph "Build & Deployment"
        direction TB
        MavenWrap["Maven Wrapper\n(mvnw, mvnw.cmd)"]:::infra
        Pom["pom.xml"]:::infra
        DockerfileNode["Dockerfile"]:::infra
        Tests["ChatApplicationTests"]:::infra
    end

    %% Interactions
    Browser -->|"HTTP GET /"| ChatApp
    Browser -->|"WebSocket/STOMP"| WebSocketCfg
    WebSocketCfg --> ChatApp
    ChatApp --> WebSocketEvt
    WebSocketEvt --> ChatCtrl
    WebSocketEvt --> WordCtrl
    Browser -->|"STOMP /app/chat.sendMessage"| ChatCtrl
    Browser -->|"STOMP /app/game.start"| WordCtrl
    ChatCtrl -->|"broadcast /topic/public"| Browser
    WordCtrl --> GameState
    GameState -->|"updates via /topic/game"| Browser

    %% Build Pipeline
    Pom --> MavenWrap
    MavenWrap -->|"build JAR"| ChatApp
    ChatApp -->|"package image"| DockerfileNode

    %% Click Events
    click Browser "https://github.com/darshilthakkar/pencilplay/blob/main/Pencil-Play/chat/src/main/resources/static/index.html"
    click Browser "https://github.com/darshilthakkar/pencilplay/blob/main/Pencil-Play/chat/src/main/resources/static/css/main.css"
    click Browser "https://github.com/darshilthakkar/pencilplay/blob/main/Pencil-Play/chat/src/main/resources/static/js/main.js"
    click ChatApp "https://github.com/darshilthakkar/pencilplay/blob/main/Pencil-Play/chat/src/main/java/com/darshil/chat/ChatApplication.java"
    click WebSocketCfg "https://github.com/darshilthakkar/pencilplay/blob/main/Pencil-Play/chat/src/main/java/com/darshil/chat/config/WebSocketConfig.java"
    click WebSocketEvt "https://github.com/darshilthakkar/pencilplay/blob/main/Pencil-Play/chat/src/main/java/com/darshil/chat/config/WebSocketEventListener.java"
    click ChatCtrl "https://github.com/darshilthakkar/pencilplay/blob/main/Pencil-Play/chat/src/main/java/com/darshil/chat/chat/ChatController.java"
    click ChatMsg "https://github.com/darshilthakkar/pencilplay/blob/main/Pencil-Play/chat/src/main/java/com/darshil/chat/chat/ChatMessage.java"
    click MsgType "https://github.com/darshilthakkar/pencilplay/blob/main/Pencil-Play/chat/src/main/java/com/darshil/chat/chat/MessageType.java"
    click WordCtrl "https://github.com/darshilthakkar/pencilplay/blob/main/Pencil-Play/chat/src/main/java/com/darshil/chat/game/WordController.java"
    click GameState "https://github.com/darshilthakkar/pencilplay/blob/main/Pencil-Play/chat/src/main/java/com/darshil/chat/game/GameState.java"
    click StartMsg "https://github.com/darshilthakkar/pencilplay/blob/main/Pencil-Play/chat/src/main/java/com/darshil/chat/game/Start.java"
    click Props "https://github.com/darshilthakkar/pencilplay/blob/main/Pencil-Play/chat/src/main/resources/application.properties"
    click MavenWrap "https://github.com/darshilthakkar/pencilplay/tree/main/Pencil-Play/chat/mvnw"
    click MavenWrap "https://github.com/darshilthakkar/pencilplay/blob/main/Pencil-Play/chat/mvnw.cmd"
    click Pom "https://github.com/darshilthakkar/pencilplay/blob/main/Pencil-Play/chat/pom.xml"
    click DockerfileNode "https://github.com/darshilthakkar/pencilplay/tree/main/Pencil-Play/chat/Dockerfile"
    click Tests "https://github.com/darshilthakkar/pencilplay/blob/main/Pencil-Play/chat/src/test/java/com/darshil/chat/ChatApplicationTests.java"

    %% Styles
    classDef frontend fill:#9f6,stroke:#093,stroke-width:1px
    classDef backend fill:#69f,stroke:#036,stroke-width:1px
    classDef infra fill:#fa3,stroke:#a50,stroke-width:1px
```
