- 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!!!
I agree. The 3 complicated issues in building a decent CMS are:
When you say, Wordpress, what do you mean, a content management system with WYSIWYG editing, image storage, and installable themes?
I would say those 3 are features that are not core to a CMS. Some CMS are headless, hence donāt need themes. If by WYSIWYG you mean drag and drop page builder, there were CMS before this exists. Images is just a type of content usually called Assets. Most CMS include a Digital Asset Management module, but, again, itās an added feature.
I would venture the minimum set of features of a CMS would be:
then, there need to be a way to distribute that content, depending on the platform. On the web, it would be linking a URL to a piece of content.
Iām intrigued by the title of the post since itās something Iāve been thinking about a lot, I see the following problem, coming from the place of wanting to sometimes build websites for individuals and small to medium scale institutions:
Wordpress and similar PHP-backed headful (also rendering the website) CMS systems still offer an unmatched workflow for some reason:
Now web development has progressed over time, and there are much better options for building content-driven websites, I really like static site generators, Astro is a great one for example, I think the developer experience is kind of unmatched and on a technical level, generating HTML ahead of time and then just serving it makes a lot of sense compared to rendering every page on demand and hitting a database on every request when the content really only changes like once a month.
The problem is there is no CMS with a workflow as straightforward as what I mentioned above.
If itās your own website, editing markdown files by hand may be an option, but you canāt expect non-technical users to be doing that, it barely works even with a wysiwyg editor.
There is the option of using a headless CMS, the cloud / Saas ones are usually quite expensive (see: Contentful), self hosting an Open Source one (Payload, Strapi, Directus) is feasible but comes with a maintenance burden ā then you also need to rebuild the page on every change so youād have to set that up usually on a secondary service that does the building and hosting like Cloudflare Pages or Netlify, which also means you probably also want to have a hosted git repo connected to that, from a third service like GitHub or GitLab, it just explodes in complexity, and how do I hand some amalgamation of services like that over to a client?
The git-backed static CMS (Like Netlify CMS, now Decap) options are okay, until you are dealing with sites that are heavy in media, then storing everything in a git repo is not feasible anymore and you have to add on services like a git LFS provider or S3, and you always need a minimal backend for authentication anyways.
My point is: I would love something that replaces Wordpress in simplicity for building completely custom content-backed websites for third parties that are not massive companies, I feel like there is nothing targeting that niche at the moment.
Iād prefer something that works with one of the existing excellent SSG solutions that there are, Astro is the one that comes to mind, the missing piece for me that Iāve seen no other CMS (except maybe Publii) do is actually doing the site builds on content change rather than giving you a webhook and pushing you towards setting that up with an additional third party service.