# ityctota/forasoft architecture

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

- Interactive diagram: https://gitdiagram.com/ityctota/forasoft
- Repository: https://github.com/ityctota/forasoft

## Overview

Video Chat Room is a browser-based group calling app for up to four participants, with chat and invite links. Users enter a display name, create or join a room, then the room-call hook coordinates room membership, local media, WebRTC peer negotiation, participant state, and chat; the server handles room events and relays signaling. The graph preserves the documented client, server, and shared-contract layers. Some source excerpts are partial, so unsampled connections are omitted unless documented or strongly implied.

Main entry points: [`client/src/features/room/model/useRoomCall.js`](https://github.com/ityctota/forasoft/blob/develop/client/src/features/room/model/useRoomCall.js) (Call coordinator), [`client/src/features/room/ui/RoomWorkspace.jsx`](https://github.com/ityctota/forasoft/blob/develop/client/src/features/room/ui/RoomWorkspace.jsx) (Room workspace), [`server/src/socket/roomGateway.js`](https://github.com/ityctota/forasoft/blob/develop/server/src/socket/roomGateway.js) (Room gateway), [`client/src/pages/RoomPage.jsx`](https://github.com/ityctota/forasoft/blob/develop/client/src/pages/RoomPage.jsx) (Room page)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["React client"]
  node_app["App routing<br/>[App.jsx]"]
  node_router["URL router<br/>[router.jsx]"]
  node_home["Home page<br/>[HomePage.jsx]"]
  node_roompage["Room page<br/>[RoomPage.jsx]"]
  node_name["Name field<br/>[NameField.jsx]"]
end

subgraph group_room["Room calling"]
  node_joinform["Room join form<br/>[RoomJoinForm.jsx]"]
  node_callhook["Call coordinator<br/>[useRoomCall.js]"]
  node_session["Room session<br/>[roomSession.js]"]
  node_media["Media controller<br/>[mediaController.js]"]
  node_peers["Peer manager"]
  node_negotiation["Negotiation controller"]
  node_participantmodel["Participant state<br/>[participants.js]"]
  node_messages["Chat state<br/>[messages.js]"]
  node_workspace["Room workspace<br/>[RoomWorkspace.jsx]"]
  node_participantlist["Participant list"]
  node_chat["Chat panel<br/>[ChatPanel.jsx]"]
  node_invite["Invite link<br/>[InviteLink.jsx]"]
  node_controls["Media controls<br/>[MediaControls.jsx]"]
  node_videogrid["Video grid<br/>[VideoGrid.jsx]"]
end

subgraph group_server["Room server"]
  node_http["HTTP and Socket server<br/>[app.js]"]
  node_gateway["Room gateway<br/>[roomGateway.js]"]
  node_registry[("Room registry<br/>[roomRegistry.js]")]
  node_history["Message history<br/>[messageHistory.js]"]
  node_observability["Server observability<br/>[observability.js]"]
end

subgraph group_shared["Shared contracts"]
  node_contracts["Event contracts<br/>[contracts.js]"]
  node_validation["Input validation<br/>[validation.js]"]
end

node_user(("Participant"))
node_browser["Browser devices"]

node_user -->|"enters name"| node_home
node_user -->|"joins room"| node_joinform
node_app -->|"reads route"| node_router
node_app -->|"renders"| node_home
node_app -->|"renders"| node_roompage
node_home -->|"uses"| node_name
node_roompage -->|"coordinates"| node_callhook
node_roompage -->|"renders"| node_joinform
node_roompage -->|"renders"| node_workspace
node_joinform -->|"uses"| node_name
node_callhook -->|"creates and joins"| node_session
node_callhook -->|"acquires media"| node_media
node_callhook -->|"manages peers"| node_peers
node_callhook -->|"coordinates negotiation"| node_negotiation
node_callhook -->|"maps participants"| node_participantmodel
node_callhook -->|"updates chat"| node_messages
node_media -->|"requests devices"| node_browser
node_peers -->|"creates WebRTC peers"| node_browser
node_negotiation -->|"creates peers"| node_peers
node_negotiation -->|"sends signals"| node_session
node_workspace -->|"renders"| node_participantlist
node_workspace -->|"renders"| node_chat
node_workspace -->|"renders"| node_invite
node_workspace -->|"renders"| node_controls
node_workspace -->|"renders"| node_videogrid
node_chat -->|"reads chat state"| node_messages
node_http -->|"configures"| node_gateway
node_http -->|"creates"| node_registry
node_http -->|"creates"| node_observability
node_gateway -.->|"uses room state"| node_registry
node_registry -->|"creates and snapshots messages"| node_history
node_gateway -->|"uses event definitions"| node_contracts
node_gateway -->|"validates payloads"| node_validation
node_callhook -->|"uses shared validation"| node_contracts
node_user -->|"connects to room"| node_http
node_session -.->|"exchanges room events"| node_gateway
node_gateway -.->|"relays signaling and chat"| node_session

click node_app "https://github.com/ityctota/forasoft/blob/develop/client/src/app/App.jsx"
click node_router "https://github.com/ityctota/forasoft/blob/develop/client/src/app/router.jsx"
click node_home "https://github.com/ityctota/forasoft/blob/develop/client/src/pages/HomePage.jsx"
click node_roompage "https://github.com/ityctota/forasoft/blob/develop/client/src/pages/RoomPage.jsx"
click node_name "https://github.com/ityctota/forasoft/blob/develop/client/src/shared/ui/NameField.jsx"
click node_joinform "https://github.com/ityctota/forasoft/blob/develop/client/src/features/room/ui/RoomJoinForm.jsx"
click node_callhook "https://github.com/ityctota/forasoft/blob/develop/client/src/features/room/model/useRoomCall.js"
click node_session "https://github.com/ityctota/forasoft/blob/develop/client/src/features/room/model/roomSession.js"
click node_media "https://github.com/ityctota/forasoft/blob/develop/client/src/features/room/model/mediaController.js"
click node_peers "https://github.com/ityctota/forasoft/blob/develop/client/src/features/room/model/peerConnectionManager.js"
click node_negotiation "https://github.com/ityctota/forasoft/blob/develop/client/src/features/room/model/negotiationController.js"
click node_participantmodel "https://github.com/ityctota/forasoft/blob/develop/client/src/entities/participant/model/participants.js"
click node_messages "https://github.com/ityctota/forasoft/blob/develop/client/src/features/room/model/messages.js"
click node_workspace "https://github.com/ityctota/forasoft/blob/develop/client/src/features/room/ui/RoomWorkspace.jsx"
click node_participantlist "https://github.com/ityctota/forasoft/blob/develop/client/src/entities/participant/ui/ParticipantList.jsx"
click node_chat "https://github.com/ityctota/forasoft/blob/develop/client/src/features/room/ui/ChatPanel.jsx"
click node_invite "https://github.com/ityctota/forasoft/blob/develop/client/src/features/room/ui/InviteLink.jsx"
click node_controls "https://github.com/ityctota/forasoft/blob/develop/client/src/features/room/ui/MediaControls.jsx"
click node_videogrid "https://github.com/ityctota/forasoft/blob/develop/client/src/features/room/ui/VideoGrid.jsx"
click node_http "https://github.com/ityctota/forasoft/blob/develop/server/src/app.js"
click node_gateway "https://github.com/ityctota/forasoft/blob/develop/server/src/socket/roomGateway.js"
click node_registry "https://github.com/ityctota/forasoft/blob/develop/server/src/rooms/roomRegistry.js"
click node_history "https://github.com/ityctota/forasoft/blob/develop/server/src/rooms/messageHistory.js"
click node_observability "https://github.com/ityctota/forasoft/blob/develop/server/src/observability.js"
click node_contracts "https://github.com/ityctota/forasoft/blob/develop/shared/src/contracts.js"
click node_validation "https://github.com/ityctota/forasoft/blob/develop/shared/src/validation.js"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_app,node_router,node_home,node_roompage,node_name,node_browser toneBlue
class node_joinform,node_callhook,node_session,node_media,node_peers,node_negotiation,node_participantmodel,node_messages,node_workspace,node_participantlist,node_chat,node_invite,node_controls,node_videogrid toneAmber
class node_http,node_gateway,node_registry,node_history,node_observability toneMint
class node_contracts,node_validation toneRose
class node_user toneIndigo
```

## Components

### React client

- [App routing](https://github.com/ityctota/forasoft/blob/develop/client/src/app/App.jsx): `client/src/app/App.jsx`
- [URL router](https://github.com/ityctota/forasoft/blob/develop/client/src/app/router.jsx): `client/src/app/router.jsx`
- [Home page](https://github.com/ityctota/forasoft/blob/develop/client/src/pages/HomePage.jsx): `client/src/pages/HomePage.jsx`
- [Room page](https://github.com/ityctota/forasoft/blob/develop/client/src/pages/RoomPage.jsx): `client/src/pages/RoomPage.jsx`
- [Name field](https://github.com/ityctota/forasoft/blob/develop/client/src/shared/ui/NameField.jsx): `client/src/shared/ui/NameField.jsx`

### Room calling

- [Room join form](https://github.com/ityctota/forasoft/blob/develop/client/src/features/room/ui/RoomJoinForm.jsx): `client/src/features/room/ui/RoomJoinForm.jsx`
- [Call coordinator](https://github.com/ityctota/forasoft/blob/develop/client/src/features/room/model/useRoomCall.js): `client/src/features/room/model/useRoomCall.js`
- [Room session](https://github.com/ityctota/forasoft/blob/develop/client/src/features/room/model/roomSession.js): `client/src/features/room/model/roomSession.js`
- [Media controller](https://github.com/ityctota/forasoft/blob/develop/client/src/features/room/model/mediaController.js): `client/src/features/room/model/mediaController.js`
- [Peer manager](https://github.com/ityctota/forasoft/blob/develop/client/src/features/room/model/peerConnectionManager.js): `client/src/features/room/model/peerConnectionManager.js`
- [Negotiation controller](https://github.com/ityctota/forasoft/blob/develop/client/src/features/room/model/negotiationController.js): `client/src/features/room/model/negotiationController.js`
- [Participant state](https://github.com/ityctota/forasoft/blob/develop/client/src/entities/participant/model/participants.js): `client/src/entities/participant/model/participants.js`
- [Chat state](https://github.com/ityctota/forasoft/blob/develop/client/src/features/room/model/messages.js): `client/src/features/room/model/messages.js`
- [Room workspace](https://github.com/ityctota/forasoft/blob/develop/client/src/features/room/ui/RoomWorkspace.jsx): `client/src/features/room/ui/RoomWorkspace.jsx`
- [Participant list](https://github.com/ityctota/forasoft/blob/develop/client/src/entities/participant/ui/ParticipantList.jsx): `client/src/entities/participant/ui/ParticipantList.jsx`
- [Chat panel](https://github.com/ityctota/forasoft/blob/develop/client/src/features/room/ui/ChatPanel.jsx): `client/src/features/room/ui/ChatPanel.jsx`
- [Invite link](https://github.com/ityctota/forasoft/blob/develop/client/src/features/room/ui/InviteLink.jsx): `client/src/features/room/ui/InviteLink.jsx`
- [Media controls](https://github.com/ityctota/forasoft/blob/develop/client/src/features/room/ui/MediaControls.jsx): `client/src/features/room/ui/MediaControls.jsx`
- [Video grid](https://github.com/ityctota/forasoft/blob/develop/client/src/features/room/ui/VideoGrid.jsx): `client/src/features/room/ui/VideoGrid.jsx`

### Room server

- [HTTP and Socket server](https://github.com/ityctota/forasoft/blob/develop/server/src/app.js): `server/src/app.js`
- [Room gateway](https://github.com/ityctota/forasoft/blob/develop/server/src/socket/roomGateway.js): `server/src/socket/roomGateway.js`
- [Room registry](https://github.com/ityctota/forasoft/blob/develop/server/src/rooms/roomRegistry.js): `server/src/rooms/roomRegistry.js`
- [Message history](https://github.com/ityctota/forasoft/blob/develop/server/src/rooms/messageHistory.js): `server/src/rooms/messageHistory.js`
- [Server observability](https://github.com/ityctota/forasoft/blob/develop/server/src/observability.js): `server/src/observability.js`

### Shared contracts

- [Event contracts](https://github.com/ityctota/forasoft/blob/develop/shared/src/contracts.js): `shared/src/contracts.js`
- [Input validation](https://github.com/ityctota/forasoft/blob/develop/shared/src/validation.js): `shared/src/validation.js`

### Other components

- **Participant**
- **Browser devices**

## Connections

- Participant → Home page: enters name (evidence: `README.md`)
- Participant → Room join form: joins room (evidence: `README.md`)
- App routing → URL router: reads route (evidence: `client/src/app/App.jsx`)
- App routing → Home page: renders (evidence: `client/src/app/App.jsx`)
- App routing → Room page: renders (evidence: `client/src/app/App.jsx`)
- Home page → Name field: uses (evidence: `client/src/pages/HomePage.jsx`)
- Room page → Call coordinator: coordinates (evidence: `client/src/pages/RoomPage.jsx`)
- Room page → Room join form: renders (evidence: `client/src/pages/RoomPage.jsx`)
- Room page → Room workspace: renders (evidence: `client/src/pages/RoomPage.jsx`)
- Room join form → Name field: uses (evidence: `client/src/features/room/ui/RoomJoinForm.jsx`)
- Call coordinator → Room session: creates and joins (evidence: `client/src/features/room/model/useRoomCall.js`)
- Call coordinator → Media controller: acquires media (evidence: `client/src/features/room/model/useRoomCall.js`)
- Call coordinator → Peer manager: manages peers (evidence: `client/src/features/room/model/useRoomCall.js`)
- Call coordinator → Negotiation controller: coordinates negotiation (evidence: `client/src/features/room/model/useRoomCall.js`)
- Call coordinator → Participant state: maps participants (evidence: `client/src/features/room/model/useRoomCall.js`)
- Call coordinator → Chat state: updates chat (evidence: `client/src/features/room/model/useRoomCall.js`)
- Media controller → Browser devices: requests devices (evidence: `client/src/features/room/model/mediaController.js`)
- Peer manager → Browser devices: creates WebRTC peers (evidence: `client/src/features/room/model/peerConnectionManager.js`)
- Negotiation controller → Peer manager: creates peers (evidence: `client/src/features/room/model/negotiationController.js`)
- Negotiation controller → Room session: sends signals (evidence: `client/src/features/room/model/negotiationController.js`)
- Room workspace → Participant list: renders (evidence: `client/src/features/room/ui/RoomWorkspace.jsx`)
- Room workspace → Chat panel: renders (evidence: `client/src/features/room/ui/RoomWorkspace.jsx`)
- Room workspace → Invite link: renders (evidence: `client/src/features/room/ui/RoomWorkspace.jsx`)
- Room workspace → Media controls: renders (evidence: `client/src/features/room/ui/RoomWorkspace.jsx`)
- Room workspace → Video grid: renders (evidence: `client/src/features/room/ui/RoomWorkspace.jsx`)
- Chat panel → Chat state: reads chat state (evidence: `client/src/features/room/ui/ChatPanel.jsx`)
- HTTP and Socket server → Room gateway: configures (evidence: `server/src/app.js`)
- HTTP and Socket server → Room registry: creates (evidence: `server/src/app.js`)
- HTTP and Socket server → Server observability: creates (evidence: `server/src/app.js`)
- Room gateway → Room registry: uses room state
- Room registry → Message history: creates and snapshots messages (evidence: `server/src/rooms/roomRegistry.js`)
- Room gateway → Event contracts: uses event definitions (evidence: `server/src/socket/roomGateway.js`)
- Room gateway → Input validation: validates payloads (evidence: `server/src/socket/roomGateway.js`)
- Call coordinator → Event contracts: uses shared validation (evidence: `client/src/features/room/model/useRoomCall.js`)
- Participant → HTTP and Socket server: connects to room (evidence: `README.md`)
- Room session → Room gateway: exchanges room events
- Room gateway → Room session: relays signaling and chat
