# attorneyonline/akashi architecture

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

- Interactive diagram: https://gitdiagram.com/attorneyonline/akashi
- Repository: https://github.com/attorneyonline/akashi

## Overview

Akashi is a C++ Attorney Online 2 server. Clients connect over WebSockets; the server creates per-client sessions, handles game-protocol packets and commands, and coordinates area activity, moderation, and shared services. The graph preserves the major runtime domains visible in the tree, including music, authentication and bans, logging, and server advertising. Some wiring is supported only by class documentation or partial excerpts, so uncertain connections are omitted; optional Discord integration is shown separately.

Main entry points: [`src/aoclient.cpp`](https://github.com/attorneyonline/akashi/blob/master/src/aoclient.cpp) (Client session), [`src/server.cpp`](https://github.com/attorneyonline/akashi/blob/master/src/server.cpp) (Server), [`src/commands`](https://github.com/attorneyonline/akashi/tree/master/src/commands) (Game commands), [`src/packet/packet_ms.cpp`](https://github.com/attorneyonline/akashi/blob/master/src/packet/packet_ms.cpp) (IC messaging)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_transport["Connections and protocol"]
  node_server["Server<br/>[server.cpp]"]
  node_socket["Network socket<br/>[network_socket.cpp]"]
  node_client_session["Client session<br/>[aoclient.cpp]"]
  node_packet_codec["Packet codec<br/>[aopacket.cpp]"]
  node_packet_factory["Packet factory<br/>[packet_factory.cpp]"]
end

subgraph group_gameplay["Gameplay and commands"]
  node_areas["Area state<br/>[area_data.cpp]"]
  node_commands["Game commands"]
  node_messaging["IC messaging<br/>[packet_ms.cpp]"]
  node_testimony["Testimony recording"]
  node_music["Area music<br/>[music_manager.cpp]"]
end

subgraph group_admin["Administration and state"]
  node_config["Configuration<br/>[config_manager.cpp]"]
  node_acl["ACL roles"]
  node_database[("User and ban DB<br/>[db_manager.cpp]")]
  node_parser["Medieval parser"]
end

subgraph group_services["Server services"]
  node_logger["Logging<br/>[u_logger.cpp]"]
  node_publisher["Server publisher"]
  node_discord["Discord integration<br/>[discord.cpp]"]
end

node_players(("AO clients"))
node_discord_service(("Discord"))

node_players -->|"connects to"| node_server
node_server -->|"creates sessions"| node_client_session
node_client_session -->|"dispatches packets"| node_packet_factory
node_packet_factory -->|"creates packets"| node_packet_codec
node_client_session -->|"uses area state"| node_areas
node_client_session -->|"handles commands"| node_commands
node_client_session -->|"authenticates users"| node_database
node_client_session -->|"checks permissions"| node_acl
node_client_session -->|"handles messages"| node_messaging
node_messaging -->|"checks area rules"| node_areas
node_messaging -->|"updates statements"| node_testimony
node_server -->|"creates manager"| node_database
node_server -->|"creates parser"| node_parser
node_server -->|"creates publisher"| node_publisher
node_commands -->|"manages accounts"| node_database
node_commands -->|"manages roles"| node_acl
node_music -->|"creates music packets"| node_packet_factory
node_discord -.->|"integrates with"| node_discord_service
node_server -->|"logs activity"| node_logger
node_config -->|"provides settings"| node_server

click node_server "https://github.com/attorneyonline/akashi/blob/master/src/server.cpp"
click node_socket "https://github.com/attorneyonline/akashi/blob/master/src/network/network_socket.cpp"
click node_client_session "https://github.com/attorneyonline/akashi/blob/master/src/aoclient.cpp"
click node_packet_codec "https://github.com/attorneyonline/akashi/blob/master/src/network/aopacket.cpp"
click node_packet_factory "https://github.com/attorneyonline/akashi/blob/master/src/packet/packet_factory.cpp"
click node_areas "https://github.com/attorneyonline/akashi/blob/master/src/area_data.cpp"
click node_commands "https://github.com/attorneyonline/akashi/tree/master/src/commands"
click node_messaging "https://github.com/attorneyonline/akashi/blob/master/src/packet/packet_ms.cpp"
click node_testimony "https://github.com/attorneyonline/akashi/blob/master/src/testimony_recorder.cpp"
click node_music "https://github.com/attorneyonline/akashi/blob/master/src/music_manager.cpp"
click node_config "https://github.com/attorneyonline/akashi/blob/master/src/config_manager.cpp"
click node_acl "https://github.com/attorneyonline/akashi/blob/master/src/acl_roles_handler.cpp"
click node_database "https://github.com/attorneyonline/akashi/blob/master/src/db_manager.cpp"
click node_parser "https://github.com/attorneyonline/akashi/blob/master/src/medieval_parser.cpp"
click node_logger "https://github.com/attorneyonline/akashi/blob/master/src/logger/u_logger.cpp"
click node_publisher "https://github.com/attorneyonline/akashi/blob/master/src/serverpublisher.cpp"
click node_discord "https://github.com/attorneyonline/akashi/blob/master/src/discord.cpp"

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_server,node_socket,node_client_session,node_packet_codec,node_packet_factory,node_players toneBlue
class node_areas,node_commands,node_messaging,node_testimony,node_music toneAmber
class node_config,node_acl,node_database,node_parser toneMint
class node_logger,node_publisher,node_discord toneRose
class node_discord_service toneIndigo
```

## Components

### Connections and protocol

- [Server](https://github.com/attorneyonline/akashi/blob/master/src/server.cpp): `src/server.cpp`
- [Network socket](https://github.com/attorneyonline/akashi/blob/master/src/network/network_socket.cpp): `src/network/network_socket.cpp`
- [Client session](https://github.com/attorneyonline/akashi/blob/master/src/aoclient.cpp): `src/aoclient.cpp`
- [Packet codec](https://github.com/attorneyonline/akashi/blob/master/src/network/aopacket.cpp): `src/network/aopacket.cpp`
- [Packet factory](https://github.com/attorneyonline/akashi/blob/master/src/packet/packet_factory.cpp): `src/packet/packet_factory.cpp`

### Gameplay and commands

- [Area state](https://github.com/attorneyonline/akashi/blob/master/src/area_data.cpp): `src/area_data.cpp`
- [Game commands](https://github.com/attorneyonline/akashi/tree/master/src/commands): `src/commands`
- [IC messaging](https://github.com/attorneyonline/akashi/blob/master/src/packet/packet_ms.cpp): `src/packet/packet_ms.cpp`
- [Testimony recording](https://github.com/attorneyonline/akashi/blob/master/src/testimony_recorder.cpp): `src/testimony_recorder.cpp`
- [Area music](https://github.com/attorneyonline/akashi/blob/master/src/music_manager.cpp): `src/music_manager.cpp`

### Administration and state

- [Configuration](https://github.com/attorneyonline/akashi/blob/master/src/config_manager.cpp): `src/config_manager.cpp`
- [ACL roles](https://github.com/attorneyonline/akashi/blob/master/src/acl_roles_handler.cpp): `src/acl_roles_handler.cpp`
- [User and ban DB](https://github.com/attorneyonline/akashi/blob/master/src/db_manager.cpp): `src/db_manager.cpp`
- [Medieval parser](https://github.com/attorneyonline/akashi/blob/master/src/medieval_parser.cpp): `src/medieval_parser.cpp`

### Server services

- [Logging](https://github.com/attorneyonline/akashi/blob/master/src/logger/u_logger.cpp): `src/logger/u_logger.cpp`
- [Server publisher](https://github.com/attorneyonline/akashi/blob/master/src/serverpublisher.cpp): `src/serverpublisher.cpp`
- [Discord integration](https://github.com/attorneyonline/akashi/blob/master/src/discord.cpp): `src/discord.cpp`

### Other components

- **AO clients**
- **Discord**

## Connections

- AO clients → Server: connects to
- Server → Client session: creates sessions
- Client session → Packet factory: dispatches packets
- Packet factory → Packet codec: creates packets
- Client session → Area state: uses area state
- Client session → Game commands: handles commands
- Client session → User and ban DB: authenticates users
- Client session → ACL roles: checks permissions
- Client session → IC messaging: handles messages
- IC messaging → Area state: checks area rules
- IC messaging → Testimony recording: updates statements
- Server → User and ban DB: creates manager
- Server → Medieval parser: creates parser
- Server → Server publisher: creates publisher
- Game commands → User and ban DB: manages accounts
- Game commands → ACL roles: manages roles
- Area music → Packet factory: creates music packets
- Discord integration → Discord: integrates with
- Server → Logging: logs activity
- Configuration → Server: provides settings
