/turtleDB

Official turtleDB project

Primary LanguageJavaScriptMIT LicenseMIT

OverviewGetting StartedFeaturesContributorsLicense

Overview

turtleDB is a JavaScript framework and in-browser database for developers to build offline-first, collaborative web applications. It provides a developer-friendly API to access an in-browser database built on top of IndexedDB.

It comes with built in document versioning and automatic server synchronization when paired with our back-end package tortoiseDB, as well as developer-controlled, flexible conflict resolution strategies for any document conflicts while collaborating.

You can check out our API documentation and read more about the story behind project itself here.

Note: for the best user experience we strongly recommend using Chrome.



Getting Started

Install

npm i turtledb

Usage

import TurtleDB from 'turtledb';
// or
const TurtleDB = require('turtledb');
// Create a new database
const mydb = new TurtleDB('example');

// Link a remote tortoiseDB database to sync to
mydb.setRemote('http://127.0.0.1:3000');

// CRUD Operations - all return promises
mydb.create({ _id: 'firstTurtle', species: 'Sea Turtle' });
mydb.read('firstTurtle').then((doc) => console.log(doc));
mydb.update('firstTurtle', { species: 'Giant Turtle' });
mydb.mergeUpdate('firstTurtle', { name: 'Michelangelo' });
mydb.delete('firstTurtle');

// Sync
mydb.sync();

Full API Documentation

Features

  • Simple Promise-based API
  • Integration with IndexedDB
  • Document versioning and developer-controlled conflict resolution
  • Synchronization with tortoiseDB and a MongoDB back-end
  • Batching during synchronization
  • Local database compaction

Contributors

Andrew Houston-Floyd - NYC - Website

Max Appleton - SF/Bay Area - Website

Steven Shen - Toronto - Website

License

This project is licensed under the MIT License.