Hello everyone,
We’d like to share Mesh, a new open-source Elixir library developed by the Eigr community.
Mesh was created as part of the work on Spawn, where we needed a reliable and scalable way to route messages to specific groups of processes across a cluster, with deterministic behavior and minimal coordination overhead.
During Spawn’s development, we evaluated existing solutions such as :pg, Horde, and ProcessHub. These are solid libraries and work very well for many use cases. However, for our specific requirements — especially around capability-based routing, deterministic ownership, and very large-scale clustering — none of them fit exactly what we needed. Rather than forcing a model that didn’t align with our constraints, we decided to design a small, focused abstraction that could serve as a foundation for Spawn and similar systems.
That abstraction became Mesh.
What Mesh is
Mesh is a library for managing virtual processes and routing messages to them based on capabilities, rather than direct PIDs or global names.
At a high level, Mesh provides:
-
Capability-based process registration
-
Deterministic routing using shards
-
Decoupling between callers and process location
-
A model where any node can invoke a virtual process, and the system resolves where it should run
Processes register themselves with one or more capabilities, and callers route messages by capability and key. Mesh handles shard ownership and node selection, allowing systems to scale without relying on global process registries.
Example usage
Registering a process with a capability:
Mesh.register_capabilities([:game, :chat])
Routing a message to a virtual process by capability and key:
{:ok, pid, response} = Mesh.call(%Mesh.Request{
module: MyApp.GameActor,
id: "player_123",
payload: %{action: "move"},
capability: :game
})
Mesh also exposes simple functions for understanding cluster state:
Mesh.nodes_for(:game) #=> [:node1@host, :node2@host]
Mesh.all_capabilities() #=> [:game, :chat, :payment]
These helpers return lists of nodes that support a given capability or all capabilities registered in the cluster
Under the hood, Mesh computes a shard from the routing key, determines the owner node for that shard and capability, and delivers the message to the appropriate process — locally or remotely — without the caller needing to know where that process lives.
This makes Mesh particularly useful for systems that need:
-
Logical actors
-
Deterministic placement
-
Clear separation between routing logic and business logic
Project status
Mesh is new and under active development. The API is intentionally small, and we expect it to evolve as we continue integrating it into Spawn and gather feedback from real-world usage.
We’re sharing it early because we believe the underlying ideas may be useful beyond our own projects, especially for people building distributed systems on the BEAM who need more control over routing semantics.
Links
Documentation:
https://hexdocs.pm/mesh/Mesh.html
Hex package:
Spawn:
GitHub repository:
Feedback, questions, and contributions are very welcome.
— Eigr community






















