Home

Awesome

<p align="center"> <a href="https://dappkit.io" title="AvionDB"> <img src="https://bafzbeiekuueascn2ltb23u4d3v2osrratsppwcur3ermbd2g6v62vmv56u.textile.space/aviondb/assets/github.png" alt="AvionDB JS Implementation" width="512" /> </a> </p> <h3 align="center">AvionDB: A Distributed, MongoDB-like Database</h3> <p align="center"> <a href="https://badge.fury.io/js/aviondb"><img src="https://badge.fury.io/js/aviondb.svg" /></a> <a href="https://img.shields.io/badge/Node.js-%3E%3D8.6.0-orange.svg?style=flat-square"> <img src="https://img.shields.io/badge/Node.js-%3E%3D8.6.0-orange.svg?style=flat-square" /></a> <a href="https://github.com/dappkit/aviondb/workflows/Node.js%20CI/badge.svg"><img src="https://github.com/dappkit/aviondb/workflows/Node.js%20CI/badge.svg" /></a> <a href="https://david-dm.org/dappkit/aviondb"><img src="https://david-dm.org/dappkit/aviondb.svg?style=flat-square"/></a> <a href="https://bundlephobia.com/result?p=aviondb"><img src="https://flat.badgen.net/bundlephobia/minzip/aviondb"></a> <a href="https://discord.gg/88YpNuQ"><img src="https://img.shields.io/discord/616677539812868097?color=blueviolet&label=discord"></a> </p>

Architecture

AvionDB Architecture

AvionDB uses OrbitDB stores to model MongoDB-like Databases. It creates a notion of:

See more details in the Specs.

Project status & support

Status: in active development

NOTE! AvionDB is alpha-stage software. It means AvionDB hasn't been security audited and programming APIs and data formats can still change. We encourage you to reach out to the maintainers if you plan to use AvionDB in mission critical systems.

This is the TypeScript implementation and it works with Browsers, Node.js & TypeScript with support for Linux, OS X, and Windows . The minimum required version of Node.js is now 8.6.0 due to the usage of ... spread syntax. LTS versions (even numbered versions 8, 10, etc) are preferred.

Table of Contents

<!-- toc -->

Install

This module uses node.js, and can be installed through npm:

Using NodeJS

// Using npm
npm install --save aviondb

// Using Github
npm install git+https://github.com/dappkit/aviondb.git

We support both the Current and Active LTS versions of Node.js. Please see nodejs.org for what these currently are. The minimum required version of Node.js is now 8.6.0 due to the usage of ... spread syntax. LTS versions (even numbered versions 8, 10, etc) are preferred.

In a web browser

through Browserify

Same as in Node.js, you just have to browserify to bundle the code before serving it.

Note: The code uses es6, so you have to use babel to convert the code into es5 before using browserify.

through webpack

Same as in Node.js, you just have to webpack to bundle the the code before serving it.

Note: The code uses es6, so you have to use babel to convert the code into es5 before using webpack.

from CDN

Instead of a local installation (and browserification) you may request a remote copy of AvionDB from unpkg CDN.

To always request the latest version, use the following:

<!-- loading the minified version -->
<script src="https://unpkg.com/aviondb/dist/aviondb.min.js"></script>

CDN-based AvionDB provides the AvionDB constructor as a method of the global window object. Example:

// create an AvionDB instance
const aviondb = await AvionDB.init("DatabaseName", ipfs);

See examples/index.html to check out a fully functioning example for AvionDB with browser.

Usage

We are upgrading AvionDB to newer versions of js-ipfs. For now, please use js-ipfs@0.44.0

Example

// Import modules
import AvionDB from "aviondb";
import IPFS from "ipfs";

const runExample = async () => {
  const ipfs = await IPFS.create();

  // Creates a db named "DatabaseName" in the ".aviondb" directory in the project root.
  // If no path option is defined, $HOME/.aviondb is used for the database directory (e.g. "C:/Users/John/.aviondb" or "~/.aviondb").
  const aviondb = await AvionDB.init("DatabaseName", ipfs, {
    path: "./.aviondb",
  });

  // Returns the List of database names
  await AvionDB.listDatabases();
  // prints ['DatabaseName']

  // Creates a Collection named "employees"
  const collection = await aviondb.initCollection("employees");

  // Returns the List of collection names
  await aviondb.listCollections();
  // prints ['employees']

  // Adding an employee document
  await collection.insertOne({
    hourly_pay: "$15",
    name: "Elon",
    ssn: "562-48-5384",
    weekly_hours: 100,
  });

  // We also support multi-insert using collection.insert()
  // See https://github.com/dappkit/aviondb/blob/master/API.md

  // Search by a single field Or many!
  var employee = await collection.findOne({
    ssn: "562-48-5384",
  });

  // We also support find(), findById()
  // See https://github.com/dappkit/aviondb/blob/master/API.md

  // Returns the matching document
  console.log(employee);
  // Prints the above added JSON document

  // Update a document
  var updatedEmployee = await collection.update(
    { ssn: "562-48-5384" },
    { $set: { hourly_pay: "$100" } }
  );

  // We also support updateMany(), findOneAndUpdate()
  // See https://github.com/dappkit/aviondb/blob/master/API.md

  // Returns the updated document
  console.log(updatedEmployee);
  // Prints the updated JSON document

  // await collection.close(); // Collection will be closed.
  // await aviondb.drop(); // Drops the database
  // await aviondb.close(); // Closes all collections and binding database.
  // await ipfs.stop();
};

runExample();

See FAQs Section for more examples on how to use AvionDB in your project.

API

See API.md for the full documentation.

Development

Run Tests

npm test

Benchmarks

Run Write Benchmark

npm run benchmarks:write

Run Query Benchmark

npm run benchmarks:query

Run Update Benchmark

npm run benchmarks:update

See benchmarks/ for more info on benchmarks.

Specs

We are working on the initial Specs. See AvionDB Specs doc

Projects using AvionDB

Frequently Asked Questions

Are there implementations in other languages?

We are working to implement AvionDB for following languages:

The best place to find out what is out there and what is being actively worked on is likely by asking in the Discord.

If you want or are planning to create an implementation in a language that is not listed here, then feel free to reach us out and discuss about it in the Discord.

Where can I see your Roadmap?

You can find our Roadmap here. The features in the Roadmap are taken from 2 separate issues(#7, #8) which individually maintain a list of feature proposals related to OrbitDB-specific improvements & AvionDB-specific improvements respectively.

The Roadmap is an open discussion, feel free to add your suggestions, comments.

What mongodb features does aviondb support?

You can find all the supported MongoDB-like features in our API docs.

How can I use AvionDB in my Application?

You can see the following examples to get started with AvionDB:

Other Questions?

If you didn't find the answer to your question(s), feel free to reach us out on Discord.

Contributing

Take a look at our organization-wide Contributing Guide.

As far as code goes, we would be happy to accept PRs! If you want to work on something, it'd be good to talk beforehand to make sure nobody else is working on it. You can reach us on Discord, or in the issues section.

If you want to code but don't know where to start, check out the issues labelled "help wanted", "discussion".

Please note that we have a Code of Conduct, and that all activity in the @dappkit organization falls under it. Read it when you get the chance, as being part of this community means that you agree to abide by it. Thanks.

Sponsors

The development of AvionDB has been sponsored by:

If you want to sponsor developers to work on AvionDB, please consider sponsoring using the "Sponsor" button on the top of the AvionDB Github Page.

License

MIT