# ebay/nmessenger architecture

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

- Interactive diagram: https://gitdiagram.com/ebay/nmessenger
- Repository: https://github.com/ebay/nmessenger

## Overview

NMessenger is a Swift iOS chat UI component. An app embeds the messenger or uses its prebuilt controller; the controller accepts input and creates messages, while the messenger manages displayed messages and message groups. Message content supports text, local or network images, collections, custom rich content, and typing indicators, presented with configurable bubbles and avatar support. The README documents animated message changes and asynchronous head prefetching. The graph reflects documented capabilities where source excerpts were unavailable; those links are omitted when their caller could not be established.

Main entry points: [`nMessenger/Source/MessageNodes/MessageCell/MessageNode.swift`](https://github.com/ebay/nmessenger/blob/master/nMessenger/Source/MessageNodes/MessageCell/MessageNode.swift) (Message node), [`nMessenger/Source/Messenger/NMessengerViewController.swift`](https://github.com/ebay/nmessenger/blob/master/nMessenger/Source/Messenger/NMessengerViewController.swift) (Chat controller), [`nMessenger/Source/Messenger/Components/NMessenger.swift`](https://github.com/ebay/nmessenger/blob/master/nMessenger/Source/Messenger/Components/NMessenger.swift) (Message manager), [`nMessenger/Source/MessageNodes/ContentNodes/NetworkImageContent/NetworkImageContentNode.swift`](https://github.com/ebay/nmessenger/blob/master/nMessenger/Source/MessageNodes/ContentNodes/NetworkImageContent/NetworkImageContentNode.swift) (Network image)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["App integration"]
  node_controller["Chat controller"]
  node_input["Input bar<br/>[InputBarView.swift]"]
  node_inputprotocol["Input bar API"]
  node_camera["Camera and library"]
end

subgraph group_messenger["Messenger flow"]
  node_messenger["Message manager<br/>[NMessenger.swift]"]
  node_messagegroup["Message groups<br/>[MessageGroup.swift]"]
  node_loading["Head prefetch"]
end

subgraph group_render["Message rendering"]
  node_generalcell["Message cell"]
  node_messagenode["Message node<br/>[MessageNode.swift]"]
  node_bubble["Bubble renderer<br/>[Bubble.swift]"]
  node_bubbletypes["Bubble variants"]
end

subgraph group_content["Content and styling"]
  node_bubbleconfig["Bubble configuration"]
  node_text["Text content"]
  node_image["Image content"]
  node_networkimage["Network image"]
  node_collection["Collection content"]
  node_custom["Custom content"]
  node_typing["Typing indicator"]
end

node_app(("Host app"))
node_asyncdisplaykit["AsyncDisplayKit"]
node_pincache[("PINCache")]

node_app -->|"uses"| node_controller
node_app -->|"embeds"| node_messenger
node_controller -->|"installs"| node_input
node_input -->|"implements"| node_inputprotocol
node_controller -->|"posts messages"| node_messenger
node_controller -->|"opens capture"| node_camera
node_messenger -->|"manages groups"| node_messagegroup
node_messagegroup -->|"stores messages"| node_generalcell
node_generalcell -->|"renders as"| node_messagenode
node_messagenode -->|"displays in"| node_bubble
node_bubbletypes -->|"specializes"| node_bubble
node_bubbleconfig -->|"configures"| node_bubble
node_messagenode -->|"hosts content"| node_text
node_messagenode -->|"hosts content"| node_image
node_messagenode -->|"hosts content"| node_networkimage
node_messagenode -->|"hosts content"| node_collection
node_messagenode -->|"hosts content"| node_custom
node_messagenode -->|"hosts content"| node_typing
node_messenger -.->|"prefetches head"| node_loading
node_networkimage -.->|"uses cache"| node_pincache
node_networkimage -.->|"loads asynchronously"| node_asyncdisplaykit
node_messagenode -.->|"uses rendering"| node_asyncdisplaykit

click node_controller "https://github.com/ebay/nmessenger/blob/master/nMessenger/Source/Messenger/NMessengerViewController.swift"
click node_input "https://github.com/ebay/nmessenger/blob/master/nMessenger/Source/Messenger/Components/InputBarView/InputBarView.swift"
click node_inputprotocol "https://github.com/ebay/nmessenger/blob/master/nMessenger/Source/Messenger/Components/InputBarView/InputBarViewProtocol.swift"
click node_camera "https://github.com/ebay/nmessenger/blob/master/nMessenger/Source/Messenger/Components/CameraViewController.swift"
click node_messenger "https://github.com/ebay/nmessenger/blob/master/nMessenger/Source/Messenger/Components/NMessenger.swift"
click node_messagegroup "https://github.com/ebay/nmessenger/blob/master/nMessenger/Source/MessageNodes/MessageCell/MessageGroup.swift"
click node_loading "https://github.com/ebay/nmessenger/blob/master/nMessenger/Source/MessageNodes/Indicators/HeadLoadingIndicator.swift"
click node_generalcell "https://github.com/ebay/nmessenger/blob/master/nMessenger/Source/MessageNodes/GeneralMessageCell/GeneralMessengerCell.swift"
click node_messagenode "https://github.com/ebay/nmessenger/blob/master/nMessenger/Source/MessageNodes/MessageCell/MessageNode.swift"
click node_bubble "https://github.com/ebay/nmessenger/blob/master/nMessenger/Source/MessageNodes/Bubbles/Bubble.swift"
click node_bubbletypes "https://github.com/ebay/nmessenger/blob/master/nMessenger/Source/MessageNodes/Bubbles/DefaultBubble.swift"
click node_bubbleconfig "https://github.com/ebay/nmessenger/blob/master/nMessenger/Source/MessageNodes/BubbleConfiguration/BubbleConfigurationProtocol.swift"
click node_text "https://github.com/ebay/nmessenger/blob/master/nMessenger/Source/MessageNodes/ContentNodes/TextContent/TextContentNode.swift"
click node_image "https://github.com/ebay/nmessenger/blob/master/nMessenger/Source/MessageNodes/ContentNodes/ImageContent/ImageContentNode.swift"
click node_networkimage "https://github.com/ebay/nmessenger/blob/master/nMessenger/Source/MessageNodes/ContentNodes/NetworkImageContent/NetworkImageContentNode.swift"
click node_collection "https://github.com/ebay/nmessenger/blob/master/nMessenger/Source/MessageNodes/ContentNodes/CollectionViewContent/CollectionViewContentNode.swift"
click node_custom "https://github.com/ebay/nmessenger/blob/master/nMessenger/Source/MessageNodes/ContentNodes/CustomContentContent/CustomContentNode.swift"
click node_typing "https://github.com/ebay/nmessenger/blob/master/nMessenger/Source/MessageNodes/ContentNodes/TypingIndicatorContent/TypingIndicatorContent.swift"

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_controller,node_input,node_inputprotocol,node_camera toneBlue
class node_messenger,node_messagegroup,node_loading,node_pincache toneAmber
class node_generalcell,node_messagenode,node_bubble,node_bubbletypes toneMint
class node_bubbleconfig,node_text,node_image,node_networkimage,node_collection,node_custom,node_typing toneRose
class node_app,node_asyncdisplaykit toneIndigo
```

## Components

### App integration

- [Chat controller](https://github.com/ebay/nmessenger/blob/master/nMessenger/Source/Messenger/NMessengerViewController.swift): `nMessenger/Source/Messenger/NMessengerViewController.swift`
- [Input bar](https://github.com/ebay/nmessenger/blob/master/nMessenger/Source/Messenger/Components/InputBarView/InputBarView.swift): `nMessenger/Source/Messenger/Components/InputBarView/InputBarView.swift`
- [Input bar API](https://github.com/ebay/nmessenger/blob/master/nMessenger/Source/Messenger/Components/InputBarView/InputBarViewProtocol.swift): `nMessenger/Source/Messenger/Components/InputBarView/InputBarViewProtocol.swift`
- [Camera and library](https://github.com/ebay/nmessenger/blob/master/nMessenger/Source/Messenger/Components/CameraViewController.swift): `nMessenger/Source/Messenger/Components/CameraViewController.swift`

### Messenger flow

- [Message manager](https://github.com/ebay/nmessenger/blob/master/nMessenger/Source/Messenger/Components/NMessenger.swift): `nMessenger/Source/Messenger/Components/NMessenger.swift`
- [Message groups](https://github.com/ebay/nmessenger/blob/master/nMessenger/Source/MessageNodes/MessageCell/MessageGroup.swift): `nMessenger/Source/MessageNodes/MessageCell/MessageGroup.swift`
- [Head prefetch](https://github.com/ebay/nmessenger/blob/master/nMessenger/Source/MessageNodes/Indicators/HeadLoadingIndicator.swift): `nMessenger/Source/MessageNodes/Indicators/HeadLoadingIndicator.swift`

### Message rendering

- [Message cell](https://github.com/ebay/nmessenger/blob/master/nMessenger/Source/MessageNodes/GeneralMessageCell/GeneralMessengerCell.swift): `nMessenger/Source/MessageNodes/GeneralMessageCell/GeneralMessengerCell.swift`
- [Message node](https://github.com/ebay/nmessenger/blob/master/nMessenger/Source/MessageNodes/MessageCell/MessageNode.swift): `nMessenger/Source/MessageNodes/MessageCell/MessageNode.swift`
- [Bubble renderer](https://github.com/ebay/nmessenger/blob/master/nMessenger/Source/MessageNodes/Bubbles/Bubble.swift): `nMessenger/Source/MessageNodes/Bubbles/Bubble.swift`
- [Bubble variants](https://github.com/ebay/nmessenger/blob/master/nMessenger/Source/MessageNodes/Bubbles/DefaultBubble.swift): `nMessenger/Source/MessageNodes/Bubbles/DefaultBubble.swift`

### Content and styling

- [Bubble configuration](https://github.com/ebay/nmessenger/blob/master/nMessenger/Source/MessageNodes/BubbleConfiguration/BubbleConfigurationProtocol.swift): `nMessenger/Source/MessageNodes/BubbleConfiguration/BubbleConfigurationProtocol.swift`
- [Text content](https://github.com/ebay/nmessenger/blob/master/nMessenger/Source/MessageNodes/ContentNodes/TextContent/TextContentNode.swift): `nMessenger/Source/MessageNodes/ContentNodes/TextContent/TextContentNode.swift`
- [Image content](https://github.com/ebay/nmessenger/blob/master/nMessenger/Source/MessageNodes/ContentNodes/ImageContent/ImageContentNode.swift): `nMessenger/Source/MessageNodes/ContentNodes/ImageContent/ImageContentNode.swift`
- [Network image](https://github.com/ebay/nmessenger/blob/master/nMessenger/Source/MessageNodes/ContentNodes/NetworkImageContent/NetworkImageContentNode.swift): `nMessenger/Source/MessageNodes/ContentNodes/NetworkImageContent/NetworkImageContentNode.swift`
- [Collection content](https://github.com/ebay/nmessenger/blob/master/nMessenger/Source/MessageNodes/ContentNodes/CollectionViewContent/CollectionViewContentNode.swift): `nMessenger/Source/MessageNodes/ContentNodes/CollectionViewContent/CollectionViewContentNode.swift`
- [Custom content](https://github.com/ebay/nmessenger/blob/master/nMessenger/Source/MessageNodes/ContentNodes/CustomContentContent/CustomContentNode.swift): `nMessenger/Source/MessageNodes/ContentNodes/CustomContentContent/CustomContentNode.swift`
- [Typing indicator](https://github.com/ebay/nmessenger/blob/master/nMessenger/Source/MessageNodes/ContentNodes/TypingIndicatorContent/TypingIndicatorContent.swift): `nMessenger/Source/MessageNodes/ContentNodes/TypingIndicatorContent/TypingIndicatorContent.swift`

### Other components

- **Host app**
- **AsyncDisplayKit**
- **PINCache**

## Connections

- Host app → Chat controller: uses
- Host app → Message manager: embeds
- Chat controller → Input bar: installs
- Input bar → Input bar API: implements
- Chat controller → Message manager: posts messages
- Chat controller → Camera and library: opens capture
- Message manager → Message groups: manages groups
- Message groups → Message cell: stores messages
- Message cell → Message node: renders as
- Message node → Bubble renderer: displays in
- Bubble variants → Bubble renderer: specializes
- Bubble configuration → Bubble renderer: configures
- Message node → Text content: hosts content
- Message node → Image content: hosts content
- Message node → Network image: hosts content
- Message node → Collection content: hosts content
- Message node → Custom content: hosts content
- Message node → Typing indicator: hosts content
- Message manager → Head prefetch: prefetches head
- Network image → PINCache: uses cache
- Network image → AsyncDisplayKit: loads asynchronously
- Message node → AsyncDisplayKit: uses rendering
