/helia-IPFS-JS

An implementation of IPFS in JavaScript

Primary LanguageTypeScriptOtherNOASSERTION

Helia logo

helia

ipfs.tech Discuss codecov CI

🌟 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 = 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' }

🐾 Next steps

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

Table of contents

🥅 Purpose and goals

A lean, modular, and modern 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.

🏃‍♀️ 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-->Bitswap;
      Libp2p-->DHT;
      Libp2p-->PubSub;
      Libp2p-->IPNI;
      Libp2p-->Reframe;
    end
    Blockstore-->BlockStorage["File system/IDB/S3/etc"]
    Datastore-->DataStorage["Level/S3/IDB/etc"]
    Bitswap-->Network;
    DHT-->Network;
    PubSub-->Network;
    IPNI-->Network;
    Reframe-->Network;
Loading

🏭 Code Structure

Helia embraces a modular approach and encourages users to bring their own implementations of interfacing libraries to suit their needs. Helia also ships supplemental libraries and tools including:

These libraries are by no means the "one true implementation", but instead instead provide optionality depending on one's needs.

This repo itself is made up of these packages:

📣 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 enviornments. 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