Skip to content
Dashboard

Networks by design

View as Markdown

A network should be developed the way a game is: Effect code against the real, generated API, mk dev, save, and the change applies while players stay connected. That covers commands like /lobby, routing between servers, queues, parties and what happens after a kick. And every server and proxy should be reachable for players, at home behind NAT too, without Minekube running anything per server.

This page describes the design. Each part says whether it is built or planned.

An early draft mixed three questions. They have different answers:

Question Answered by Status
How does a player get to a server? The connector, the same in every endpoint, inside the platform’s own process. See Connector, relay and registry. Built, not yet in production
Who holds the session when a server goes away? Whoever is the proxy: Velocity today. Without a proxy, a waiting room in the relay. Velocity built; waiting room planned
Where does programmable code run? The runtime of each platform, with types from its real API. Paper and Velocity built

A Velocity network is then as reachable as a single Paper server; what differs is only which endpoint players enter through.

Every instance has labels, which say what it is, and a status, which says how it is doing.

  • Your labels are free: game=bedwars, stage=lobby, channel=canary.
  • System labels carry a prefix so nothing collides, and Minekube sets them: minekube.com/platform=paper, minekube.com/version=26.3.
  • The instance ID is the key of its connector, not a label. It is for “exactly this instance”.
  • Status is reported continuously: players, free slots, ready.

You select with a LabelSelector as in Kubernetes: matchLabels and matchExpressions with In, NotIn, Exists and DoesNotExist, and the same text form for the CLI (game=bedwars,mode in (solo,duo),!beta). Among the matches, status decides, for example the instance with the most free slots. There is deliberately no shorthand without matchLabels, because a free label key could collide with it, and no annotations: what changes is status.

The same selectors pick everywhere: where a player goes, where a revision goes, what a list shows. Velocity keeps its server names; each name resolves through a selector. This part is built: see Labels and selectors.

Wherever the network does not know where a player should go (a join, a server gone, a kick, the waiting room), it is planned to ask one question, with the reason as a tagged union, and the answer is data:

Answer Means
Route.To(selector) To a matching instance. Whether that happens inside the session (behind a proxy) or by a transfer is the system’s concern. A reconnect is To the same instance.
Route.Hold Hold the player until something happens, with a time limit and a next answer.
Route.Kick(message) Disconnect, with a message.

Because answers are data, a proxy can cache the answers a routing bundle gives for when it cannot reach it, and no separate rule language is needed. Today, network bundles in Velocity handle /lobby and kicks with Velocity’s own events; see Network bundles.

A revision is immutable, content-addressed code assigned to a selector. Every matching instance converges to it, as desired state rather than a push, and an instance started later gets the current revision of its selector by itself. Rolling back is assigning the previous revision; unpublishing ends an assignment. Built: mk publish, mk revisions, --revision and mk unpublish, see Publish to a network. A canary is channel=canary first, then a share, then everyone; shares, waves and updates a game holds until its round ends are planned. Our own features reach operators the same way: an opt-in channel is just a label.

Who may route whom where is not ours to decide. Each network writes its own rules as code; Minekube only guarantees what nobody can build alone:

  1. Identity. Every instance has a key, and the registry says with authority which network it belongs to. Labels grant no rights. Every network is also an OpenID Connect issuer that publishes its members’ keys, so a token an instance signs can be checked anywhere with standard tools, and servers can join with their environment’s own token instead of a code. See Connector, relay and registry.
  2. The network boundary. A connector accepts streams only from Minekube relays and from instances of its own network. This is the one fixed rule; without it, no other rule would be safe. A transfer to a public hostname always works, like a link; whether the target takes the player is the target’s decision.
  3. Verified facts in the question. The routing question carries only what is true: UUID and name after Mojang’s check, the client address from the relay, the hostname the player typed, and where they came from.
  4. An origin that cannot be forged. An instance that sends a player on signs a cookie with its key; the target checks the signature through the registry. Without a valid signature, the origin is empty, never guessed. No central service hands out tickets.
  5. Rejection. Route.Kick wherever the question is asked.
  6. The network’s own state. Lists, bans and invites live in the network’s own storage, next to its routing.

The test of whether these are enough: a whitelist, bans, “only players from the hub”, a partner network that may send players directly, and a fully open server should each be a few lines of routing, with no new function from us. The network boundary is built and tested against the registry; signed origins and the routing question are planned.

Minekube’s own network features, such as routing into the waiting room, the way back after a kick, waking a sleeping server and queues, are planned as Effect bundles against the same public SDKs and runtimes every network gets. They are open, can be changed or replaced, and there is no private path for us. If we miss something, that is a gap in the platform, closed for everyone.

What we roll out ourselves stays off operators’ servers. An operator runs a small, stable core (the connector and the runtime) that negotiates capabilities, so old versions keep working for a long time. Code in an operator’s process changes only when they publish, or opt in to a channel with signed revisions.

Paper only With Velocity
For New networks, also on hosting panels (planned default) Existing networks; anyone who wants Velocity’s API and plugins (built)
A backend crashes Its players are disconnected; new joins wait in the relay’s waiting room Velocity holds the players and network code sends them on
Moving between servers A transfer (clients from 1.20.5 on) through Minekube hostnames Inside the session, no new login
Cost Nothing extra One more JVM (measured)

Velocity is not a requirement. When the same revision goes to every game server, global commands like /lobby are simply part of every revision, and what servers share lives in Durable Objects. A third shape, a slim Minekube proxy in Rust next to servers that outlive it (a VM or Kubernetes, not a hosting panel), is planned: it would hold players through a server restart without disconnecting them.

Was this helpful?