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)
Trending in Discussions
Other Trending Topics
Chat & Discussions>Discussions
Latest on Elixir Forum
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #elixirconf-us
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #metaprogramming
- #performance
- #security











Most Liked
mudasobwa
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”
broadwayallows plugins to handle different sourcesramblawhich is kinda supplemental toBroadway(it publishes to different destinations in the same sense asBroadwayreads 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 destinationstelemetriaallows transparent switching between actual backends (telemetry,open_telemetry,Logger, etc.)Middlewares
Yep,
Plugis 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
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
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.Encoderprotocol to decide how structs in your own app serialize to JSONKino.Renderprotocol 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.