nanoSQL looks very interesting. I've had a few requirements for more complex data structures in the browser and key/val systems don't work.

NanoSQL gives me a sort of query language for local storage (can be indexeddb, can be websql, the adapter can decide).

Claims:

Universal database layer for the client, server & mobile devices. It's like Lego for databases.

Not so sure about "Lego for dbs", but certainly going to give it a try.

Source: nanosql.io