I’ve been working on a homegrown content management system (CMS) for years, way before I wrote about it in 2018. I’m sorry if you’ve been following along.
A few days ago, I had an epiphany. I don’t need a front end for my homegrown CMS. The front end is irrelevant because it doesn’t make the process of writing any easier. I know what data needs to be stored and how to retrieve it from the back end. A headless CMS is all I really need.
I wrote a front end, and then I rewrote it again and again. It didn’t work the way I wanted it to work. More than anything, I’ve lost interest in completing it. It just isn’t good enough to share with anyone.
These are the components I settled with:
I wrote functions to store and retrieve data from JSON files. Using JSON files works very well, but something else works better. I’m not talking about any kind of database. Using a database would add nothing but more complexity.
I’ve already started working on it. When I place a URL in the address bar of my web browser and hit enter, a PHP script intercepts it. It decodes the request URI and strips out unwanted characters and string fragments. It then checks to see if a matching file exists in my “sources” directory and issues a 404 error code if it doesn’t. That’s as far as I’ve gotten so far.
This isn’t a static site generator, although I could probably turn it into one. I don’t want a static site generator. I want to be able to upload a file in a specific format and let the CMS take care of everything else.
The Nginx web server does a lot of the grunt work. The “try_files” directive redirects nonexistent URIs to the index.php file, which processes the source files if they exist. The PHP scripting engine does the rest of the work in parsing, displaying and then caching the “created” files with the help of the Nginx fastcgi module.
The Linux ext4 file system, which is what Ubuntu on my virtual server uses, can hold an unlimited number of files per directory (or folder for you Windows fans). All I have to do is store file names to match URIs.
Any text editor will work, but I use Geany on Linux Mint. Other than a basic text editor, I need to know the word count for the main content and the character count for other areas. Geany has a word and character count function built in.
I may or may not be processing the raw files with a local PHP script (on my laptop). I’ll definitely be doing so during the CMS development stage to make sure everything works properly. The online PHP script will also be responsible for reformatting, fancy quotes and things like that.
I should be able to upload a completed article with FileZilla, load the URL in my web browser and watch the magic happen.
I’m spoiled by WordPress. I’ll need to replace certain functions, like the statistics plugin, before I’ll feel comfortable with my homegrown CMS.
I plan to share my homegrown CMS as soon as it’s completed. Because I can’t predict how long it will take to complete it, I can only guess it’ll be done in a month or two. If I could work on it full time, it would only take a few days.
One thing I want to make clear up front is that this will not be competing with any other CMS. It’s just another option. You’ll still have to set up your own “theme”. I’ll only be setting it up with what I’m using now.