Question

Assuming you're going to use couchdb, is it realistic to try to just use couchapp in place of django, rails, or asp.net mvc? What would be the benefits and drawbacks?

Was it helpful?

Solution

As it stands, a CouchApp essentially require you to use AJAX for the entire application. Generally speaking, that's poor for user experience, as you are downloading the skeleton markup, running JS, usually hitting the server again, and then adding more markup dynamically. (as opposed to just downloading the finished markup up front) In addition, caching data is a different beast on the browser than it is on a server. Also, SEO is much more difficult when you have AJAX-only content.

Basically, all of the reasons you see people going against AJAX-only (ie. obtrusive JavaScript) web applications, will all hold up in this context.

On the other hand, you would be able to replicate the entire application (as well as all the relevent data) to any node that is running CouchDB. I could see mobile versions of your application running only the CouchApp while offline, since a full web server stack wouldn't necessarily be available to you. In addition, it's easy to get up and running with a CouchApp, as opposed to learning a framework like Rails, Django or Express.js.

I have high-hopes for CouchApps becoming a complete web application solution eventually, as I am a huge fan of CouchDB as a database. However, right now it just isn't feasible for me because of the heavy reliance upon obtrusive JavaScript.

OTHER TIPS

Yes, normally a CouchApp would use AJAX for the whole application, though that's not a requirement. It's possible to create a CouchApp that will provide a fallback and render the core content for browsers without JS (and search engines).

This is normally a little complicated and involes writing your rendering functions twice. Once in the design doc as a show or list function, then again for your client-side code. However, I've been working on a CouchApp framework called Kanso, which allows you to write code once and have it run on the client-side when possible and fall-back to CouchDB when that's not.

Another problem I've found with CouchApps is that the validation and permissions code can get very complicated quickly with a bigger app. So Kanso also provides Type definitions similar to other Model systems you might have used in Django or Rails.

Just to be clear: You will not achieve the same experience for browsers without JS, but what you can do is render the basic content of the page and then progressively enhance it with JavaScript.

This is what Kanso was designed for :)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top