Cloud Connected

"I have been searching for a product like Cloud CMS for over 10 years.

After false starts with some typical content management solutions, we were finally able to design the content repository that our business required."
James Baddiley
James Baddiley, CEO

Need a Content Platform for Your Titanium Application?

 Appcelerator Titanium is a popular mobile framework for developing native, hybrid and mobile web applications from a single code base. However like many other mobile frameworks, it doesn’t come with a Content Management System (CMS). So for any content driven or content rich application, Titanium developers will have the need for a CMS that serves or stores content for their mobile applications.

On the other hand, Cloud CMS provides all of the back-end services and infrastructure for your mobile applications in the form of cloud based services. Its JSON and RESTful APIs can be easily integrated with any mobile framework.

To build a Titanium native application that talks to Cloud CMS and uses it as its content platform, all you need to do is to take a few simple steps

Step 1 : Sign up an account with Cloud CMS

To get your project started, you need to get a subscription to Cloud CMS which gives you your own platform, storage space and services for your projects and applications. To try out for free, you can use Cloud CMS free sandbox account (demo/demo).

Since Cloud CMS supports OAuth2 for platform authorization, you will need both client credential and user credential for your application.

To locate your client credential, sign in your Cloud CMS console and browse to Clients page and then select a client for authentication. From client dashboard page, you will find its key/secret pair.

For user credential, you can either use its username/password pair or any authentication grant that you have setup for that user.

Step 2 : Download Cloud CMS JavaScript driver

Cloud CMS JavaScript driver handles all HTTPS calls, data conversions, OAuth2 authorization handshakes and any and all interaction with the Cloud CMS platform in a secure manner.

To get the latest version of the driver, you can visit its hosting site and download either its minified version or uncompressed version.

Step 3 : Build Cloud CMS powered Titanium applications

Let us first build a simple Hello World application (click here to download the full project).

1) Create an empty Titanium Mobile project using Titanium Studio.

2) Create a cloudcms sub directory under the Resources directory and then place the Cloud CMS JavaScript driver under it.

3) Edit app.js and add the code that connects the app to Cloud CMS. This example will first create an instance of Cloud CMS driver which makes connection to to your Cloud CMS platform using the provided credentials. Once the connection is made, it will then print out the name of the authenticated user.

