LokiJS has reached version 1.4, with a Nativescript adapter and a pure JavaScript full-stack framework.

LokiJS is a lightweight JavaScript document-oriented database that stores data in-memory and prioritises performance.You can use column indexes for document access and it has a built-in DynamicView class that can be used on data subsets. It replaces SQLite in Cordova, works as a session store and full blown NoSQL db in node.js, and also works as in-browser database with syncing capabilities.

It supports collections, much like MongoDB, and saves data to disk in JSON. This allows you to resume state across sessions, and means your data is portable. There's a sandboxed environment where you can try out LokiJS:

The improvements to the new version add a NativeScript adapter so LokiJS can persist data in apps written with NativeScript. Nativescript is gaining ground among developers of apps for mobile devices because of its performance compared to Cordova and Phonegap. Being able to persist data in NativeScript apps is, according to Joe Minichino, chief developer of LokiJS, "a huge bonus", especially as storage options usually used in browsers such as localStorage or indexeddb are not available in NativeScript. This is due to the fact that the apps are compiled to native code, rather than being wrapped in native webviews, as is the case for Cordova/ and Phonegap.

The JavaScript full-stack framework is called LE∆N, with a delta rather than an A in the name. This reflects the fact that the front-end framework is changeable, so you could use Angular, React, or VueJS, for example. The rest of the name is derived from L for Loki, E for Express, and N for node. The developers say that LE∆N is the first pure JavaScript stack, which means you can install everything from the database to the front-end in one npm install. Minichino told us that the framework is still under development. The supported rendering engines in the current version are EJS and Jade.

LokiJS has benefitted from the development of a number of persistence adapters since it was first released. In addition to NativeScript, there is a Cordova-FS adapter that writes files to filesystem on mobile; and msgpack which utilizes msgpack instead of JSON to provide a faster, more compressed solutoin. There is also a loki-session project that utilizes LokiJS for storing sessions with ExpressJS.

Going forward, the developers plan to develop a persistence adapter more suited to server-side needs, so that instead of serializing the entire db in one file, it will store separate collections in separate files.





More Information

LokiJS Site

Related Articles

LokiJS, A JavaScript Database

To be informed about new articles on I Programmer, sign up for our weekly newsletter,subscribe to the RSS feed and follow us on, Twitter, Facebook, Google+ or Linkedin.







Comments



Make a Comment or View Existing Comments Using Disqus





or email your comment to: comments@i-programmer.info