📜 ⬆️ ⬇️

Javascript cms

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


You may have come across static Ruby or Python site generators. It is more convenient and more budgetary than keeping a server with a voracious Wordpress for a site where news or price list is published once a month.

However, the environment with Ruby and a bunch of additional packages for Jekyll - this is the lot of geeks. You can generate a website 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 phone with Java ME. Here you have such a mobile phone lying around, and you can generate sites on it.
')
The attentive reader was already outraged by the mention of some kind of "server" in the previous paragraph. That's right, I promised that the CMS will work only in the browser. In order for our JS application to save the generated site, we need some minimum backend. In the era of cloud storage, this choice is very simple: Amazon S3 or any provider of OpenStack Swift. Both platforms provide a REST API and the ability to turn any container / bucket with files into a website with its domain. Reliable such hosting, plus everything can be managed via AJAX instead of (S) FTP. Hail CORS !

Okay, with the server part sorted out. What is capable of a CMS that only works in a browser?
  1. Quick html generation by template. Templates, 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 a WYSIWYG editor and editing source codes with code highlighting is Ace or CodeMirror.
  3. Upload files and edit images using canvas or any cloud services .
  4. Versioning and any meta data for documents. S3 / Swift storage and localStorage in the browser guarantee that our valuable content will not be lost.
  5. Anything. The variety of cloud services with the HTTP API (for example, for sending and receiving email) and more crazy things inspire enthusiasm for the future of such JS applications.


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

If the topic touched upon is of interest, then in the next article I will talk about my implementation of such a content management system. All tea!

Source: https://habr.com/ru/post/186342/


All Articles