Fl4m3Ph03n1x

Fl4m3Ph03n1x

Examples of Plugin Architecture in Elixir?

Background

I am studying the concept of Plugin Architecture and part of this task involves finding examples of this within the Elixir community.

My first attempt at searching for this resulted in finding this post by @mudasobwa

While the article differentiates between different types of plugins, it does not offer examples and sample projects in Elixir for analysis and contemplation (still great job by him, go and read his blog !).

Research

So in my search for clear implementations of the Plugin Architecture in Elixir, I though about Plug.

The problem here, is that I find no sources whatsoever specifying if Plug (despite the similar name) indeed follows the Plugin architecture or not. To my knowledge, Plug follows the tenets of the Middleware architecture instead:

Objective

So I was hoping someone could help me find clear examples of Plugin architecture projects using Elixir.

For some context, some clear examples of this are Vim, Eclipse and Minecraft (Clean Coder Blog)

Most Liked Switch mode

mudasobwa

mudasobwa

Creator of Cure

There might be different examples of what we call plugin. In my humble opinion, we might simply call anything that is allowed by the library author to extend the library functionality the plugin.

Backends

Supporting different backends via custom implementations might be treated as “Plugins architecture example”

  • broadway allows plugins to handle different sources
  • rambla which is kinda supplemental to Broadway (it publishes to different destinations in the same sense as Broadway reads from) shows the example of configuration-managed plugin architecture where different publish targets might be configured based on the “channel name” so that publishing to the “channel” would result in publishing to all the configured destinations
  • telemetria allows transparent switching between actual backends (telemetry, open_telemetry, Logger, etc.)

Middlewares

Yep, Plug is the best example.

Also: Req.

Plugins per se

The very example of a plugin per se might be hard to find in Elixir sources because “plugin” is something adding the functionality not only unknown to the library/framework author, but also unexpected by them; plugins are usually made for standalone applications, specifically for editors/IDEs and such. Elixir code, even despite being a framework, is usually narrowed to some domain and therefore the pure plugin support is kinda “unpure.”

cevado

cevado

i’m not sure if a “plugin architecture” is something that you’d apply to a library/package, at least by reading the article it seems to apply to a full application that can have it’s behavior extended through configuration. No enduser would deploy an app and change the plug pipeline, or a broadway config, or a tesla client setup.

but the two apps that come to my mind that might fit a “plugin architecture” is bonfire and astarte…

venkatd

venkatd

This doesn’t 100% answer your question but I believe it’s common for the Protocols feature in Elixir to support a sort of plugin architecture.

For example:

  • Jason lets you implement the Jason.Encoder protocol to decide how structs in your own app serialize to JSON
  • In Livebook there is the Kino.Render protocol which allows you to decide how custom data types render inside of Livebook.

The key here is that these libraries do not decide in advance all of the different implementations. By exposing the protocol, they allow others to extend in a “plugin style” with other implementations.

Where Next?

Trending in Discussions Top

AstonJ
As the title says, please share what you’ve been up to with Elixir. Whether that’s been learning it, looking into it, making stuff with i...
2976 91332 914
New
byu
@chrismccord : I just saw the Extract AGENTS.md from Phoenix.new into phx.new generator commit to the phoenix project. My initial shotgu...
New
arcanemachine
I was working on an Ecto migration and I needed a timestamp. So, for the nth time, I looked up the different data types for timestamps, a...
New
AstonJ
Just a general thread to post chat/news/info relating to AI/ML stuff that may be relevant for Nx now or in the future. Got anything to sh...
New
type1fool
I just stumbled on a newly redesigned elixir-lang.org. :tada: It looks like @Software_Mansion did the work, and I think it is generally a...
New
juhalehtonen
There has been a thread to discuss the Stack Overflow Developer Survey on this forum every year since 2018, so here’s yet another one for...
New
alexslade
Fly’s CEO posted this recently - Turn And Face The Strange · The Fly Blog It says that Fly is going all-in on sprites, which is a worry ...
New

Other Trending Topics Top

JesseHerrick
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
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
Damirados
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve. They are GUI (Emerge) and State management (S...
New
ausimian
Emily is an Elixir library that runs Nx computations on Apple’s MLX. Install it as the default Nx backend and Nx, defn, Axon, Nx.Serving,...
New
akoutmos
@hugobarauna and I (Alex Koutmos) have been hard at work on writing a book on Nerves that takes you from simply blinking LEDs to building...
New
zachdaniel
Introducing AshStorage! Attachment and file management that slots directly into your resources :smiling_face_with_sunglasses: I had hope...
New

We're in Beta

About us Mission Statement