The best-known content management systems today are based on older technologies, such as PHP. If you want a CMS which uses the latest trends, such as Node.js and NoSQL databases, you have to be more adventurous. The most complete choice currently available is KeystoneJS.
Keystone is a MEAN stack application, though it requires only three of the four MEAN components. It relies on server-side JavaScript through Node.js. Express.js provides its MVC framework and Web server. Instead of using an SQL database, as WordPress, Drupal, and other traditional CMSes do, it uses MongoDB. It doesn’t require the use of Angular, though Angular-based page support features are an obvious way to extend its power.
Keystone provides for the addition of REST APIs for front ends and cooperating applications. They provide a bridge between the outside world and its internal JavaScript API.
The source code for Keystone is available under the MIT license on GitHub.
At this stage of its development, it isn’t as polished and easy to use as its traditional competitors. Installation is more complicated; you start with NPM to install the required components. You can use it to build a simple website, but perhaps it’s better viewed as a CMF (content management framework) than a CMS. Its approach is “We’ll handle the back end, you handle the front.”
Features and limitations
Keystone supports a reasonable array of features, including:
- Secure login and session management
- Blogs
- Image uploading
- Automatically generated administrative user interface
- Form processing
- Email sending
Site creators have to do a significant amount of work on the front end, or else use a front-end extension such as ConnextCMS. ConnextCMS provides tools for building pages, communicating with Keystone through a REST API. It calls itself a “CMS for client-side JavaScript developers,” so even with Connext, Keystone isn’t a simple install-and-go site builder for non-programmers. Connext does as much as possible in the browser, rather than delivering fully formed pages from the server.
Keystone doesn’t actually require a front end at all. With a suitable API, it can serve as the basis of a web application that delivers content to clients.
KeystoneJS for developers
The target audience for KeystoneJS isn’t the business user who wants to get a site up and running, but the MEAN stack developer who wants a content management base for JavaScript tools on the client and server sides.
The developer gains considerable flexibility from this low-level approach. Content is represented as Mongoose documents, which are JavaScript representations of MongoDB documents. Each document is an instance of its model, and models are stored in Keystone lists. A document can have any structure that’s appropriate to its content. Documents can contain sub-documents.
The normal development scenario will be to create a special-purpose site, rather than creating a general-purpose site and enhancing it with plugins.
Directory structure
The default Keystone project structure has the following directories:
- ./lib: Holds JavaScript Libraries.
- ./models: The data models defined for the site.
- ./public: Static content, including HTML, images, fonts, JavaScript, and CSS.
- ./routes: Application views and REST API controllers.
- ./templates: HTML templates for content.
- ./updates: Update scripts (for the content, not the Keystone software).
- ./package.json
- ./keystone.js
The developer starts by creating one or more models, views to obtain their data, and templates to display them on the browser. The public directory contains components which the template references in constructing the page.
Further reading
A good introduction to KeystoneJS is “Practical KeystoneJS,” which is free to read online. It explains how to install Keystone and MongoDB, and then it shows how to build a simple Web application and create an administrative interface and account for it.
As Keystone matures and other developers add components, it may become a viable competitor with existing CMSes for general-purpose websites. For the present, it saves MEAN stack developers a lot of work in developing specialized websites and applications.