NoSQL DBs and AppStudio

From NSB App Studio
Revision as of 19:59, 19 August 2015 by Rcarraretto (talk | contribs)
Jump to navigation Jump to search

A Little Bit of Background

Before I get into the real thing, I'd like to first share a bit of history:

If you have been into WebApp creation, you probably realized that it is not just the application itself, you'll need to also have other stuff on your backend to be able to make the application meaningful. Considering I'm an old-fashioned programmer, I initially chose the "comfort zone" and had my server based on a LAMP model (Linux-Apache-MySQL-PHP, while other might prefer WAMP. You can figure out what W stands for).

The MySQL part was easy and creating all the tables and relationships was kind of fun and reminded me of the joy of normalizing data and creating all those relationships, indexes, views and so on. Then I had to think about the hard part: how could I interact with the server DB from my app? Easy: PHP as the frontend and I'm done. A friend of mine recommended a look on APIgility and it realy helped with the API-like heavy-lifting and it was quite easy to implement a RESTful HAL+JSON API on top of it, talking to my MySQL database.

Next step, why not cache some records on the WebApp WebSQL (or SQLite if you prefer). By doing this, the app will look faster and it will also work offline. I started coding the caching mechanism and after a long couple months I realized that I was spending much more time on programming the "support" for my application than the application itself.

Now enter CouchDB/PouchDB. If these names sound weird, you definitely should Google about them.


CouchDB

CouchDB is a initiative from Apache Software Foundation that supports a "Database for the Web" (as the creators refer to CouchDB). It is a NoSQL, document-store database, that has several neat features that can really help speeding up your WebApp development:

1) It is fast enough for most applications; 2) The documents are stored as JSON objects; 3) It provides authentication for your users; 4) It is only accessible through HTTP, which makes it perfect for Ajax calls within AppStudio; 5) It can synchronize seamlessly to other CouchDB instances; 6) It's free, and there are PouchDB-like Cloud providers, where you can host your DB for free!


PouchDB

PouchDB is a JavaScript implementation of CouchDB.

PouchDB is