Flat File vs Database driven CMS
These days there are a lot of CMS’s being rapidly developed, the most eye catching CMS’s currently being developed is the flat-file type, which does not rely on a Database, and seem to be a replacement, for their Database driven CMS, the main question are what is a flat file CMS? how does it work?, how different is it from a Database driven?, how does it perform, when it should be used? what problems occur? stay tuned to get these answered.
What is a flat file CMS?
A flat file CMS, uses files and folder, instead of a Database, so there is no real querying done.
How does it work?
It uses files to store data, in some flat file CMS the files are stored in a single folder like
contents and the CMS reads the file name and generates urls, and uses the metadata to known which view or template to use for a specific page/file, the others type generates the urls based on the folder name and the file name inside the folder decided the view or the template, both of these way are good. A flat file CMS however, does not have a system to differ a post or page, even the posts/articles are equivalent to a page, this is not a bad thing, it is just something it takes time to get used to. The metadata of the page is located in the head of the page also known as header/front-matter, it can contain metadata like: title, date, description and template in some CMS’s.
How different is it from a Database driven?
The second question answered this question. A flat file CMS live purely on how good the I/O (Input/Output) is and relays on file handling, it opens a file, if a specific file is requested, it reads the header/front-matter of the page, then loads the content located under the page, and parser thought the pre-processors required, the pre-processor can be Markdown or other pre-processors, depending on the CMS, other configuration files with be written in the primary language (PHP) or other languages like
How does it perform?
As i have said before, it uses I/O which means the performance totally depends on the Web Server, mostly the processor and the storage, the CMS will perform if the hardware has higher specs, because it totally depends on how fast you storage is, based on that the CMS can load files faster for reading and writing, it also depends on the processor to process the loading of opening these files, if you are running it on a low spec server it won’t perform that well on higher request and more frequent demand of content, this can cause loss of views, this can how ever be avoided if the server is configured in a more optimised manner or if any type of caching is used, flat file CMS’s these days come with their own version of caching, which can be file based or use internal Web Server modules like APC, MemCached, one such CMS to offer this feature is Grav, which is under active development, and offers an Admin panel(beta) to edit content.
When it should be used?
A flat file CMS is good for a personal website or blog or a website that is not frequently updated, where visitors are not large in number, and does not have thousands of pages to serve thousands of visitor. It is not a good choice, if you have live blogging or many users editing content simultaneously, this can exhaust the resource of a low spec Web Server.
What problems occur?
A flat file CMS uses files and folder which sometimes can cause permission issue to a certain user or an under privileged user, and might prevent the CMS to initialise correctly or load content, this also make maintaining a website a little bit difficult.
I have listed a few flat file CMS (sorted by personal preference)
Leave a comment below, let me known what you think, if you want any other flat file CMS to be listed over provide a link to the repository or website.