Overview
Minestom follows a modular architecture built around a centralMinecraftServer class and a ServerProcess interface that coordinates all major server subsystems. Unlike traditional Minecraft server implementations, Minestom is designed from the ground up for flexibility, performance, and thread-safety.
Server Initialization
The server initialization process follows a two-step pattern:Main.java
All server configuration (dimensions, biomes, commands, events) must be registered between
init() and start(). Once the server starts, some configurations cannot be changed.Initialization Steps
TheMinecraftServer.init() method performs the following:
- Creates ServerProcess - Initializes the core server process with authentication settings
- Registers Managers - Sets up all major subsystems (see below)
- Initializes Registries - Loads dynamic registries for dimensions, biomes, etc.
- Returns MinecraftServer - Returns the configured server instance
Starting the Server
When you callstart(), the server:
- Starts the network server - Binds to the specified address/port
- Starts the thread dispatcher - Initializes tick threads for chunks and entities
- Starts the tick scheduler - Begins the main server tick loop at 20 TPS (configurable)
MinecraftServer.java:350-354
Core Managers
TheServerProcess interface exposes all major server subsystems through manager classes. Each manager handles a specific aspect of server functionality:
InstanceManager
Manages all world instances (what Minecraft calls “worlds”)
ConnectionManager
Handles player connections and network sessions
CommandManager
Registers and dispatches command execution
EventHandler
Global event system for listening to server events
BlockManager
Registers block handlers and placement rules
SchedulerManager
Schedules tasks to run at specific intervals
RecipeManager
Manages crafting recipes sent to clients
TeamManager
Handles scoreboard teams
Accessing Managers
All managers are accessible through static methods onMinecraftServer:
ServerProcess Interface
TheServerProcess interface is the heart of Minestom’s architecture. It provides:
Key Responsibilities
- Lifecycle Management - Controls server startup and shutdown
- Manager Access - Provides access to all subsystem managers
- Threading - Manages the thread dispatcher and ticker
- Registry Access - Exposes dynamic registries for game data
ServerProcess.java:30-135
Configuration via ServerFlags
Minestom uses system properties (viaServerFlag) for low-level configuration:
ServerFlag.java:15-20
Common Server Flags
| Flag | Default | Description |
|---|---|---|
minestom.tps | 20 | Server ticks per second |
minestom.chunk-view-distance | 8 | Default chunk view distance |
minestom.entity-view-distance | 5 | Default entity view distance |
minestom.dispatcher-threads | 1 | Number of tick threads |
Authentication
Minestom supports both online and offline mode authentication:Main.java:45
Online mode requires players to authenticate with Mojang’s servers. Offline mode allows any player to join with any username.
Complete Initialization Example
Here’s a complete example from the demo project:Main.java:41-175
Shutdown
To cleanly shutdown the server:- Kick all players with a disconnect message
- Save all instances (if chunk loaders are configured)
- Stop all tick threads
- Close network connections
Next Steps
Instances
Learn about the instance system and world management
Threading
Understand Minestom’s multi-threaded tick system
Events
Master the event system for handling game events