new Gitana({
    "baseURL" : '',
    "clientId" : "676e3450-6131-46c2-99cc-496aa2ad80fa",
    "clientSecret" : "......"
"username" : "demo",
"password" : "demo"
}).then(function() {
var authInfo = this.getDriver().getAuthInfo();
var label1 = Titanium.UI.createLabel({
color : '#999',
text : "Hello " + authInfo.getPrincipalName() + "!",
font : {
fontSize : 20,
fontFamily : 'Helvetica Neue'
textAlign : 'center',
width : 'auto'

4) Run the application using iPhone simulator and we should have a screen which likes this.

Now let us take a step further and enhance the application to read and display a content item from a Cloud CMS repository (click here to download the full project).

var cloudCMSContextConfigs = {
    "driver" : {
        "baseURL" : '',
        "clientId" : "676e3450-6131-46c2-99cc-496aa2ad80fa",
        "clientSecret" : "......"
    "authentication" : {
        "username" : "demo",
        "password" : "demo"
    "repository" : {
        "title" : "Creatures Content"
    "error" : function(error) {
        Ti.API.error("Error: " + JSON.stringify(error));

Gitana.Context.create(cloudCMSContextConfigs).then(function() {
    this.branch().readNode("creatures:coyote").then(function() {
        var node = this;
        var fullImageUrl = node.attachment('photo').getDownloadUri();
        var image = Titanium.UI.createImageView({
            image : fullImageUrl,
            width : '100%',
            height : 290,
            top : 5,
            bottom : 5,
            left : 5,
            right : 5
        var detailsLabel = Ti.UI.createLabel({
            text : node.get("details"),
            color : '#000000',
            shadowColor : '#FFFFE6',
            textAlign : 'left',
            shadowOffset : {
                x : 0,
                y : 1
            font : {
                fontSize : 13
            height : 'auto',
            width : 'auto',
            top : 10,
            left : 10,
            bottom : 10

For this application, we will use the Cloud CMS context API which takes configurations for credentials, targeted repository, default fault handler etc. Once we create an instance of Cloud CMS context, we will be able to use it to retrieve a content item and then show its metadata and its attached picture.

We’ve also put together a full reference application that demonstrates various features and capabilities that Cloud CMS can provide for your Titanium applications (click here to download the full project).

It can serve as a starting point for anyone interested in introducing Cloud CMS to their Titanium apps.

Source code on GitHub

YouTube Video on Cloud CMS/Titanium Integration

To learn more about using Cloud CMS JavaScript driver, you can also check out our documentation site and hosted online samples.

Cloud CMS and Two-way Replication

When we designed Cloud CMS, we wanted to give our customers the choice of running the platform both in the cloud and on-premise.  The cloud makes sense for a lot of infrastructure needs but we recognize that some of our customers will want to have their own hosted installation of the platform.

We also wanted to give our customers the ability to push and pull data between their on-premise installations and the cloud platform (whether our public installation or a private cloud the customer runs).  There are times where it’s better to take advantage of the elastic storage and capacity of the cloud and other times where data is better suited to live on-premise.

To achieve this, Cloud CMS offers two-way replication.  It’s very similar to Git in that you can push and pull changes between your local installation and a cloud installation.

To pull, you browse the cloud and find a resource you would like to pull down into a local copy.  You then export that resource into an archive.  And then, on your local installation, you simply import the archive via its URL.  Your local copy of Cloud CMS will download the archive and seamlessly produce a replication of the data on your local instance.

Archives are stored in vaults and basically comprise a snapshot of the data along with all of its dependencies.  Archives are a lot like Maven Artifacts (if you’re familiar with Maven, Ivy, Gradle or other dependency management / build lifecycle tools).  They can contain either all of the data of your export or a partial subset depending on whether you’ve bounded the export by date or changeset IDs (in the case of changeset-versioned branches).

You’re free to work locally on your data and if you choose, at any time, you can push your data back to the cloud.  It’s basically the same operation but in reverse.  You export the archive.  And then, you either pull the archive to the cloud from the local installation or you push it from the local installation to the cloud.  The former is applicable if your local installation is visible from the cloud (depending on your firewall / IT restrictions).  The latter is often more preferable.  But in the end, they accomplish the same thing.

Cloud CMS really looks to Git and Mercurial as examples of great versioning systems that really get it right in terms of being distributed, changeset-driven and replication-friendly.  We didn’t seek to reinvent the wheel but instead opted to give our customers access to some wonderful tools for collaboration which, prior to Cloud CMS, were only available to command-line developers.

Building Applications with Ratchet JS MVC

Over the past few days, I’ve had a chance to delve back into ratchet.js which is a JavaScript MVC framework that I had a hand in building in 2010. By this point, there are a lot of JavaScript MVC frameworks that you can utilize. However, at the time we built it, we were very inspired by sammy.js, backbone.js and knockout.js.

A few points on these libraries:

  • I particularly liked sammy.js for its simplicity. The developers of that library do a great job minimizing the work and also utilized an interesting “chaining” approach during the rendering phase which was inspirational. We really liked the chaining approach and used it in Ratchet as well as our own Cloud CMS JavaScript Driver.
  • Both backbone.js and knockout.js are fantastic frameworks for defining scoped-observable variables in the model. They solve things like how to update content on the page in real-time, build components that listen for update events and pass messages between controls or elements on the site.

We sought to produce an MVC library that gave us the singular foundation that we needed to build really great HTML5 and JavaScript-based applications. Furthermore, we wanted a framework that would be ideal for real-time, cloud-connected applications. Thus, while it’s important to get the foundation bits right in terms of observables, components, templates, routes and so forth, we also felt it was very important to define an asynchronous rendering pipeline that could manage state for the backend, stream content forward and aggregate it into HTML5.

None of that is really too outlandish. A few years ago, for those old enough to recall (not that it was that long ago), everyone was crazy about mashups. The basic idea behind mashups was that content would be sourced from other locations and presented singularly. That idea hasn’t gone away and with the explosion of cloud-based services including Cloud CMS for all of your content and application services, we think its high time that a JS framework was built to address that need.

So that’s where we’re headed going forward. I find it an absolute joy to work with ratchet.js and would recommend to readers that they take a look. It’s a purely open-source project under the Apache 2 license. All of the source code is available on GitHub.