r/webdev • u/ExplanationOk2014 • 1h ago
Question Headless cms
Sorry it maybe a stupid question but I read today about headless CMS, it being to be portable to every kind of device and it being "the new thing".
I went to read a few blogs but still don't understand its advantages.
Where is the difference when I store all content/paths in a json like I currently have?
0
Upvotes
7
u/SPEZ_IS_A_JABRONI 1h ago
headless doesn't refer to how the data is stored it describes the relationship between the frontend and the backend. Ie, the 2 are largely independent.
2
u/SkyTheLine 1h ago
Look, i use it and love it. Imagine, that the backend can be modified and controlled without any inteference. Mainly because i seperate it with the frontend. On the frontend site everything is static rendered. Perfext for cdn and branching. Control it, deploy it and love it. I control frontend, backend and can do branching both.
2
u/MisterEd_ak php 1h ago
It just means you can focus on developing the frontend without having to also write the enitre backend system.
The CMS, like Drupal for instance, provides the JSON API and all of the required forms and content management so you can have multiple people maintaining content.
2
u/Beregolas 1h ago
I mean, sure, there are a few posts about headless CMS right now, but it's certainly not "the new thing". They have been around for decades.
A CMS is a Content Management System. It has many jobs, but most of them can be boiled down to: Give the Admins an Interface to manage the data, and give the users an interface to consume it.
Many CMS come with their own frontend: WordPress is probably the best known example.
Some only offer an API and no GUI to interact with them natively: they are headless. For most use cases, you would bring your own GUI, for example by building it.
There is none. If you build a system, that stores all data as JSON and can retrieve it well enough for your users, congratilations, you have a CMS. If you don't ship a UI, you have a headless CMS.
That being said: JSON files on the backend have a myriad of issues, most of which only start coming up once you either scale, or try doing something fancy that just doesn't work well with multiple strewn JSON files. The first things that come to mind are searching and indexing, sorting and filtering, access control (is just way harder than it needs to be), reading and writing is probably slower than a DB, especially if you are doing it wrong (language dependent), etc.
As long as you don't run into any issues, and are programming for fun: JSON is completely fine. If you want to improve, try looking into more advanced backend setups, like SQL based databases, or if you want to stay in the file/document style without exactly defined schemas, try something like MongoDB.