Skip to content
Get started

Decisions

View as Markdown

What we chose, what we chose it over, and why. Where a decision is about something not built yet, it says so.

The server’s real API over a contract layer. The first version translated every Paper call into its own JSON over an OpenAPI contract. Every new type and feature needed new code on the JVM, events could not be cancelled in their tick, and Java interfaces could not be implemented. A contract layer forces feature code into the layer, so games now call the API directly. More.

No feature code on the JVM. The runtime holds only mechanism: hosting JS, loading and swapping bundles, owning listeners and tasks, keeping JS on the server thread. A new game, event, menu or command changes nothing there. When something is missing, it is a gap in the runtime, closed once for every game.

A runtime per platform over one API for all. A shared layer over Paper, Velocity and the client would have to rename and project, and lose what makes each platform worth using. Each platform keeps its own API, generated from its own jars. More.

Code in the server process over code across the network. A handler inside Paper’s dispatch runs in the same tick with no network in between, so it can cancel the event. Running the same code remotely is planned as another Layer of the same service, not as a different game.

GraalVM’s JIT over interpreting. GraalJS on a standard JDK only interprets. On a GraalVM JDK the Truffle JIT compiles game code, so servers that run games should use one.

Effect through the generated types over Effect around every call. Wrapping every Java call would cost a yield* on every getter of more than 2,500 Paper classes, on the server thread, for calls that cannot fail in an expected way. The types instead mark the calls that declare checked exceptions or hand over something to close, and only Jvm.attempt and Jvm.acquire get through. More.

Generated data over generated code. An early generator wrote TypeScript logic as strings inside the Kotlin generator. Now it writes only Schemas and a table of conversions, and the conversion code is ordinary, typed SDK code.

Types generated on each machine over types in a package. The Paper and Velocity types carry names from code we do not own, so no package ships them. Each runtime writes the types of its own server when it starts, again only when the jars or the runtime change, and mk dev . copies them into the project. They always match the server you run. More

A revision named by its content over a file’s modification time. Comparing modification times restarted a game, and announced it to every player, whenever a tool rewrote the same bundle, many times a second in one case. A content hash reloads only on a real change.

Starting a failed game over from init over leaving it dead. A failed Effect UI root unmounts for good, so one bug stopped the game until the next save while its other listeners kept running. The game now restarts from init; more than three failures in a minute leave it off until its next revision, so a crash in init cannot loop on the server thread.

Kotlin for the runtimes. The runtimes and the connector’s JVM side are Kotlin; Java appears only where Kotlin is not loaded yet.

Reachability in every endpoint over a proxy in front of every server. An earlier plan put a proxy next to every server as a second process. On hosting panels that run one container per server, every process in the container ends with Java, so the proxy would protect nothing there and only cost memory. The connector runs inside the server’s process instead. More.

Dumb relays over a smart edge. An edge that terminates logins can read and change every packet, but it has to follow every Minecraft version, spends CPU on every byte and holds state. Relays only read the hostname and pass bytes. Control in the game comes from the runtime on the server, through the server’s own API, not from the path in between.

Relays near the server over anycast for latency. The route from player to server is fixed, and a relay near the server lies almost on it. Anycast helps with failover, not latency, so it is planned as a paid tier. Two relays per region behind a health check come first.

Small virtual servers over an edge platform for relays. A relay needs a few tens of megabytes of memory. The edge platform of the earlier plan does not explicitly support QUIC on its UDP service, has no UDP over public IPv6, and may deliver packets of one flow to different machines.

iroh over libp2p. iroh dials by key, falls back over HTTPS where UDP is blocked, connects endpoints with each other (Velocity to its servers), and moves a connection when one side changes its network; iroh 1.0 tests exactly that. libp2p, as our earlier connector used it, builds new connections instead of moving existing ones.

A slim Rust program over building on Gate. Gate already has much of the mechanism. We build a slim program that does only what is needed, with little memory and CPU and one implementation for every mode, and read Gate to learn how things should behave.

No open community relay pool. Players do not choose their relay; they type a hostname. A stranger’s relay sees their addresses, could show them a false server, and draws attacks and abuse reports. Relays are Minekube’s, an operator’s own for their own network, or partners’ under contract.

Mojang’s check on every transfer over skipping it with a signed cookie. Without the session check, nothing binds the encryption to the player: a relay could end the encryption itself, read the cookie and log in to the target as the player. Binding the cookie to the client’s address does not help, because the relay reports that address.

A standard issuer over our own token format. An instance’s identity should be checkable without asking us, so every network is an OpenID Connect issuer that lists its members’ keys, and any JWT library can check a token an instance signs. The same standard lets a server join with the token its environment already gives it, so no Minekube secret sits on the server; mk claim with a one-time code stays the way where there is no issuer. More

Labels and selectors over server names, pools and groups. One concept, from Kubernetes, picks where a player goes, where a revision goes and what a list shows. There is no shorthand without matchLabels, because a free label key could collide with it, and no annotations, because what changes is status. More.

Primitives over policy. We do not decide who may route whom. Minekube guarantees identity, the network boundary, verified facts and a signed origin; whitelists, bans and partner networks are a few lines of each network’s own routing.

Our features on the public SDK over a private path. Minekube’s own network features are planned as bundles on the same SDKs every network gets. If we miss something, everyone misses it, and it gets fixed for everyone.

Velocity as an option over a requirement. When every game server gets the same revision, /lobby is part of every revision, and shared state lives in Durable Objects. Paper-only networks are planned as the default for new networks; Velocity stays for existing ones.

A Worker and Durable Objects over Effect Cluster for the registry. An Effect Entity needs a sharding runner that Cloudflare does not have, and a Durable Object already is an entity with an address and state. A workflow engine for claim codes would have added an object and a hop for what one transaction does.

workerd over embedding V8 ourselves, for the planned proxy. The crate we would have embedded is archived. workerd, Cloudflare’s open-source Workers runtime, loads code at runtime under a revision’s name, so swapping on save works, and the same bundle runs next to the proxy and on Cloudflare.

Passage, an open-source entry point for Minecraft networks in Rust, taught us three things:

  • A version matrix with the official client. Unit tests cannot find wrong packet IDs when both sides share the same code. Minekube’s network tests play the official clients of every protocol boundary from 1.20.6 to 26.3, nightly in CI; 1.21.2 still fails on a ViaVersion issue.
  • One trace per player journey. An unsigned session cookie with a session ID can tie a join, a waiting room and several transfers into one trace. It grants no access, so it does not matter that every server can read it. Planned.
  • The PROXY protocol for the client’s address. Where a connection passes through a socket, the client’s address travels as PROXY protocol v2, which Velocity and Paper understand, instead of our own format.

Was this helpful?