carlosj

carlosj

Hi all,

I have published the first public release, 0.1.0, of Malla, a framework for distributed services in Elixir.

Malla is a framework for developing distributed services in Elixir. A service is a module whose behavior is composed from plugins through callback chains that are resolved when the code is compiled. Services running on different Erlang nodes find each other and can call each other. The framework keeps the moving parts few and visible.

Malla is also useful on a single node: it gives you plugin-based services, a lifecycle with admin and running statuses, and plugins that can be added, removed or reconfigured while the service runs. Distribution is there when you need it.

A service is a module:

defmodule MyService do
  use Malla.Service, global: true

  defcb fun1(a), do: {:ok, %{you_said: a, node: node()}}
end

From any other node of the cluster:

Malla.remote(MyService, :fun1, ["hello"])
#=> {:ok, %{you_said: "hello", node: :"first@127.0.0.1"}}

Behaviour comes from plugins. A callback is a chain: each plugin answers, or passes the call on with :cont:

defmodule AdditionPlugin do
  use Malla.Plugin

  defcb calculate(:add, a, b), do: {:ok, a + b}
  defcb calculate(_, _, _), do: :cont
end

defmodule MultiplicationPlugin do
  use Malla.Plugin

  defcb calculate(:multiply, a, b), do: {:ok, a * b}
  defcb calculate(_, _, _), do: :cont
end

defmodule Calculator do
  use Malla.Service, plugins: [AdditionPlugin, MultiplicationPlugin]
end

Calculator.calculate(:multiply, 8, 4)
#=> {:ok, 32}

What it does:

  • Plugins. Each plugin can handle the call, change its arguments or pass it on with :cont. A plugin can depend on others and is placed above them. The chain is worked out at compile time, so a call is a function call.
  • Discovery and remote calls. Services announce themselves through :pg and are called with :erpc. A node that does not have the module gets a proxy for it.
  • Changes at run time. reconfigure/2, add_plugin/3, del_plugin/2 and set_admin_status/3 (active, pause, inactive) on a running service.
  • Optional plugins for request handling, tracing, status and an HTTP endpoint for Kubernetes probes.

Malla is the first piece of a larger set I am opening up, one by one: Marea for Kubernetes deploys, Grada as a Kafka client, Caracola for SIP, and plugins for data, jobs, auth, tracing, MQTT and UI. Together they are meant to let you build a complex distributed application quickly and completely, on one foundation. Malla is the base the rest plugs into.

Where it stands: 0.1.0, Elixir 1.17+, one required dependency (telemetry), Apache-2.0. It runs a big telemedicine platform in production, and it is the Elixir successor of NkSERVICE, which some of you may remember from NkSIP. The API can still change.

Thanks,
Carlos

Where Next? Top

Trending in Announcing Top

GenericJam
Edit: 2026 May 15 - This post is archived. Mob is alive!! Main docs: mob v0.7.11 — Documentation A bit of explanation for the slightly c...
261 13149 112
New
achempion
Hi, I would like to tell about my initiative to further maintain and develop Waffle project which is the fork of Arc library. The progre...
New
mudasobwa
I fully migrated to my own harness from Anthropic/Gemini and I think it’s time to share it. Welcome DSH, the DeepSeek Harness, fully writ...
New
kip
Localize is the next generation localisation library for Elixir. Think of it as ex_cldr version 3.0. The first version will be released ...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
mcass19
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
New
charlenopires
Hi everyone :waving_hand: I’ve been working on PhiaUI, an open-source UI component library for Phoenix LiveView, and I wanted to share i...
New

Other Trending Topics Top

dominicletz
Hey there, I haven’t seen a list of useful Elixir specific skills for the popular AI tools yet so I’m starting one here with my first. ...
New
raa-ziq
Hi everyone :waving_hand: I wanted to share something I’ve been building — NowBlind, a random chat app designed to help people discover ...
New
OndrejValenta
(I just needed to vent somewhere and LinkedIn is full of hope, or hype, I’m not sure which exactly) AI dream has many faces, but general...
New
AstonJ
With advancements in AI gathering pace and set to increasingly accelerate, perhaps it’s worth having an annual thread on the topic - feel...
New
bartblast
If you haven’t tried Hologram yet, what’s stopped you? Here’s why I’m asking. Building a framework turns out to be two jobs, the framewo...
New
mat-hek
Popcorn, the library that runs Elixir code in the browser, is now stable :popcorn: This is possible because it now builds on a very stab...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews