# goldengr/authserver architecture

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

- Interactive diagram: https://gitdiagram.com/goldengr/authserver
- Repository: https://github.com/goldengr/authserver

## Overview

golden’s AuthServer is a Minecraft login backend: a client completes the server handshake and encryption exchange, the server checks the session with Microsoft’s authentication service, then issues a code for use in an app. The code is passed to a configurable token-logging hook; persistence is left to the operator’s backend. The server also provides status responses and configurable connection limits and server messages. The excerpts show these responsibilities concentrated in `src/main.py`; they do not expose every handler or the implementation of rate limiting.

Main entry points: [`src/main.py`](https://github.com/goldengr/authserver/blob/main/src/main.py) (Session check), [`src/server.properties`](https://github.com/goldengr/authserver/blob/main/src/server.properties) (Server properties), [`src/logTokens.py`](https://github.com/goldengr/authserver/blob/main/src/logTokens.py) (Token hook)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_login["Login flow"]
  node_protocol["Protocol handling<br/>[main.py]"]
  node_encryption["Encryption exchange<br/>[main.py]"]
  node_auth_check["Session check<br/>[main.py]"]
  node_code_issue["Code issuance<br/>[main.py]"]
  node_code_message["Code message<br/>[main.py]"]
end

subgraph group_server["Server features"]
  node_status["Status response<br/>[main.py]"]
  node_rate_limits["Connection limits<br/>[main.py]"]
  node_factory["Server factory<br/>[main.py]"]
end

subgraph group_config["Configuration"]
  node_properties["Server properties<br/>[server.properties]"]
end

subgraph group_integrations["Integrations"]
  node_token_hook["Token hook<br/>[logTokens.py]"]
  node_backend_store[("Backend database")]
  node_microsoft_auth["Microsoft auth"]
end

node_minecraft_client(("Minecraft client"))

node_minecraft_client -->|"connects to"| node_protocol
node_protocol -->|"handles login"| node_encryption
node_encryption -->|"checks session"| node_auth_check
node_auth_check -->|"requests validation"| node_microsoft_auth
node_auth_check -->|"continues on success"| node_code_issue
node_code_issue -->|"logs token"| node_token_hook
node_token_hook -.->|"persists token"| node_backend_store
node_code_issue -->|"formats code"| node_code_message
node_code_message -->|"sends code"| node_minecraft_client
node_minecraft_client -->|"requests status"| node_status
node_factory -->|"selects protocol"| node_protocol
node_properties -->|"configures server"| node_factory
node_properties -->|"sets limits"| node_rate_limits

click node_protocol "https://github.com/goldengr/authserver/blob/main/src/main.py"
click node_encryption "https://github.com/goldengr/authserver/blob/main/src/main.py"
click node_auth_check "https://github.com/goldengr/authserver/blob/main/src/main.py"
click node_code_issue "https://github.com/goldengr/authserver/blob/main/src/main.py"
click node_code_message "https://github.com/goldengr/authserver/blob/main/src/main.py"
click node_token_hook "https://github.com/goldengr/authserver/blob/main/src/logTokens.py"
click node_status "https://github.com/goldengr/authserver/blob/main/src/main.py"
click node_rate_limits "https://github.com/goldengr/authserver/blob/main/src/main.py"
click node_factory "https://github.com/goldengr/authserver/blob/main/src/main.py"
click node_properties "https://github.com/goldengr/authserver/blob/main/src/server.properties"

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_protocol,node_encryption,node_auth_check,node_code_issue,node_code_message,node_minecraft_client toneBlue
class node_status,node_rate_limits,node_factory toneAmber
class node_properties toneMint
class node_token_hook,node_backend_store,node_microsoft_auth toneRose
```

## Components

### Login flow

- [Protocol handling](https://github.com/goldengr/authserver/blob/main/src/main.py): `src/main.py`
- [Encryption exchange](https://github.com/goldengr/authserver/blob/main/src/main.py): `src/main.py`
- [Session check](https://github.com/goldengr/authserver/blob/main/src/main.py): `src/main.py`
- [Code issuance](https://github.com/goldengr/authserver/blob/main/src/main.py): `src/main.py`
- [Code message](https://github.com/goldengr/authserver/blob/main/src/main.py): `src/main.py`

### Server features

- [Status response](https://github.com/goldengr/authserver/blob/main/src/main.py): `src/main.py`
- [Connection limits](https://github.com/goldengr/authserver/blob/main/src/main.py): `src/main.py`
- [Server factory](https://github.com/goldengr/authserver/blob/main/src/main.py): `src/main.py`

### Configuration

- [Server properties](https://github.com/goldengr/authserver/blob/main/src/server.properties): `src/server.properties`

### Integrations

- [Token hook](https://github.com/goldengr/authserver/blob/main/src/logTokens.py): `src/logTokens.py`
- **Backend database**
- **Microsoft auth**

### Other components

- **Minecraft client**

## Connections

- Minecraft client → Protocol handling: connects to (evidence: `README.md`)
- Protocol handling → Encryption exchange: handles login (evidence: `src/main.py`)
- Encryption exchange → Session check: checks session (evidence: `src/main.py`)
- Session check → Microsoft auth: requests validation (evidence: `src/main.py`)
- Session check → Code issuance: continues on success (evidence: `src/main.py`)
- Code issuance → Token hook: logs token (evidence: `src/main.py`)
- Token hook → Backend database: persists token
- Code issuance → Code message: formats code (evidence: `src/main.py`)
- Code message → Minecraft client: sends code (evidence: `README.md`)
- Minecraft client → Status response: requests status (evidence: `src/main.py`)
- Server factory → Protocol handling: selects protocol (evidence: `src/main.py`)
- Server properties → Server factory: configures server (evidence: `README.md`)
- Server properties → Connection limits: sets limits (evidence: `README.md`)
