Couchit and CouchDB, a user story

David Squier is a developer for Toyota, and the creator of Couchit, who is currently using CouchDB (and PouchDB) as the foundation for a rewrite of an existing application that will take it from a single-user/.NET model to a multi-user/Node.js/Cloud model. It’s not quite in production, but already has a fully functioning system with most the data tier complete.

He talked to us about how he first discovered CouchDB and what his experience has been like employing it in applications.

How did you hear about CouchDB, and why did you choose to use it?

I heard of CouchDB several years ago when I was working at Blizzard Entertainment. We looked at Couchbase, which was based on CouchDB. The company ended up going with Couchbase due to clustering support at the time (this was pre CouchDB 2.0).

Did you have a specific problem that CouchDB solved?

Yes. The CouchDB replication protocol and the related ecosystem (i.e., PouchDB) were the primary reason we chose CouchDB. Having written offline replication/synchronization systems in the past, I understood how complex and time-consuming such an effort is. Having an open-source replication protocol lets us build a reliable system on top of it and focus on serving our specific business needs.

For the folks who are unsure of how they could use CouchDB–because there are a lot of databases out there—could you explain the use case?

The application we’re building is called “Chassis Tuner” and it was built to work both on and offline. We run CouchDB in AWS as the canonical data source for the application.

If a user is online, they are connected to CouchDB in AWS.

If a user if offline, they run the same application, via an Electron wrapper, that embeds our React application with the Node.js server and PouchDB. A single configuration switch toggles between modes, with the offline mode replicating data from CouchDB to PouchDB.

By using pouchdb-node, we have a single API for both online and offline database operations, eliminating the need for different interfaces to handle each mode.

What would you say is the top benefit of using CouchDB?

The replication protocol. Without it, we would not be able to build our application (or would require many more months to develop a bespoke solution).

Second is the speed at which I can have other developers install, replicate, and develop with a local copy of the database is a big benefit.

What tools are you using in addition for your infrastructure? Have you discovered anything that pairs well with CouchDB?

Besides Fauxton, there are many requirements to modify existing documents, especially while in the development phase. These can be as simple as adding a new property to a document to performing dependent lookups based on keys referenced in a parent document to determine if the referenced document exists in the database.

We initially found a tool that fit the bill called Couchtato. Unfortunately, it is no longer actively maintained and lacked a number of features we needed. As a result, it was forked and has evolved into a new tool called Couchit, which we will use going forward.

Finally, we’ve created a schema registry that defines a number of high-level document “types” with standard properties. We use this to perform automated document validation using JSON Schema via AWS Lambda functions, as well as provide filtered replication.

What are your future plans with your project? Any cool plans or developments you want to promote?

Our current efforts are focused on our initial launch and the related operational data requirements. Once users start using the application and generating parts, vehicle setups, and running simulations we will start getting a rich set of data that can be used to build systems for analysis, reporting, and as inputs for machine learning.

 

For more about CouchDB visit couchdb.org or follow us on Twitter at @couchdb

Have a suggestion on what you’d like to hear about next on the CouchDB blog? Email us!

CouchDB Developer Profile: Garren Smith

On the road to CouchDB 2.0 last fall, Garren Smith introduced us to Fauxton, the new CouchDB web interface. Garren is the founder of Red Comet Labs, frequent PouchDB contributor, and an Apache CouchDB Project Management Committee (PMC) member.

He recently shared what’s new with Fauxton and his favorite latest feature in the project.

Do you want to talk about your background, or how you got involved in CouchDB?

I first discovered CouchDB in 2010, when I was investigating NoSQL databases. I really liked the way CouchDB worked. My first real usage was in 2012, where I used it in a product, Classroom 7, that I built with my wife. CouchDB was a very effective database to use for Classroom 7. The CouchDB community was also really friendly; so much so that I started looking for ways I could contribute. Around that time Cloudant had also started development on a new web dashboard, which was part of CouchDB, called Fauxton. Because I knew JavaScript, this was the perfect side of the project for me to get involved with.

What areas of the project do you work on?

I have done quite a lot of work on Fauxton, the CouchDB 2.0 web user interface. I am also a PouchDB contributor: my main contributions have been to pouchdb-find, which is PouchDB’s implementation of CouchDB Mango, the new query interface for CouchDB 2.0. Doing the PouchDB work has led me to work on CouchDB Mango, where I make sure that the two play nicely together and also squash any bugs I find along the way.

What’s a recent development/event/aspect of the project that you’re excited about?

There are a few new features that we are currently working on, or have just finished, that I think are really exciting.

The new Replicator and Replicator API, which has just landed in master, is exciting and brings some great performance and stability improvements.

We are working on making it possible to add different storage backends to CouchDB, so in the future it might be possible to use something like RocksDB or InnoDB as the backend for CouchDB. I think this could open up some interesting use cases and possibilities.

I’ve also noticed an increased usage of CouchDB and PouchDB together. This is really fantastic, as it allows developers to create great offline-first applications. For me offline-first applications have such great user-experience advantages, so I’m excited to see PouchDB growing in popularity.

What do you think are the top three benefits of using CouchDB as a database solution?

  • CouchDB’s replication, combined with PouchDB, allows developers to build interesting applications that work even when the user is offline.
  • CouchDB 2’s support for clustering means that CouchDB is a lot more fault-tolerant.
  • CouchDB is a proven technology. It’s been around for a while and has been used in a variety of applications. It’s a database you can trust.

What do you look forward to in the future of CouchDB?

Short term, I’m excited by a lot of the performance and stability fixes we have made since the release of CouchDB 2.0. I’m looking forward to our next release which will include all of these improvements.

The new Replication user interface in Fauxton is really cool and it supports the new Replication API. These two together will make replication more powerful and much easier to use.

In the long term we have planned a set of features that will improve the database per user paradigm; I think this will have massive benefits for people using PouchDB with CouchDB.

CouchDB has a vibrant community and a dedicated team of developers – the future is bright.

What advice do you have for someone who just discovered CouchDB?

CouchDB is an exciting and interesting database to use. If you are coming from the SQL world, it could be a little daunting, since it requires a bit of a mind shift in how you store and retrieve your data. It’s a good idea to first understand the concept of a document-orientated database before diving in completely. Start with the basics, use Mango for querying, and then add a dash of PouchDB for maximum enjoyment.

 

For more about CouchDB visit couchdb.org or follow us on Twitter at @couchdb

Have a suggestion on what you’d like to hear about next on the CouchDB blog? Email us!