Socket
Socket
Sign inDemoInstall

@fieldfare/core

Package Overview
Dependencies
147
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @fieldfare/core

Backend framework for distributed networks


Version published
Maintainers
1
Created

Readme

Source

Contributors Forks Stargazers Issues ISC License LinkedIn


Logo

Fieldfare

A backend framework for distributed networks
Explore the docs »

View Demo · Report Bug · Request Feature

Table of Contents
  1. About The Project
  2. Getting Started
  3. Usage
  4. Roadmap
  5. Contributing
  6. License
  7. Contact
  8. Acknowledgments

About The Project

Product Name Screen Shot

We have built a framework to solve some of our problems with data property. Depending on big datacenters, paying for DNS and fixed IPs to store your data is not fair, but micro datacenters like the ones small businesses can have are just not stable enough for any serious task. But using many microdatacenters spread in more than one location could solve the problem, provided that they can share information between them efficiently in real time.

Fieldfare is a library that uses Distributed Hash Tables to store data in a way that cannot be corrupted by malicious nodes, and Version Control to manager users, network configuration and services definitions. This way, no central authority is necessary, since anyone in teh "admins" group can commit changes to the environment, that are replicated by all the other participants.

(back to top)

Main Concepts

Resources

Resource is the name given to any chunk of data that is used inside the enviroment. All resources are identified by the hash of their content. This way they can be stored anywhere and retrieved from any potentially malicious source withou the fear of data corruption.

Local Host

Any instance running Fieldfare must implement a Local Host to be able to talk to the network. A host is basically a store for a key pair that is used to sign every message generate locally. Another use of the key pair is for unique identification: every host is identified by the hash of their public key in JWK format.

Environment

The environment is an object that is kept under version control and is identified by an UUID, it can be edited by anyone that is under the "admins" group. Valid changs include adding other admins and removing itself, or editing any property of the environment (except its UUID).

The basic properties of the enviorment are its Services and lists of providers of eac service. Also there is a list of webports, that wll be explained ahead.

Services

TODO

Webports

TODO

Built With

(back to top)

Getting Started

Fieldfare can be used in two ways: it can run standalone using the CLI tools or you can integrate it to a larger project. Standalone services are useful to manage data and workload in the backend. When you are integrating it, usually you are building a graphical UI (an 'app' or web interface) to view and change the environment.

Prerequisites

Install the library via npm

  • npm
    npm install fieldfare
    

CLI Tools

The CLI tools can be used to setup a service written in javascript as a standalone server. They can also be used to configure the environment, adding or removing admins, services, authorizations and webports.

ffsetup

This tools is used to edit only the Local Host information, all changes performed here are stored locally in the folder you are currently working. All the options that this tool offers can be acessed from the menu by calling:

ffsetup

The first this to do when setting up a service is to generate the host private key. This option is accessible via 'Local Host > Generate Private Key'. This will overwrite any previosu key information, discarding it forever, so beware.

After the key is generated, the host will receive ad ID, you can copy it since this will be the identification of the host you are setting up and can be used if you are integrating to an already existing environment and will need to add an authorization.

To define the UUID of the environment, use "Environment > Set UUID". By doing this you will scrap any previous UUID defined, so if you didn't have a copy of it, beware.

The last step is to add a "Boot Webport" and is not always needed. This information is used to perform a bootstrap of the host when it is freshly configured and needs to find another enviroment participants to exchange information. If this service will be a central node, probably the other hosts will find it via its public IP that can be configured later.

ffconf

This tool is used to edit the Environment data directly. All changes performed via ffconf are propagated to all environment participants and permanently stored everywhere. Since the configuration is sotored locally, please perform this step in teh sam eworking folder where you previously called ffsetup.

To access the tool menu, you must call:

ffconf menu

TODO: Configuration steps;

ffrun <path_to_service>

This step will import a JS module that implements the service methods according to its definition. All information from ffsetup will be used to setup the host and connect to the enviroment.

(back to top)

Setup

In your code, import ffinit according to the platform you are using:

If you are using Node.js, you can import like this:

import {ffinit} from 'fieldfare/node';

This will also implement a WebSocket Server and a UDP Transceiver, please check the section about Webports to learn how to define the ports where the server will listen. The node setup will use LevelDB to sotre all non-volatile objects and resources used by the environment you are connecting to.

Or, if you are building for the browser, please do the following:

import {ffinit} from 'fieldfare/browser';

This will implement a WebSocket client Transceiver only, that cannot receive incomming connections. The browser setup will use IndexedDB to store all non-volatile objects and resources.

Define a UUID in string format to uniquely identify your data environment, that must be the same for all participants:

const envUUID = '3481b164-58ac-4c68-8d9a-7e3c85839ca5';

Warning: please don't use this UUID, it was randomly generated for this example only. You can generate a random UUID in any online service (https://www.uuidgenerator.net/version4) or use a library like:

npm i uuid

Now you can initilize the LocalHost and Environment like this:

var env;

try {
  ffinit.setupLocalHost();
  ffinit.setEnvironmentUUID(envUUID);
  env = ffinit.setupEnvironment();
} catch (error) {
    console.error('Fieldfare Initialization failed: ' + error);
}

(back to top)

Roadmap

  • B-Tree Removal, done on v0.1.0
  • B-Tree Map Structure
  • Routing
  • Planning

See the open issues for a full list of proposed features (and known issues).

(back to top)

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

(back to top)

License

Distributed under the ISC License. See LICENSE.txt for more information.

(back to top)

Contact

Adan Kvitschal - adan@moduhub.com

Project Link: https://github.com/moduhub/fieldfare

(back to top)

Acknowledgments

(back to top)

Keywords

FAQs

Last updated on 12 Jun 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc