# shanwer/geyser architecture

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

- Interactive diagram: https://gitdiagram.com/shanwer/geyser
- Repository: https://github.com/shanwer/geyser

## Overview

##### Main Components

a. Core Components:
- Protocol Translation Layer
- Session Management
- Entity Management
- Inventory System
- World/Chunk Management
- Authentication System

b. Platform-specific Components:
- Standalone Bootstrap
- Platform-specific Implementations (Spigot, BungeeCord, Velocity, etc.)
- Extension System

**┌─────────────────────────────────────────────┐**
- Bedrock Client                 │
- ┘
- ↕
**┌─────────────────────────────────────────────┐**
- Network Layer                  │
- (Protocol Handlers, Compression, Packets)   │
- ┘
- ↕
**┌─────────────────────────────────────────────┐**
- Translation Layer                │
- ┬─────────────┬────────────┤
- Entity          │ Inventory   │ Block      │
- Translation     │ Translation │ Translation │
- ┴─────────────┴────────────┘
- ↕
**┌─────────────────────────────────────────────┐**
- Session Layer                  │
- (GeyserSession, Cache, State Management)   │
- ┘
- ↕
**┌─────────────────────────────────────────────┐**
- Platform Layer                   │
- (Standalone, Spigot, Bungee, etc.)        │
- ┘
- ↕
**┌─────────────────────────────────────────────┐**
- Java Server                      │
- ┘

##### Key Components Detail

a. Translation Layer:
- Packet translators for both directions (Bedrock → Java and Java → Bedrock)
- Registry systems for blocks, items, and entities
- Connection handling components

b. Session Management:
- Cache management
- Authentication flow
- Player data handling

c. Platform Integration:
- How different platforms connect
- Extension system
- Configuration management

##### Additional Elements

Include:
- Extension system integration points
- Resource pack management
- Authentication flows
- Cache management systems
- Event handling system

##### Notes

Annotations for:
- Version compatibility information
- Key configuration points
- Important limitations
- Extension points

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Client
        BC[Bedrock Client]
    end

    subgraph Network
        NL["Network Layer"]:::network
        PH["Protocol Handlers"]:::network
        CP["Compression"]:::network
        PK["Packets"]:::network
        NL --- PH & CP & PK
    end

    subgraph Translation
        TL["Translation Layer"]:::translation
        ET["Entity Translation"]:::translation
        IT["Inventory Translation"]:::translation
        BT["Block Translation"]:::translation
        RS["Registry System"]:::translation
        TL --- ET & IT & BT & RS
    end

    subgraph Session
        SL["Session Layer"]:::session
        GS["GeyserSession"]:::session
        CM["Cache Management"]:::session
        SM["State Management"]:::session
        AS["Authentication System"]:::session
        SL --- GS & CM & SM & AS
    end

    subgraph Platform
        PL["Platform Layer"]:::platform
        ST["Standalone"]:::platform
        SP["Spigot"]:::platform
        BC2["BungeeCord"]:::platform
        VL["Velocity"]:::platform
        ES["Extension System"]:::platform
        PL --- ST & SP & BC2 & VL & ES
    end

    subgraph Server
        JS[Java Server]
    end

    BC <--> NL
    NL <--> TL
    TL <--> SL
    SL <--> PL
    PL <--> JS

    %% Click events for component mapping
    click NL "https://github.com/Shanwer/Geyser/tree/master/core/src/main/java/org/geysermc/geyser/network/"
    click TL "https://github.com/Shanwer/Geyser/tree/master/core/src/main/java/org/geysermc/geyser/translator/protocol/"
    click ET "https://github.com/Shanwer/Geyser/tree/master/core/src/main/java/org/geysermc/geyser/entity/"
    click IT "https://github.com/Shanwer/Geyser/tree/master/core/src/main/java/org/geysermc/geyser/inventory/"
    click RS "https://github.com/Shanwer/Geyser/tree/master/core/src/main/java/org/geysermc/geyser/registry/"
    click SL "https://github.com/Shanwer/Geyser/tree/master/core/src/main/java/org/geysermc/geyser/session/"
    click AS "https://github.com/Shanwer/Geyser/tree/master/core/src/main/java/org/geysermc/geyser/session/auth/"
    click ST "https://github.com/Shanwer/Geyser/tree/master/bootstrap/standalone/"
    click SP "https://github.com/Shanwer/Geyser/tree/master/bootstrap/spigot/"
    click BC2 "https://github.com/Shanwer/Geyser/tree/master/bootstrap/bungeecord/"
    click VL "https://github.com/Shanwer/Geyser/tree/master/bootstrap/velocity/"
    click ES "https://github.com/Shanwer/Geyser/tree/master/core/src/main/java/org/geysermc/geyser/extension/"

    %% Styling
    classDef network fill:#ADD8E6,stroke:#333
    classDef translation fill:#90EE90,stroke:#333
    classDef session fill:#FFB6C1,stroke:#333
    classDef platform fill:#DEB887,stroke:#333

    %% Legend
    subgraph Legend
        L1[Network Components]:::network
        L2[Translation Components]:::translation
        L3[Session Components]:::session
        L4[Platform Components]:::platform
    end
```
