dstockdale

dstockdale

Could Elixir ever support a good plugin system and wouldn't it be awesome if it did?

I had to search around for a CMS for a project recently. It was the first time I’ve had to do that in years but I was surprised that nothing seems to have changed in the past 10 years. Most of the search results were for PHP and there’s a good reason for that.

I’m not a fan of PHP but language bashing aside it has one fantastic thing going for it which is you can create plugin systems with little effort because everything is just run from top to bottom. You include a file somehow and it gets run with everything else. Wordpress etc just do this. It’s primitive but it works.

Of course, you could say this a bad thing because this could lead to some awful spaghetti code and security concerns (which is true) but I’d argue this “plugin-ability” lead to some really great movements on the web particularly open source projects.

Some nice things that “plugin-abilty” could give you

  • More people can contribute in more ways
  • More likely to lead to popular open source projects like CMS’s, forums, shopping carts
  • Broader audience - not just corporations that understand software development
  • Might make it more accessible for kids, hobbyists, and non-professionals plus get them interested in the language, which I think is nice
  • Can lead to ecosystems like Market Places, App Stores, which can’t be bad either

I don’t think it’s possible to build something in Elixir that could do this right now. I might be wrong, but I can’t see how you could create a web interface that uploads something then recompiles that something into your app. Someone might correct me here though.

So I’m just putting it out there. Would it or could it ever be possible to do a real plugin system in Elixir?

Most Liked

tty

tty

The idea of a certified module has been floating around for ages. Basically the runtime only loading a beam which has been certified/encrypted via a key. Might make a good research topic for a graduate project.

NobbZ

NobbZ

I don’t think so. It should be trivial to drop a compiled module to a known location and let the BEAM load that module.

And exactly this is the thing that makes the plugin system quasi-built-in, all you have to do is “simply” defining an interface for the plugin…

NobbZ

NobbZ

You do not get any sandboxes with about any other plugin system that relies on loading foreign code.

If you want a sandbox, there is nothing you can do except for evaluating the code on your own and not by the environment…

rvirding

rvirding

Creator of Erlang

It’s even worse, the compiled code doesn’t even have to be in a file. If I can get a binary containing the compiled code to the node then I can load it with the BIF :erlang.load_module/2. All I need is to be able to run a shell on the node and I am in and can do anything.

And we will not mention distribution here which makes it trivial. :grinning:

adrianrl

adrianrl

It should be possible, but we already have complete solutions like WordPress, Joomla, PhpBB… for this advanced kind of things, so it would be a waste of time creating just the same in Elixir, if you need a personal customized solution for you, I’d recommend embedding the plugins inside the whole app.

It’s such a pain creating a general CMS solution, as you need to think in terms of reusability, modularity and extensibility among other things. The more use-cases you want to cover, the more complex it becomes.

We’re discussing pretty much the same here: Web Forum Software in Elixir / Phoenix

Where Next?

Popular in Questions Top

Tee
can someone please explain to me how Enum.reduce works with maps
New
openscript
Hello! Sorry for this astonishing simple question, but I’m really stuck. I try to set up the intellij-elixir plugin, but I don’t know ho...
New
_russellb
I want to try my hand at web scraping. What tools/libraries do I need to use. I’m hoping to turn this into something professional so don’...
New
Jim
As a follow up to my earlier question: I have the code compiling and running but not getting a successful login from the rest server. ...
New
chensan
I have a User schema with a :from_id field set to type :string: defmodule TweetBot.Repo.Migrations.CreateUsers do use Ecto.Migration ...
New
rms.mrcs
Hi, I need to transform a list of numbers into a map where the keys are the indexes and the values are the original values of the list....
New
johnnyicon
Hi all, I've just started learning Elixir and Phoenix Framework, so please pardon my n00bness at this stage. I'm trying to use Postg...
New
WestKeys
Currently suffering from paralysis by [HTTP client] analysis. This is rather unusual in Elixirland as there tends to be consensus on the ...
New
sabri
Can someone explain the settings of pool_size of Ecto in config file? and what is the recommend size? Thanks
New
skosch
To my knowledge, put_in, Map.update etc. all have the one limitation of not automatically creating intermediate keys when needed (for exa...
New

Other popular topics Top

srinivasu
How to handle excepions in elixir? Suppose i have A, B, C ,D, E modules. and each module has get() function. A.get() method will call th...
New
dotdotdotPaul
Okay, I'm having a heck of a time trying to figure out how to best handle the validation of belongs_to associations in Ecto. I'm sure I'...
New
vonH
In asking this question I am more interested about the expressiveness of the language itself and less concerned about the availability of...
New
itssasanka
Hi all, Trying to get some more clarity over utc_datetime and naive_datetime for Ecto: https://hexdocs.pm/ecto/Ecto.Schema.html#module-...
New
ycv005
I have followed this StackOverflow post to install the specific version of Erlang. And When I am running mix ecto.setup then getting fol...
New
Harrisonl
We have an ECS cluster with 4 services, where each task joins a single cluster, via discovery ECS discovery service. Currently when I de...
New
chrismccord
This release brings a number of exciting features, including integration with the new Phoenix LiveDashboard and Phoenix LiveView. There h...
New
lk-geimfari
What is most correct way to open, read and parse JSON file with poison? For example if we have example.json file in root of some projec...
New
stefanchrobot
What’s the safe way to decode a JSON string into a struct? I want to avoid calling String.to_atom. Jason.decode can give me a map with st...
New
TunkShif
This post is an instruction guide to help you setup your Neovim for Elixir development from scratch. It includes general information on h...
273 38985 115
New

We're in Beta

About us Mission Statement