Skip to content

architecture

Antoine edited this page Nov 1, 2025 · 11 revisions

Architecture diagram

Communication drawio

File structure diagram

File structure drawio

Classes

Global

Core

The core is the entry point of the program. It will create the bus, and regarding the configuration, will start some user interface and/or Minecraft server modules. It will also start the bus dispatcher. It has it's own bus interface to be able to respond to events from the bus and trigger events to the bus.

Config (File)

A json file telling witch modules to load, as well as necessary parameters for the bus and the application. Also define which user interface to start. Provde the path for loading the server configuration file and the user database file.

See the documentation of the config module for more information on what can be configured.

{
    "app_data_path" : "/var/minecraft", // the path to the application data directory, should be used as a base path for others elements
    "minecraft_servers_dirs" : [ // list of directories where it is allowed to create Minecraft servers
        "${app_data_path}/servers"
    ],
    "server_config_path" : "${app_data_path}/servers.json", // the path to the server configuration file, containing data about each server
    "client_database_path" : "${app_data_path}/client.db", // the path to the user database file, containing data about each user
    "user_interface_modules" : { // dictionary of user interface modules to load, the key is the module type
        "web" : {
            "name" : "Web Server", // the name of the module, used for display
            "enabled" : true,     // if true, the module will be loaded, it is ignored if false
            "port" : 5000        // the port to use for the web server
        },
        "tk_window" : {
            "name" : "Tkinter Window", // the name of the module, used for display
            "enabled" : false         // if true, the module will be loaded, it is ignored if false
        }
    },
    "bus" : { // settings for the bus, it is not recommended to change these values
        "memory_size" : 8, // the size of the shared memory list, in nb of elements
        "max_string_length" : 8192 // the maximum length of a string in the shared memory list, in bytes
    }
}

Server config (File)

A json configuration file containing data relatives to each server.

Common data:

name type default value comment
type string n/a the type of the server, like forge, fabric, vanilla, etc.
path string n/a the path to the server directory
created_at string n/a the date of creation, in ISO format
autostart bool false if true, the server will be started at the beginning of the program
ram int 1024 the amount of ram to allocate to the server
mc_version string n/a the version of minecraft of the server
modloader_version string null the version of the modloader to use, null if not applicable

Bus

The bus will connect the user interface ,Minecraft servers interfaces and the core.
It allow to register callback on a event, and trigger events. Arguments of callback are defined by the event. Internally, it use multiple shared memory lists to communoicates between the different components. This architecture allow to have multiple user interface and multiple servers simultaneously.

Bus (Class)

This class is an interface to the bus. each process or thread that want to communicate with the bus will create an instance of this class.

BusDispatcher

Will handle the events between the different components of the bus (i.e. each process or thread that use the bus).

User Interface

BaseInterface

A abstract class that define the interface with the bus for the user interface.

User Database (File)

The user database is a sqlite database that store the user data. It contain two tables:

users

name type default value comment
username string n/a the username of the user
password string n/a the password of the user, encrypted
access_level int 0 the access level of the user
registered_at integer strftime('%s', 'now') the date of registration, in seconds since epoch
last_login integer strftime('%s', 'now') the date of last login, in seconds since epoch

access_tokens

name type default value comment
username string n/a the username of the user, foreign key to users
token string n/a the token of the user (unique)
expiration integer n/a the expiration date of the token, in seconds since epoch
remember bool false if true, a new token will be generated periodically to keep the session alive

WebServer

A class that is a web server. It will server a website through a Flask server. Also contain a websocket server to communicate with each client. Implementation of BaseInterface

TkInterface

Not implemented yet

Minecraft

BaseMcServer

A abstract class that define the interface with the bus for the Minecraft server.

MinecraftServer

A class that allow communication with a Minecraft server. It will use the Minecraft server jar to start the server Implementation of BaseMcServer

ForgeServer

A class that allow communication with a Forge server. It will use the Forge server jar to start the server Implementation of BaseMcServer through MinecraftServer

FabricServer

Not implemented yet