kitCMS – Part 10 – Deploying To Heroku

Add a Procfile to root

Update lib/app.js to use process.env.PORT

Continue reading

kitCMS – Part 9 – Adding Cluster Support

Using The Node.js Core Cluster Module

Update config.js

Here we’ll add a workers entry in the server section so we can specify the number of workers to fork.
Setting workers to ‘auto’ will assign number of CPUs, or 1 if the system has only 1 CPU.
You can also specify a specific number.

Continue reading

kitCMS – Part 8 – Creating Dustjs Helpers


Helpers are stored in an object located at “dust.helpers”. To add another helper simply assign a function to a new key.

You can then include your helper in your templates

Continue reading

kitCMS – Part 7 – Dustjs, Live Template Reloading

Clearing The Cache

We already have an onChange hook in our database adapter. All we need to do is remove the appropriate entry from the Dustjs cache.

Update lib/db/index.js

Continue reading

kitCMS – Part 6 – Securing Admin With Expressjs Basic Auth

Adding Basic Auth To Our Admin Route

Add an admin user and password to config.js

Update lib/routes/admin.js

We are going to use the Expressjs Basic Auth wrapper. All we need to do is instantiate an instance of the Basic Auth object and pass it in as an argument to each routes we want to protect.

Continue reading

kitCMS – Part 5 – CodeMirror, Admin Interface

We will be creating a basic database key list and html editor in this section. Part 6 will cover adding a security layer to the admin section.

Add the CodeMirror repo to our public folder.

CodeMirror is an in browser editor component with an easy to use API. A wide range of features and languages are supported.

Add the Font-Awesome repo

We’ll need some icons for our toolbar. Using an icon font makes life easy.

Continue reading

kitCMS – Part 4 – Integrating Dustjs With Express And Redis

If you haven’t already, now would be a good time to look over the Dustjs templating language.

Install NPM modules

Dustjs Wrapper

Create a new directory for our Dustjs code

Continue reading

kitCMS – Part 3 – Adding An Abstract Database Layer

To keep things simple, I am limiting the interface to five functions.

  • get(key, callback) – retrieve a value from the database
  • set(key, value, callback) – store a value in the database
  • unset(key, callback) – delete a value from the database
  • keys(callback) – get an array of keys from the database
  • onChange(key) – event listener called when changes are made to a key/value entry

Create Our Database Interface

Add a directory for the database adapters

Continue reading

kitCMS – Part 1 – An Asynchronous CMS Using Node.js

This is the first post in a series of post on building an asynchronous CMS using Node.js.

If you have not already used Expressjs, I recommend doing a quick read through of the
Expressjs Guide.

Component Choices

Continue reading