Skip to content

CodeTheEarth/flareDb

Repository files navigation

FlareDB 🔥

Table of Contents

Introduction:

FlareDb is an ongoing project that focuses on simplicity and efficiency. It is intended to be a self hosted database where individuals will be able to host and use with ease. The purpose of FlareDb is not to compete with the likes of sqlite, mongodb and so on but rather to aid our organisation CodeTheEarth

Features:

  • JSON document based database (inspo from mongodb)
  • Single .db file database(inspo from sqlite)
  • Indexing
  • Ease of use
  • Zero external dependencies
  • Low ram usage (10k documents -> 38mb ram aproximately)

Why Project FlareDB

Project flareDB as stated above is to aid our organisation CodeTheEarth with a personal self hosted database to run our operations. That said, this is a completely open source project meaninig other developers can contribute, sponsor, take inspo from and self use for themselves >_<. This project should effectively solve the issues facing our organisation and other developers which relates to complexity of other databases and for some.. pricing.

How to use

First make sure you have node installed

  • Installing dependency:
npm install https://github.com/codetheearth/flaredb
  • Initializing a database
const db = new Flare("users.db");
  • Creating a new document
const Users = db.collection("users", { name: "string", age: "number" }); //example schema
  • Inserting into documents
await Users.put({ name: "Haki", age: 18 });
  • Return whole document
const all = await Users.find();
console.log("All users:", all)
  • Find one
const haki = await Users.findOne({ name: "Kaima" });
console.log("Find one:", haki.age);
  • Update
await Users.updateOne({ name: "Haki" }, { age: 19 }); // update first match
await Users.updateMany({ age: 20 }, { age: 21 }); // bulk update
  • Delete
await Users.deleteOne({ name: "Kaima" }); // delete first match
await Users.deleteMany({ age: 21 }); // delete all matches
await Users.clear(); // wipe entire collection

FlareCache

This is a simple redis like key value pair db for things like cache and so on

How to use FlareCache?

const cache = new FlareCache()
await cache.set("name", "haki")
console.log(cache.get("name"))

Contributors

Other contributors

CODE THE EARTH !!

About

syntax of mongoose, freedom of sqlite

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •