- Is it a bad idea?
- Is Elixir the correct tooling?
- Technical constraints?
- How to handle the plugins, themes ecosystem? (maybe
mix install
?)
Thank you for reading
mix install
?)Thank you for reading
Such a platform requires pluggable add-ons. Elixir can achieve that but itās not trivial, and security can definitely be an issue.
This is not unique to elixir though. Any platform without sandboxing has that problem, including PHP/Wordpress itself.
Yep, true. In fact I donāt know of a language/platform that does this well. I still remember people breaking Javaās security subsystem years ago, maybe that was improved in the meantime.
I think, this is the greatest problem.
This is also true if you wanted to program an extensible Ecommerce system, for example. There are some comments about this here in the forum.
Yes. Unless we get a hard sandbox for the BEAM VM then I donāt think such efforts will ever go anywhere.
Of course there are other options like just use a Lua engine to program plugins but then the single language paradigm of such platforms goes down the drain and you might as well not use a BEAM language at all.
I am sure there are ways around it but itās probably too hard to be worth it.
Or accept the security implications like many other systems, which provide runtime supplied pluggable functionality.
Yes. I still wouldnāt mind (if it was my job) because Elixir still has a ton of advantages compared to JS or PHP for such projects. But it needs to be said that itās not at all easy to pull off.
Iāve thought about this a lot, and have come to the conclusion that plugins basically destroy the premise of doing this in most languages (not an Elixir thing). It feels like PHP is actually uniquely positioned as the best foundation for a WP-like system.
You could totally build a drop-in plugin system in Elixir, although it would be much more involved because youād need to compile the plugins and add the compiled source to the application. The code_server process can handle this dynamically, I believe. Then questions like, what would prevent a plugin from overwriting an existing module? The security can of worms is big on this project.
The even harder thing about plugins is that they can completely change the operation of core wordpress operations. So having a pure core separate from the plugins isnāt really applicable in practice. I donāt think you could simply ignore it because the UX depends on having a powerful plugin system that can change the operation of the system. Modifications to wp-theme.php are the bane of any WP developer, but is also quite common because software is hard.
Iām curious why you think PHP is uniquely positioned for such a system? By my understanding PHP has exactly the same issues. Sure thereās compilation, but the beam and elixir have quite nice api around doing that even at runtime. The statefulness of the system means you need to be a bit more diligent with unloading stuff compared to the āload everything from scratch each requestā in PHP, but other than that I donāt really see a big difference.
My main reason for this is that everything in PHP is drop-in and evaluated on every request. So you literally just need to put files there and it works. The devil is in the detailsāit just works in PHP but youād need to replicate it to have the same effect, and Iām not sure itās super easy to do. The other thing about it is that PHP files are edited live in pretty much any major WP installation. Itās just a feeling though, I donāt have a ton of empirical evidence here because I havenāt seen it attempted in earnest.
I suppose you could build that type of system in other languages (dealing with compilation as needed, setup files correctly, etc), but Iām not aware of other systems that have replicated this.
In PHP the new code will be loaded in an isolated process instead of being system wide, and you will not be able to redefine a module/class that already exists. This is best to try to run malicious code.
Plus PHP is easier with āone click installā providers I guess. That being said, I find using Luerl for plugins could be very cool and safe, though maybe not very fast.
Thank you for all your responses, it boosted my confidence.
I thought I will list some of the top Wordpress plugins & find-out how to implement it, likely the most of them should be implemented in core, including:
w_1200
, w_1200,h_800
), if it slow, we can make them communicate via RabbitMQAm I missing something important here?
Thank you for reading;
Iāve spent some time thinking about this and some time going down paths I abandoned.
I have an effort underway which Iāve shared some stuff about in my newsletter. Since Iām aware that a CMS is a massive effort Iām trying to start with foundational libraries and stacking those bricks up over time.
Even on just this forum Iāve seen this idea come up and fall down.
I think Elixir could do great at CMS things but the road to featureful enough is absurd.
Give it a shot if you like. I applaud any effort in that direction but be aware that it is a lot of work.
My view on āsolvingā the CMS problem is pretty particular and it involves tackling this particular painpoint, among others: Underjord | The WordPress merging problem
For me it begins with making content type creation strong. And going down that route youāll find out that Ecto schemas really are very compile-time and if you donāt want arbitrary atom proliferation, from code-gen, as a risk that leads to other choices. Can of worms
I can share more when and if it starts to make sense
There is a CMS system in itself for many years: Zotonic
However, Zotonic is based on Erlang, which can be extended and customized with your own modules and templates. The template-system is based on erlydtl.
My interest is rather Ecommerce, also for this Elixir would be actually well suited, there are also some companies that use it exactly for this, but just proprietary:
https://www.stitched.co.uk
https://www.therealreal.com/
For an open source ecommerce system you would need the possibility to develop plugins, especially to program your own themes for the store.
In Zotonic, for example, you can extend the templateās in a simple way via the blocks as in Django or PHP-Twig.
Twig-Templateās for Shopware
From time to time I try to figure out how to do this in Phoenix, but unfortunately I havenāt made any progress. Especially if there are other solutions instead of blocks? In such a store system, however, there can be hundreds of blocks, which are very fine-granular (as you can see in the shopware example).
I would be grateful for ideas regarding extensible templates in a nice way.
OMG I would so help you do this!! But I have to come back when Iām more awake. Iām going on awake idk, something crazy like 24+ hrs now. Yea so, goin to bed soon. But I love this thread. Iāll be back!! WOOT WOOT Iām already excited to do this!!!