CMS in Javascript

    For the seed - a loud statement: this article is able to leave without the work of those backend developers who have not yet learned the Javascript Tao. If you thought about Node.js, then in vain. Not a single line of server code. We will talk about CMS , which works in any modern browser.


    You may have already encountered static site generators in Ruby or Python . This is more convenient and cost-effective than keeping a server with a gluttonous Wordpress for a site that publishes news or a price list once a month.

    However, the environment with Ruby and a bunch of additional packages for Jekyll is the lot of geeks. You can generate a site from a couple of dozen pages in a mobile browser. Even Opera Mini is able to collect a string of html code and send it to the server with an AJAX request. This is on any Java ME phone. Here you have a mobile phone lying around idle, and you can generate sites on it.

    The attentive reader was already indignant at the mention of some kind of “server” in the previous paragraph. That's right, I promised that the CMS will only work in the browser. In order for our JS application to save the generated site, we need some minimal backend. In the era of cloud storage, this choice is very simple: Amazon S3 or any providerOpenStack Swift. Both platforms provide a REST API and the ability to turn any container / bucket with files into a website with its own domain. Reliable hosting of this kind, plus everything can be managed via AJAX instead of (S) FTP. Glory to CORS !

    Ok, we figured out the server side. What is a CMS capable of working only in a browser?
    1. Fast html template generation. Template builders, as always, a bunch . Support for web workers with the latest generation of browsers allows you to generate really large sites in the background.
    2. Naturally, visual editing in the WYSIWYG editor and editing the source with code highlighting - Ace or CodeMirror.
    3. Upload files and edit images using canvas or any cloud services .
    4. Versioning and any meta data for documents. The S3 / Swift storage and localStorage in the browser guarantee that our valuable content will not be lost anywhere.
    5. Anything. The variety of cloud services with the HTTP API (for example, to send and receive email) and more crazy things inspire enthusiasm for the future of such JS applications.


    Of course, the most delicious here is the price for hosting a static site. Russian cloud providers have 100MB files and 3GB of traffic cost less than 3 (three!) Rubles per month. At the same time, you do not have to sacrifice the convenience of traditional CMS and spend money on idle server resources. After all, we don’t have it at all.

    If the topic raised is of interest, then in the next article I will talk about my implementation of such a content management system. Have tea for everyone!

    Also popular now: