# stiledevs/growserver architecture

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

- Interactive diagram: https://gitdiagram.com/stiledevs/growserver
- Repository: https://github.com/stiledevs/growserver

## Overview

GrowServer is a Growtopia private server: the client connects through the login and game services, authenticates and enters a world, then exchanges packets for gameplay; the server persists accounts, players, sessions and worlds. Operators can also control the running server from its console. The graph preserves major gameplay systems and the HTTP services documented in the README. Edges use README statements or shown source references; several subsystems are represented at their exact directories because their implementation was not sampled.

Main entry points: [`src/index.ts`](https://github.com/stiledevs/growserver/blob/main/src/index.ts) (Runtime Startup), [`src/game/index.ts`](https://github.com/stiledevs/growserver/blob/main/src/game/index.ts) (Game Runtime), [`src/game/player/index.ts`](https://github.com/stiledevs/growserver/blob/main/src/game/player/index.ts) (Player Session), [`src/game/world/world-manager.ts`](https://github.com/stiledevs/growserver/blob/main/src/game/world/world-manager.ts) (World Manager)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Entry and Services"]
  node_https["HTTPS Service<br/>[https-server.ts]"]
  node_login["Login Service<br/>[login-server.ts]"]
  node_cdn["CDN Service<br/>[cdn-server.ts]"]
  node_runtime_entry["Runtime Startup<br/>[index.ts]"]
end

subgraph group_runtime["Game Runtime"]
  node_game["Game Runtime<br/>[index.ts]"]
  node_server_manager["Server Manager<br/>[server-manager.ts]"]
  node_game_server["Game Server<br/>[game-server.ts]"]
  node_player["Player Session<br/>[index.ts]"]
  node_console["Admin Console<br/>[console.ts]"]
  node_commands["Console Commands<br/>[game-commands.ts]"]
end

subgraph group_worlds["Worlds and Gameplay"]
  node_world_manager["World Manager<br/>[world-manager.ts]"]
  node_world["World State<br/>[world.ts]"]
  node_quests["Quests<br/>[role-quests.ts]"]
  node_fishing["Fishing<br/>[fishing-manager.ts]"]
  node_cooking["Cooking<br/>[cooking-manager.ts]"]
  node_geiger["Geiger<br/>[geiger-manager.ts]"]
  node_surgery["Surgery<br/>[surgery-manager.ts]"]
end

subgraph group_persistence["Persistence"]
  node_database[("Database<br/>[db.ts]")]
  node_player_db["Player Storage<br/>[player-db.ts]"]
  node_world_db["World Storage<br/>[world-db.ts]"]
end

subgraph group_protocol["Protocol and Items"]
  node_network["Message Handlers"]
  node_packets["Packet Encoding<br/>[game-packet.ts]"]
  node_variants["Variant Protocol<br/>[variants.ts]"]
  node_items["Item Definitions<br/>[item-utils.ts]"]
end

node_client(("Game Client"))
node_operator(("Operator"))

node_client -->|"requests server data"| node_https
node_client -->|"registers account"| node_login
node_runtime_entry -->|"starts"| node_https
node_runtime_entry -->|"starts"| node_login
node_runtime_entry -->|"starts"| node_cdn
node_runtime_entry -->|"starts"| node_game
node_game -->|"uses"| node_server_manager
node_game -->|"uses"| node_world_manager
node_game -->|"starts"| node_console
node_server_manager -->|"creates"| node_game_server
node_server_manager -->|"tracks"| node_player
node_console -->|"dispatches"| node_commands
node_operator -->|"issues commands"| node_console
node_player -->|"loads world"| node_world_manager
node_world_manager -->|"reads and writes"| node_world_db
node_world_manager -->|"loads and saves"| node_world
node_network -->|"handles messages for"| node_player
node_network -->|"dispatches"| node_variants
node_player -->|"loads player data"| node_player_db
node_login -->|"uses database services"| node_database
node_database -->|"provides storage"| node_player_db
node_fishing -->|"looks up items"| node_items
node_fishing -->|"awards role XP"| node_quests
node_cooking -->|"uses fishing"| node_fishing
node_cooking -->|"uses item data"| node_items
node_geiger -->|"updates quests"| node_quests
node_geiger -->|"uses world state"| node_world
node_surgery -->|"updates quests"| node_quests
node_surgery -->|"uses world state"| node_world
node_variants -->|"encodes updates"| node_packets
node_world -->|"encodes updates"| node_packets

click node_https "https://github.com/stiledevs/growserver/blob/main/src/services/https-server.ts"
click node_login "https://github.com/stiledevs/growserver/blob/main/src/services/login-server.ts"
click node_cdn "https://github.com/stiledevs/growserver/blob/main/src/services/cdn-server.ts"
click node_runtime_entry "https://github.com/stiledevs/growserver/blob/main/src/index.ts"
click node_game "https://github.com/stiledevs/growserver/blob/main/src/game/index.ts"
click node_server_manager "https://github.com/stiledevs/growserver/blob/main/src/game/server/server-manager.ts"
click node_game_server "https://github.com/stiledevs/growserver/blob/main/src/game/server/game-server.ts"
click node_player "https://github.com/stiledevs/growserver/blob/main/src/game/player/index.ts"
click node_console "https://github.com/stiledevs/growserver/blob/main/src/cli/console.ts"
click node_commands "https://github.com/stiledevs/growserver/blob/main/src/cli/game-commands.ts"
click node_world_manager "https://github.com/stiledevs/growserver/blob/main/src/game/world/world-manager.ts"
click node_world "https://github.com/stiledevs/growserver/blob/main/src/game/world/world.ts"
click node_quests "https://github.com/stiledevs/growserver/blob/main/src/game/quests/role-quests.ts"
click node_fishing "https://github.com/stiledevs/growserver/blob/main/src/game/fishing/fishing-manager.ts"
click node_cooking "https://github.com/stiledevs/growserver/blob/main/src/game/cooking/cooking-manager.ts"
click node_geiger "https://github.com/stiledevs/growserver/blob/main/src/game/geiger/geiger-manager.ts"
click node_surgery "https://github.com/stiledevs/growserver/blob/main/src/game/surgery/surgery-manager.ts"
click node_network "https://github.com/stiledevs/growserver/blob/main/src/game/network/game-message-handler.ts"
click node_packets "https://github.com/stiledevs/growserver/blob/main/src/game/packets/game-packet.ts"
click node_variants "https://github.com/stiledevs/growserver/blob/main/src/game/packets/variants.ts"
click node_items "https://github.com/stiledevs/growserver/blob/main/src/game/item/item-utils.ts"
click node_database "https://github.com/stiledevs/growserver/blob/main/src/database/db.ts"
click node_player_db "https://github.com/stiledevs/growserver/blob/main/src/database/services/player-db.ts"
click node_world_db "https://github.com/stiledevs/growserver/blob/main/src/database/services/world-db.ts"

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_https,node_login,node_cdn,node_runtime_entry,node_client toneBlue
class node_game,node_server_manager,node_game_server,node_player,node_console,node_commands toneAmber
class node_world_manager,node_world,node_quests,node_fishing,node_cooking,node_geiger,node_surgery toneMint
class node_database,node_player_db,node_world_db toneRose
class node_network,node_packets,node_variants,node_items,node_operator toneIndigo
```

## Components

### Entry and Services

- [HTTPS Service](https://github.com/stiledevs/growserver/blob/main/src/services/https-server.ts): `src/services/https-server.ts`
- [Login Service](https://github.com/stiledevs/growserver/blob/main/src/services/login-server.ts): `src/services/login-server.ts`
- [CDN Service](https://github.com/stiledevs/growserver/blob/main/src/services/cdn-server.ts): `src/services/cdn-server.ts`
- [Runtime Startup](https://github.com/stiledevs/growserver/blob/main/src/index.ts): `src/index.ts`

### Game Runtime

- [Game Runtime](https://github.com/stiledevs/growserver/blob/main/src/game/index.ts): `src/game/index.ts`
- [Server Manager](https://github.com/stiledevs/growserver/blob/main/src/game/server/server-manager.ts): `src/game/server/server-manager.ts`
- [Game Server](https://github.com/stiledevs/growserver/blob/main/src/game/server/game-server.ts): `src/game/server/game-server.ts`
- [Player Session](https://github.com/stiledevs/growserver/blob/main/src/game/player/index.ts): `src/game/player/index.ts`
- [Admin Console](https://github.com/stiledevs/growserver/blob/main/src/cli/console.ts): `src/cli/console.ts`
- [Console Commands](https://github.com/stiledevs/growserver/blob/main/src/cli/game-commands.ts): `src/cli/game-commands.ts`

### Worlds and Gameplay

- [World Manager](https://github.com/stiledevs/growserver/blob/main/src/game/world/world-manager.ts): `src/game/world/world-manager.ts`
- [World State](https://github.com/stiledevs/growserver/blob/main/src/game/world/world.ts): `src/game/world/world.ts`
- [Quests](https://github.com/stiledevs/growserver/blob/main/src/game/quests/role-quests.ts): `src/game/quests/role-quests.ts`
- [Fishing](https://github.com/stiledevs/growserver/blob/main/src/game/fishing/fishing-manager.ts): `src/game/fishing/fishing-manager.ts`
- [Cooking](https://github.com/stiledevs/growserver/blob/main/src/game/cooking/cooking-manager.ts): `src/game/cooking/cooking-manager.ts`
- [Geiger](https://github.com/stiledevs/growserver/blob/main/src/game/geiger/geiger-manager.ts): `src/game/geiger/geiger-manager.ts`
- [Surgery](https://github.com/stiledevs/growserver/blob/main/src/game/surgery/surgery-manager.ts): `src/game/surgery/surgery-manager.ts`

### Persistence

- [Database](https://github.com/stiledevs/growserver/blob/main/src/database/db.ts): `src/database/db.ts`
- [Player Storage](https://github.com/stiledevs/growserver/blob/main/src/database/services/player-db.ts): `src/database/services/player-db.ts`
- [World Storage](https://github.com/stiledevs/growserver/blob/main/src/database/services/world-db.ts): `src/database/services/world-db.ts`

### Protocol and Items

- [Message Handlers](https://github.com/stiledevs/growserver/blob/main/src/game/network/game-message-handler.ts): `src/game/network/game-message-handler.ts`
- [Packet Encoding](https://github.com/stiledevs/growserver/blob/main/src/game/packets/game-packet.ts): `src/game/packets/game-packet.ts`
- [Variant Protocol](https://github.com/stiledevs/growserver/blob/main/src/game/packets/variants.ts): `src/game/packets/variants.ts`
- [Item Definitions](https://github.com/stiledevs/growserver/blob/main/src/game/item/item-utils.ts): `src/game/item/item-utils.ts`

### Other components

- **Game Client**
- **Operator**

## Connections

- Game Client → HTTPS Service: requests server data (evidence: `README.md`)
- Game Client → Login Service: registers account (evidence: `README.md`)
- Runtime Startup → HTTPS Service: starts (evidence: `src/index.ts`)
- Runtime Startup → Login Service: starts (evidence: `src/index.ts`)
- Runtime Startup → CDN Service: starts (evidence: `src/index.ts`)
- Runtime Startup → Game Runtime: starts (evidence: `src/index.ts`)
- Game Runtime → Server Manager: uses (evidence: `src/game/index.ts`)
- Game Runtime → World Manager: uses (evidence: `src/game/index.ts`)
- Game Runtime → Admin Console: starts (evidence: `src/game/index.ts`)
- Server Manager → Game Server: creates (evidence: `src/game/server/server-manager.ts`)
- Server Manager → Player Session: tracks (evidence: `src/game/server/server-manager.ts`)
- Admin Console → Console Commands: dispatches (evidence: `src/cli/game-commands.ts`)
- Operator → Admin Console: issues commands (evidence: `README.md`)
- Player Session → World Manager: loads world (evidence: `src/game/player/index.ts`)
- World Manager → World Storage: reads and writes (evidence: `src/game/world/world-manager.ts`)
- World Manager → World State: loads and saves (evidence: `src/game/world/world-manager.ts`)
- Message Handlers → Player Session: handles messages for (evidence: `src/game/network/game-message-handler.ts`)
- Message Handlers → Variant Protocol: dispatches (evidence: `src/game/network/game-message-handler.ts`)
- Player Session → Player Storage: loads player data (evidence: `src/game/player/index.ts`)
- Login Service → Database: uses database services (evidence: `src/services/login-server.ts`)
- Database → Player Storage: provides storage (evidence: `src/database/db.ts`)
- Fishing → Item Definitions: looks up items (evidence: `src/game/fishing/fishing-manager.ts`)
- Fishing → Quests: awards role XP (evidence: `src/game/fishing/fishing-manager.ts`)
- Cooking → Fishing: uses fishing (evidence: `src/game/cooking/cooking-manager.ts`)
- Cooking → Item Definitions: uses item data (evidence: `src/game/cooking/cooking-manager.ts`)
- Geiger → Quests: updates quests (evidence: `src/game/geiger/geiger-manager.ts`)
- Geiger → World State: uses world state (evidence: `src/game/geiger/geiger-manager.ts`)
- Surgery → Quests: updates quests (evidence: `src/game/surgery/surgery-manager.ts`)
- Surgery → World State: uses world state (evidence: `src/game/surgery/surgery-manager.ts`)
- Variant Protocol → Packet Encoding: encodes updates (evidence: `src/game/packets/variants.ts`)
- World State → Packet Encoding: encodes updates (evidence: `src/game/world/world.ts`)
