Skip to content

Installing the JS Core Client

This guide describes how to install the JS Core Client in your JavaScript project.


Installing the JS Core Client requires a console, Node.js v14, and npm v6. Make sure to have these installed on your machine.

While npm v7 is not officially supported, you may still be able to get it to work. Try installing the node-pre-gyp package globally. This is required until node-webrtc, which IPFS depends on, is upgraded.

npm install -g node-pre-gyp

1. Install the Core client

Open your console and install the JS Core Client using npm.

npm install @ceramicnetwork/core

2. Import the Core client

import Ceramic from '@ceramicnetwork/core'

3. Import IPFS with dag-jose

Ceramic utilizes the dag-jose IPLD codec to format and store data in IPFS.

import IPFS from 'ipfs-core'
import dagJose from 'dag-jose'
import { convert } from 'blockcodec-to-ipld-format'

const dagJoseFormat = convert(dagJose)

4. Create an IPFS instance

Create an instance of js-ipfs with dag-jose enabled.

const ipfs = await Ipfs.create({ ipld: { formats: [dagJoseFormat] } })

5. Create a Ceramic instance

Create an instance of Ceramic by passing ipfs and an optional configuration object.

const ceramic = await Ceramic.create(ipfs, config)

6. Import DID resolvers

Import resolvers for all DID methods that this Core Client will support. This should be inclusive of the DID Method that you will use for authentication, but should also include all other DID Methods for which your node could possibly need to verify signatures. Therefore, it is recommended that all Core Clients be able to resolve at least the did:3 and did:key DID methods.

import KeyDidResolver from 'key-did-resolver'
import ThreeIdResolver from '@ceramicnetwork/3id-did-resolver'

7. Create a DID instance

Create a DID instance which wraps an instance of a DID resolver that includes all individual DID resolvers from the previous step. Optionally, it also includes a DID Provider if you intend to authenticate DIDs to allow writes to the network during runtime.

import { DID } from 'dids'
const resolver = { ...KeyDidResolver.getResolver(),
                   ...ThreeIdResolver.getResolver(ceramic) }
const did = new DID({ resolver })

8. Set DID instance on Core client

ceramic.did = did

Next steps

After setting the DID instance on the Core client, your application will now be able to perform queries. If you need to perform writes, proceed to setting up authentication.