# slotopol/server architecture

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

- Interactive diagram: https://gitdiagram.com/slotopol/server
- Repository: https://github.com/slotopol/server

## Overview

Slotopol is an HTTP slots and keno game server with a companion CLI for game discovery and reel analysis. The main user workflow is to authenticate, select or join a game, submit gameplay actions, and receive results; the service maintains club and user balances and game sessions. Its catalog spans provider-specific slot algorithms and keno variants, with configurable reel sets and RTP analysis. The README documents the database and gameplay model; sampled source confirms key routing, authentication, storage, and scanning links, but not every runtime call path.

Main entry points: [`api/routes.go`](https://github.com/slotopol/server/blob/main/api/routes.go) (HTTP routes), [`core/logic.go`](https://github.com/slotopol/server/blob/main/core/logic.go) (Game session logic), [`core/storage.go`](https://github.com/slotopol/server/blob/main/core/storage.go) (Persistent storage), [`game/linkdata.go`](https://github.com/slotopol/server/blob/main/game/linkdata.go) (Game registry)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_service["HTTP service"]
  node_router["HTTP routes<br/>[routes.go]"]
  node_auth["Authentication<br/>[auth.go]"]
  node_config["Configuration<br/>[config.go]"]
  node_web["Web startup<br/>[web.go]"]
end

subgraph group_domain["Accounts and play"]
  node_clubapi["Club API<br/>[club.go]"]
  node_userapi["User API<br/>[user.go]"]
  node_props["User properties<br/>[props.go]"]
  node_gameapi["Game API<br/>[game.go]"]
  node_slotapi["Slot gameplay API<br/>[slot.go]"]
  node_kenoapi["Keno gameplay API<br/>[keno.go]"]
  node_logic["Game session logic<br/>[logic.go]"]
  node_storage[("Persistent storage<br/>[storage.go]")]
end

subgraph group_games["Game algorithms"]
  node_registry["Game registry<br/>[linkdata.go]"]
  node_linkage["Algorithm registration<br/>[links.go]"]
  node_slotgames["Provider slot rules"]
  node_kenogames["Keno variants"]
end

subgraph group_tools["CLI and analysis"]
  node_list["Game listing<br/>[list.go]"]
  node_scan["RTP scanning<br/>[scan.go]"]
  node_filter["Game filters<br/>[filter.go]"]
end

node_player(("Player"))
node_http(("HTTP client"))

node_http -->|"sends requests"| node_router
node_router -->|"gates routes"| node_auth
node_router -->|"routes game calls"| node_gameapi
node_router -->|"routes slot calls"| node_slotapi
node_router -->|"routes property calls"| node_props
node_router -->|"routes user calls"| node_userapi
node_player -.->|"plays through"| node_http
node_web -->|"serves routes"| node_router
node_web -->|"uses settings"| node_config
node_auth -->|"reads sessions"| node_storage
node_gameapi -.->|"manages sessions"| node_logic
node_slotapi -.->|"runs gameplay"| node_logic
node_kenoapi -.->|"runs gameplay"| node_logic
node_logic -->|"uses game metadata"| node_registry
node_logic -->|"persists changes"| node_storage
node_clubapi -.->|"manages club data"| node_storage
node_userapi -.->|"manages users"| node_storage
node_props -->|"accesses properties"| node_storage
node_linkage -->|"registers algorithms"| node_slotgames
node_linkage -->|"registers variants"| node_kenogames
node_linkage -->|"populates catalog"| node_registry
node_slotapi -->|"runs slot rules"| node_slotgames
node_kenoapi -.->|"runs keno rules"| node_kenogames
node_list -->|"lists games"| node_registry
node_list -->|"applies filters"| node_filter
node_scan -->|"selects game"| node_registry
node_scan -.->|"scans reels"| node_slotgames
node_scan -.->|"analyzes keno"| node_kenogames

click node_router "https://github.com/slotopol/server/blob/main/api/routes.go"
click node_auth "https://github.com/slotopol/server/blob/main/api/auth.go"
click node_config "https://github.com/slotopol/server/blob/main/config/config.go"
click node_web "https://github.com/slotopol/server/blob/main/cmd/web.go"
click node_clubapi "https://github.com/slotopol/server/blob/main/api/club.go"
click node_userapi "https://github.com/slotopol/server/blob/main/api/user.go"
click node_props "https://github.com/slotopol/server/blob/main/api/props.go"
click node_gameapi "https://github.com/slotopol/server/blob/main/api/game.go"
click node_slotapi "https://github.com/slotopol/server/blob/main/api/slot.go"
click node_kenoapi "https://github.com/slotopol/server/blob/main/api/keno.go"
click node_logic "https://github.com/slotopol/server/blob/main/core/logic.go"
click node_storage "https://github.com/slotopol/server/blob/main/core/storage.go"
click node_registry "https://github.com/slotopol/server/blob/main/game/linkdata.go"
click node_linkage "https://github.com/slotopol/server/blob/main/core/links.go"
click node_slotgames "https://github.com/slotopol/server/tree/main/game/slot"
click node_kenogames "https://github.com/slotopol/server/tree/main/game/keno"
click node_list "https://github.com/slotopol/server/blob/main/cmd/list.go"
click node_scan "https://github.com/slotopol/server/blob/main/cmd/scan.go"
click node_filter "https://github.com/slotopol/server/blob/main/game/filter.go"

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_router,node_auth,node_config,node_web,node_http toneBlue
class node_clubapi,node_userapi,node_props,node_gameapi,node_slotapi,node_kenoapi,node_logic,node_storage toneAmber
class node_registry,node_linkage,node_slotgames,node_kenogames toneMint
class node_list,node_scan,node_filter toneRose
class node_player toneIndigo
```

## Components

### HTTP service

- [HTTP routes](https://github.com/slotopol/server/blob/main/api/routes.go): `api/routes.go`
- [Authentication](https://github.com/slotopol/server/blob/main/api/auth.go): `api/auth.go`
- [Configuration](https://github.com/slotopol/server/blob/main/config/config.go): `config/config.go`
- [Web startup](https://github.com/slotopol/server/blob/main/cmd/web.go): `cmd/web.go`

### Accounts and play

- [Club API](https://github.com/slotopol/server/blob/main/api/club.go): `api/club.go`
- [User API](https://github.com/slotopol/server/blob/main/api/user.go): `api/user.go`
- [User properties](https://github.com/slotopol/server/blob/main/api/props.go): `api/props.go`
- [Game API](https://github.com/slotopol/server/blob/main/api/game.go): `api/game.go`
- [Slot gameplay API](https://github.com/slotopol/server/blob/main/api/slot.go): `api/slot.go`
- [Keno gameplay API](https://github.com/slotopol/server/blob/main/api/keno.go): `api/keno.go`
- [Game session logic](https://github.com/slotopol/server/blob/main/core/logic.go): `core/logic.go`
- [Persistent storage](https://github.com/slotopol/server/blob/main/core/storage.go): `core/storage.go`

### Game algorithms

- [Game registry](https://github.com/slotopol/server/blob/main/game/linkdata.go): `game/linkdata.go`
- [Algorithm registration](https://github.com/slotopol/server/blob/main/core/links.go): `core/links.go`
- [Provider slot rules](https://github.com/slotopol/server/tree/main/game/slot): `game/slot`
- [Keno variants](https://github.com/slotopol/server/tree/main/game/keno): `game/keno`

### CLI and analysis

- [Game listing](https://github.com/slotopol/server/blob/main/cmd/list.go): `cmd/list.go`
- [RTP scanning](https://github.com/slotopol/server/blob/main/cmd/scan.go): `cmd/scan.go`
- [Game filters](https://github.com/slotopol/server/blob/main/game/filter.go): `game/filter.go`

### Other components

- **Player**
- **HTTP client**

## Connections

- HTTP client → HTTP routes: sends requests (evidence: `api/routes.go`)
- HTTP routes → Authentication: gates routes (evidence: `api/routes.go`)
- HTTP routes → Game API: routes game calls (evidence: `api/routes.go`)
- HTTP routes → Slot gameplay API: routes slot calls (evidence: `api/routes.go`)
- HTTP routes → User properties: routes property calls (evidence: `api/routes.go`)
- HTTP routes → User API: routes user calls (evidence: `api/routes.go`)
- Player → HTTP client: plays through
- Web startup → HTTP routes: serves routes (evidence: `cmd/web.go`)
- Web startup → Configuration: uses settings (evidence: `cmd/web.go`)
- Authentication → Persistent storage: reads sessions (evidence: `api/auth.go`)
- Game API → Game session logic: manages sessions
- Slot gameplay API → Game session logic: runs gameplay
- Keno gameplay API → Game session logic: runs gameplay
- Game session logic → Game registry: uses game metadata (evidence: `core/logic.go`)
- Game session logic → Persistent storage: persists changes
- Club API → Persistent storage: manages club data
- User API → Persistent storage: manages users
- User properties → Persistent storage: accesses properties (evidence: `api/props.go`)
- Algorithm registration → Provider slot rules: registers algorithms (evidence: `core/links.go`)
- Algorithm registration → Keno variants: registers variants (evidence: `core/links.go`)
- Algorithm registration → Game registry: populates catalog (evidence: `core/links.go`)
- Slot gameplay API → Provider slot rules: runs slot rules (evidence: `api/slot.go`)
- Keno gameplay API → Keno variants: runs keno rules
- Game listing → Game registry: lists games (evidence: `cmd/list.go`)
- Game listing → Game filters: applies filters (evidence: `cmd/list.go`)
- RTP scanning → Game registry: selects game (evidence: `cmd/scan.go`)
- RTP scanning → Provider slot rules: scans reels
- RTP scanning → Keno variants: analyzes keno
