# mirrornetworking/mirror architecture

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

- Interactive diagram: https://gitdiagram.com/mirrornetworking/mirror
- Repository: https://github.com/mirrornetworking/mirror

## Overview

Mirror is a Unity game-networking library. Its principal workflow is a game integrating the networking API, establishing client/server communication through a chosen transport, and synchronizing game state and remote calls. The tree supports paths for the main runtime areas, and the README documents networking features; however, no source excerpts were provided, so internal call relationships are left unverified rather than inferred. The graph preserves the documented capabilities, including interest management, interpolation, lag compensation, and discovery.

Main entry points: [`Assets/Mirror/Core/NetworkServer.cs`](https://github.com/mirrornetworking/mirror/blob/master/Assets/Mirror/Core/NetworkServer.cs) (Network Server), [`Assets/Mirror/Core/NetworkBehaviour.cs`](https://github.com/mirrornetworking/mirror/blob/master/Assets/Mirror/Core/NetworkBehaviour.cs) (Network Behaviours), [`Assets/Mirror/Core/NetworkManager.cs`](https://github.com/mirrornetworking/mirror/blob/master/Assets/Mirror/Core/NetworkManager.cs) (Network Manager), [`Assets/Mirror/Core/NetworkClient.cs`](https://github.com/mirrornetworking/mirror/blob/master/Assets/Mirror/Core/NetworkClient.cs) (Network Client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["Game API"]
  node_manager["Network Manager<br/>[NetworkManager.cs]"]
  node_behaviour["Network Behaviours"]
end

subgraph group_runtime["Network Runtime"]
  node_client["Network Client<br/>[NetworkClient.cs]"]
  node_server["Network Server<br/>[NetworkServer.cs]"]
  node_connections["Connections"]
  node_transport["Transport Layer<br/>[Transport.cs]"]
end

subgraph group_sync["State Synchronization"]
  node_messages["Messages &amp; RPCs<br/>[NetworkMessages.cs]"]
  node_syncvars["Sync Objects<br/>[SyncObject.cs]"]
  node_batching["Message Batching<br/>[Batcher.cs]"]
  node_interpolation["Snapshot Interpolation"]
end

subgraph group_features["Networking Features"]
  node_interest["Interest Management"]
  node_discovery["Network Discovery"]
  node_auth["Authentication"]
  node_lag["Lag Compensation<br/>[LagCompensator.cs]"]
  node_transforms["Transform &amp; Physics"]
  node_prediction["Prediction<br/>[Prediction.cs]"]
end

node_game(("Unity Game"))
node_external_transport{{"Transport Provider"}}

node_game -.->|"configures"| node_manager
node_manager -.->|"starts"| node_client
node_manager -.->|"starts"| node_server
node_client -.->|"uses"| node_connections
node_server -.->|"uses"| node_connections
node_client -.->|"communicates via"| node_transport
node_server -.->|"communicates via"| node_transport
node_transport -.->|"adapts"| node_external_transport
node_behaviour -.->|"issues"| node_messages
node_behaviour -.->|"synchronizes"| node_syncvars
node_messages -.->|"batches"| node_batching
node_client -.->|"uses"| node_interpolation
node_server -.->|"filters by"| node_interest
node_manager -.->|"authenticates"| node_auth
node_game -.->|"discovers servers"| node_discovery
node_behaviour -.->|"synchronizes"| node_transforms
node_behaviour -.->|"uses"| node_prediction
node_server -.->|"supports rollback"| node_lag

click node_manager "https://github.com/mirrornetworking/mirror/blob/master/Assets/Mirror/Core/NetworkManager.cs"
click node_behaviour "https://github.com/mirrornetworking/mirror/blob/master/Assets/Mirror/Core/NetworkBehaviour.cs"
click node_client "https://github.com/mirrornetworking/mirror/blob/master/Assets/Mirror/Core/NetworkClient.cs"
click node_server "https://github.com/mirrornetworking/mirror/blob/master/Assets/Mirror/Core/NetworkServer.cs"
click node_connections "https://github.com/mirrornetworking/mirror/blob/master/Assets/Mirror/Core/NetworkConnection.cs"
click node_transport "https://github.com/mirrornetworking/mirror/blob/master/Assets/Mirror/Core/Transport.cs"
click node_messages "https://github.com/mirrornetworking/mirror/blob/master/Assets/Mirror/Core/NetworkMessages.cs"
click node_syncvars "https://github.com/mirrornetworking/mirror/blob/master/Assets/Mirror/Core/SyncObject.cs"
click node_batching "https://github.com/mirrornetworking/mirror/blob/master/Assets/Mirror/Core/Batching/Batcher.cs"
click node_interpolation "https://github.com/mirrornetworking/mirror/blob/master/Assets/Mirror/Core/SnapshotInterpolation/SnapshotInterpolation.cs"
click node_interest "https://github.com/mirrornetworking/mirror/blob/master/Assets/Mirror/Core/InterestManagement.cs"
click node_discovery "https://github.com/mirrornetworking/mirror/blob/master/Assets/Mirror/Components/Discovery/NetworkDiscoveryBase.cs"
click node_auth "https://github.com/mirrornetworking/mirror/blob/master/Assets/Mirror/Core/NetworkAuthenticator.cs"
click node_lag "https://github.com/mirrornetworking/mirror/blob/master/Assets/Mirror/Components/LagCompensation/LagCompensator.cs"
click node_transforms "https://github.com/mirrornetworking/mirror/blob/master/Assets/Mirror/Components/NetworkTransform/NetworkTransformBase.cs"
click node_prediction "https://github.com/mirrornetworking/mirror/blob/master/Assets/Mirror/Core/Prediction/Prediction.cs"

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_manager,node_behaviour toneBlue
class node_client,node_server,node_connections,node_transport toneAmber
class node_messages,node_syncvars,node_batching,node_interpolation toneMint
class node_interest,node_discovery,node_auth,node_lag,node_transforms,node_prediction toneRose
class node_game,node_external_transport toneIndigo
```

## Components

### Game API

- [Network Manager](https://github.com/mirrornetworking/mirror/blob/master/Assets/Mirror/Core/NetworkManager.cs): `Assets/Mirror/Core/NetworkManager.cs`
- [Network Behaviours](https://github.com/mirrornetworking/mirror/blob/master/Assets/Mirror/Core/NetworkBehaviour.cs): `Assets/Mirror/Core/NetworkBehaviour.cs`

### Network Runtime

- [Network Client](https://github.com/mirrornetworking/mirror/blob/master/Assets/Mirror/Core/NetworkClient.cs): `Assets/Mirror/Core/NetworkClient.cs`
- [Network Server](https://github.com/mirrornetworking/mirror/blob/master/Assets/Mirror/Core/NetworkServer.cs): `Assets/Mirror/Core/NetworkServer.cs`
- [Connections](https://github.com/mirrornetworking/mirror/blob/master/Assets/Mirror/Core/NetworkConnection.cs): `Assets/Mirror/Core/NetworkConnection.cs`
- [Transport Layer](https://github.com/mirrornetworking/mirror/blob/master/Assets/Mirror/Core/Transport.cs): `Assets/Mirror/Core/Transport.cs`

### State Synchronization

- [Messages & RPCs](https://github.com/mirrornetworking/mirror/blob/master/Assets/Mirror/Core/NetworkMessages.cs): `Assets/Mirror/Core/NetworkMessages.cs`
- [Sync Objects](https://github.com/mirrornetworking/mirror/blob/master/Assets/Mirror/Core/SyncObject.cs): `Assets/Mirror/Core/SyncObject.cs`
- [Message Batching](https://github.com/mirrornetworking/mirror/blob/master/Assets/Mirror/Core/Batching/Batcher.cs): `Assets/Mirror/Core/Batching/Batcher.cs`
- [Snapshot Interpolation](https://github.com/mirrornetworking/mirror/blob/master/Assets/Mirror/Core/SnapshotInterpolation/SnapshotInterpolation.cs): `Assets/Mirror/Core/SnapshotInterpolation/SnapshotInterpolation.cs`

### Networking Features

- [Interest Management](https://github.com/mirrornetworking/mirror/blob/master/Assets/Mirror/Core/InterestManagement.cs): `Assets/Mirror/Core/InterestManagement.cs`
- [Network Discovery](https://github.com/mirrornetworking/mirror/blob/master/Assets/Mirror/Components/Discovery/NetworkDiscoveryBase.cs): `Assets/Mirror/Components/Discovery/NetworkDiscoveryBase.cs`
- [Authentication](https://github.com/mirrornetworking/mirror/blob/master/Assets/Mirror/Core/NetworkAuthenticator.cs): `Assets/Mirror/Core/NetworkAuthenticator.cs`
- [Lag Compensation](https://github.com/mirrornetworking/mirror/blob/master/Assets/Mirror/Components/LagCompensation/LagCompensator.cs): `Assets/Mirror/Components/LagCompensation/LagCompensator.cs`
- [Transform & Physics](https://github.com/mirrornetworking/mirror/blob/master/Assets/Mirror/Components/NetworkTransform/NetworkTransformBase.cs): `Assets/Mirror/Components/NetworkTransform/NetworkTransformBase.cs`
- [Prediction](https://github.com/mirrornetworking/mirror/blob/master/Assets/Mirror/Core/Prediction/Prediction.cs): `Assets/Mirror/Core/Prediction/Prediction.cs`

### Other components

- **Unity Game**
- **Transport Provider**

## Connections

- Unity Game → Network Manager: configures
- Network Manager → Network Client: starts
- Network Manager → Network Server: starts
- Network Client → Connections: uses
- Network Server → Connections: uses
- Network Client → Transport Layer: communicates via
- Network Server → Transport Layer: communicates via
- Transport Layer → Transport Provider: adapts
- Network Behaviours → Messages & RPCs: issues
- Network Behaviours → Sync Objects: synchronizes
- Messages & RPCs → Message Batching: batches
- Network Client → Snapshot Interpolation: uses
- Network Server → Interest Management: filters by
- Network Manager → Authentication: authenticates
- Unity Game → Network Discovery: discovers servers
- Network Behaviours → Transform & Physics: synchronizes
- Network Behaviours → Prediction: uses
- Network Server → Lag Compensation: supports rollback
