Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including barricane-db with all npm packages installed. Try it out:

var barricaneDb = require("barricane-db")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

barricane-db v0.2.0

A NodeJS-based in-process database.

BarricaneDB - a transparent object persistence mechanism for NodeJS.

Status v0.2.0 - Just about works - there will be bugs.

BarricaneDB is a persistence layer for NodeJS which was developed to meet my following requirements:

  • My app's state exists as a heap of objects in RAM. I just want to be able to shutdown my app and get that same heap of objects the next time I start my app.
  • I don't want to have to add or change more than a dozen lines of code.
  • I want a proper transaction log, so that the data is resilient against application crashes.
  • I want to be able to read the transaction log - I care more about making my app easily debuggable than saving disk space.

BarricaneDB is a loose implementation of the Prevalence System Design Pattern, as implemented in Java by Prevaylor, but for NodeJS.


There's also docco-generated, documentation online at


  • npm install barricane-db

Reasons why BarricaneDB will never be a good fit for your application.

  • Your data set is too big to fit in RAM.
  • Your application doesn't happily shard into BarricaneDB's one-DB-per-process design.
  • You need to query your database from outside the NodeJS process - e.g. Crystal Reports.

Reasons why BarricaneDB is not currently a good fit.

  • Your application needs a production-tested solution.
  • You need good error handling.
  • You need async database opening (persistence is already fully async).
  • Transactions are important to you.
  • Your application needs ACID guarantees. BarricaneDB could loose 1-5 seconds of data on a process crash (OS dependent).

Backwards compatibility.

  • We use codecs to separate the data representation from the database.
  • All future versions of BarricaneDB will be able to read v0.2.0 .swoj files.

Keep up with BarricaneDB.


  • Whether I do anything more to this project, beyond functionality required for some of my other projects, really depends on there being some level of interest in the community. If you want things to happen, please watch this project on GitHub and subscribe to the Google Group.
  • Some of the features I'd like to add include:

Change the DB to an emitter and make the open async.

Create a subscribe facility so that webclient-proxy objects can be notified on changes to objects which are displayed on user's browsers.

Create a more efficient delta-codec which only logs the changed fields of registered instances.

Add ACID transactions.

  • Anything you'd like to add? - Create an issue on GitHub.
RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free