Fl4m3Ph03n1x

Fl4m3Ph03n1x

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)

Showing Posts 1 to 6

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.

stevensonmt

stevensonmt

Does the middleware approach of Tesla fit your question?

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.”

Fl4m3Ph03n1x

Fl4m3Ph03n1x OP

Alright, this explanation is just what I needed. Thanks !

D4no0

D4no0

One more thing that I also wanted to mention. Since elixir doesn’t provide sandboxing, using something like luerl goes a long way in ensuring relative safety of the code that is being run.

Obiviously this goes beyond elixir only, as you will write those scripts in lua, but this is more how a pure plugin would look like if you don’t trust the source.

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…

— All posts loaded —

Where Next? Top

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...
2977 92995 915
New
caslu
I want to open this thread for you all to discuss and help those who really like Ash but are still hesitant to use it in a real project. ...
New
mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
GES233
I’m posting this in response to Jose’s recent tweet (Cr. link) : People are sleeping on Elixir for a coding harness: Hot-code swappi...
New
_mfierro
Hello, I wrote Stop My Hand, a Scattergories-like web application using Phoenix/LiveView as my learning project for Elixir (after readin...
New
marciol
It would be helpful to have a list of companies worldwide that hire engineers without prior experience in Elixir. Often, it can be quite ...
New
durvia
Anyone running long-lived stateful processes on BEAM? We’re building an AI agent runtime and would love to compare notes. We’re a small ...
New

Other Trending Topics Top

garrison
Hobbes is a low-level distributed database for the Elixir programming language. Hobbes provides a simple, safe, and scalable storage lay...
New
marciok
Hi there! We created Gust: A task orchestrator inspired by Airflow. For those who have never heard about Aiflow, it’s a Python-based wor...
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
netoum
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
wintermeyer
There are three potential reasons for members of this forum to have a look at https://vutuv.de You are tired or annoyed of LinkedIn. Yo...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews