David: We set out to build SpaceCraft two years ago, with the goal of developing a content management platform for small businesses to publish websites that render across a wide variety of form factors and devices of varying capabilities. We also wanted to ensure that in the future, content could be utilized for other channels, such as email campaigns, digital signage and even offline services. To enable this level of content reuse, we needed a strict separation of structured content and its presentation.
I've spent the better part of ten years doing CMS implementations and custom development, and the majority of systems I've worked on have used relational databases. We wanted our system to store structured data, and allow the user to control the structure. This could have been built using a relational database, but going the NoSQL route was the path of least resistance.
I used CouchDB previously and it mapped well to how we wanted to store data. If you think of a website, pages are essentially documents, so JSON documents are a natural fit. Our system stores content in smaller chunks, that we call blocks, and a page is a collection of blocks. From a storage standpoint, we're just dealing with collections of JSON documents. We knew all of our queries in advance and didn't have a need for ad-hoc queries, so CouchDB met our needs.
Another concern of ours that CouchDB helped solve was the isolation of customer data. We didn't want to store data for all our client sites together in one database, partitioned by a site ID. Instead, we wanted to isolate our client data into separate databases, with the ability to create them quickly as new sites are created on our platform, and CouchDB made this very easy. This approach allows us to remove databases easily when trial periods are over or customers delete their accounts. The ability to move individual databases between physical servers also provided for a crude, but effective, way to scale our data tier. Prior to moving to Cloudant, we were using replication, but only to ensure availability of customer data in the event of a hardware outage.