Code Monkey home page Code Monkey logo

helia's Introduction

Helia logo

ipfs.tech Discuss codecov CI

Helia is a lean, modular, and modern TypeScript implementation of IPFS for the prolific JS and browser environments.

See the Manifesto, the FAQ, and the State of IPFS in JS blog post from October 2022 for more info.

๐ŸŒŸ Usage

A quick overview of how to get different types of data in and out of your Helia node.

๐Ÿชข Strings

You can use the @helia/strings module to easily add and get strings from your Helia node:

import { createHelia } from 'helia'
import { strings } from '@helia/strings'

const helia = await createHelia()
const s = strings(helia)

const myImmutableAddress = await s.add('hello world')

console.log(await s.get(myImmutableAddress))
// hello world

๐ŸŒƒ JSON

The @helia/json module lets you add or get plain JS objects:

import { createHelia } from 'helia'
import { json } from '@helia/json'

const helia = await createHelia()
const j = json(helia)

const myImmutableAddress = await j.add({ hello: 'world' })

console.log(await j.get(myImmutableAddress))
// { hello: 'world' }

๐ŸŒ  DAG-JSON

The @helia/dag-json allows you to store references to linked objects as CIDs:

import { createHelia } from 'helia'
import { dagJson } from '@helia/dag-json'

const helia = await createHelia()
const d = dagJson(helia)

const object1 = { hello: 'world' }
const myImmutableAddress1 = await d.add(object1)

const object2 = { link: myImmutableAddress1 }
const myImmutableAddress2 = await d.add(object2)

const retrievedObject = await d.get(myImmutableAddress2)
console.log(retrievedObject)
// { link: CID(baguqeerasor...) }

console.log(await d.get(retrievedObject.link))
// { hello: 'world' }

๐ŸŒŒ DAG-CBOR

@helia/dag-cbor works in a similar way to @helia/dag-json but stores objects using Concise Binary Object Representation:

import { createHelia } from 'helia'
import { dagCbor } from '@helia/dag-cbor'

const helia = await createHelia()
const d = dagCbor(helia)

const object1 = { hello: 'world' }
const myImmutableAddress1 = await d.add(object1)

const object2 = { link: myImmutableAddress1 }
const myImmutableAddress2 = await d.add(object2)

const retrievedObject = await d.get(myImmutableAddress2)
console.log(retrievedObject)
// { link: CID(baguqeerasor...) }

console.log(await d.get(retrievedObject.link))
// { hello: 'world' }

๐Ÿพ Next steps

Check out the helia-examples repo for how to do mostly anything with your Helia node.

๐Ÿƒโ€โ™€๏ธ Getting Started

Check out the Helia examples repo, which covers a wide variety of use cases. If you feel something has been missed, follow the contribution guide and create a PR to the examples repo.

๐Ÿ“— Project Docs

๐Ÿ“’ API Docs

๐Ÿ“ System diagram

graph TD;
    User["User or application"]-->IPNS["@helia/ipns"];
    User-->UnixFS["@helia/unixfs"];
    User-->Libp2p;
    User-->Datastore;
    User-->Blockstore;
    UnixFS-->Blockstore;
    IPNS-->Datastore;
    subgraph helia [Helia]
      Datastore
      Blockstore-->BlockBrokers;
      BlockBrokers-->Bitswap;
      BlockBrokers-->TrustlessGateways;
      Libp2p-->DHT;
      Libp2p-->PubSub;
      Libp2p-->IPNI;
      Libp2p-->Reframe;
    end
    Blockstore-->BlockStorage["File system/IDB/S3/etc"];
    Datastore-->DataStorage["Level/S3/IDB/etc"];
    Bitswap-->Network;
    TrustlessGateways-->Gateway1;
    TrustlessGateways-->GatewayN;
    DHT-->Network;
    PubSub-->Network;
    IPNI-->Network;
    Reframe-->Network;

๐Ÿญ Code Structure

Helia embraces a modular approach and encourages users to bring their own implementations of various APIs to suit their needs.

The basic Helia API is defined in:

The API is implemented by:

Helia also ships a number of supplemental libraries and tools that can be combined with Helia API implementations to accomplish tasks in distributed and trustless ways.

These libraries are not intended to be the "one true implementation" of any given API, but are made available for users to include depending on the need of their particular application:

An interop suite ensures everything is compatible:

Other modules

There are several other modules available outside this repo:

๐Ÿ“ฃ Project status

Helia v1 shipped in 202303 (see releases), and development keeps on trucking as we work on initiatives in the roadmap and make performance improvements and bug fixes along the way.

๐Ÿ›ฃ๏ธ Roadmap

Please find and comment on the Roadmap here.

๐Ÿ‘ซ Get involved

  • Watch our Helia Demo Day presentations here
  • We are sharing about the progress at periodic Helia Demos. This is a good place to find out the latest and learn of ways to get involved. We'd love to see you there!
  • Pick up one of the issues.
  • Come chat in Filecoin Slack #ip-js. (Yes, we should bridge this to other chat environments. Please comment here if you'd like this.)

๐Ÿคฒ Contribute

Contributions welcome! Please check out the issues.

Also see our contributing document for more information on how we work, and about contributing in general.

Please be aware that all interactions related to this repo are subject to the IPFS Code of Conduct.

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

๐Ÿ›๏ธ Notable Consumers/Users

๐ŸŒž Branding

๐Ÿชช License

Licensed under either of

helia's People

Contributors

2color avatar achingbrain avatar autonome avatar betterworld-liuser avatar biglep avatar bjrint avatar dependabot[bot] avatar flamenco avatar galargh avatar github-actions[bot] avatar ipfs-mgmt-read-write[bot] avatar jbenet avatar juliomatcom avatar meandavejustice avatar mmsaki avatar saul-jb avatar semantic-release-bot avatar sgtpooki avatar shuoer86 avatar tinytb avatar vmx avatar web-flow avatar web3-bot avatar whizzzkid avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.