CMS in Crystal, how hard it may be?


Greetings community!

My question is - how hard it may be to build a robust yet salable CMS in Crystal?

I’m using Prestashop eCommerce CMS, based on PHP and SQL for some time. But things got more and more complicated then custom business logic was needed to be implemented. So now I want a more simple solution that wont be hard to modify for different use cases.

What I have in my mind is:

  • Keep most things in memory as an object - products data, logged in customers data and so on, and write to a persistent media only on effective changes. For a 2k products shop it should not be a lot of memory.
    But I’m thinking to expand this idea to Html content also. To be able to easily create and edit objects, that would be something like web components, a tool may be needed. Something like a web page builder, maybe even a drag and drop one.
    That object based view should interact with business logic with some kind of interface (like Uncle Bob Martin’s interactor).
    I do understand that making all that possible is a lot of work. But I believe it may be started with some simple components and if the architecture is good it will scale well later.

  • For a friction-less interaction of the model that was I describing with a persistent media I’m looking at NoSql solutions. Leveldb or Roksdb may be the way. But how it may be to have a complex query on that thing? On the other hand Redis may be perfect but I don’t want to load in memory old or seldom used data. And I haven’t seen NoSql be spported by most known Crystal frameworks. In fact I’m seek and tired of a typical eCommerce over complicated db structure and rigidity. I want something that is easy to modify according to needs.

  • Reliability. Since I’m just learning Crystal it’s a concern for me. Maybe Elixir with “Let it crash” is a better choice for me? But I may need much more time to understand it since I’m coming from PHP. I choose Crystal for it’s syntax, for me this mean - easier to understand and maintain the code, and for how easy it can be deployed, compared to Elixir. But I’m concerned about if there is a bug in function - would it crash the whole server?

What you think about this? Any comment is welcome.


About reliability - unhandled exception will crash only one fiber (they are created for each connection), so that’s not a problem.
But if you have shared state (products data, logged users etc) and something bad will be written to it due to a bug (i don’t know, customer with links to deleted products?) all connections that try to use it would crash in a same way.

1 Like

So fibers will save me from a total server crash (that I was afraid about in a compiled language) - that is great. I’ll read more about them.
To reduce bugs and simplify the internal logic I was thinking about keeping everything as objects. I understand that I have to think carefully how objects will interact .
Thanx for your comment.