Skip to content
Textile's JS client for interacting with remote Threads
TypeScript JavaScript
Branch: master
Clone or download
asutula Update readme (#124)
Signed-off-by: Aaron Sutula <>
Latest commit 8c3f7f5 Feb 14, 2020


Made by Textile Chat on Slack Threads version GitHub license Build status

Textile's JS client for interacting with remote Threads

Go to the docs for more about Textile.

Join us on our public Slack channel for news, discussions, and status updates. Check out our blog for the latest posts and announcements.

Table of Contents


npm install @textile/threads-client

Usage in Typescript

create a threads client

import {Client} from '@textile/threads-client'

client = new Client()

create a threads client using Textile APIs

import {API} from '@textile/textile'
import {Client} from '@textile/threads-client'

const api = new API({
    token: '<project token>',
    deviceId: '<user id>'
await api.start()

const client = new Client(api.threadsConfig)

create a store

const store = await client.newStore()
await client.registerSchema(, 'Folder2P', schema)

join a store by invite

const store = await client.newStore()
await client.registerSchema(, 'Folder2P', schema)
try {
  const some = await client.startFromAddress(,
} catch(err) {

get all entries

const found = await client.modelFind(this.finderID, 'Folder2P', {})
console.debug('found:', found.entitiesList.length)
this.folders = => entity).map((obj) => {
  return new YourModel(obj)

add an entry

// matches YourModel and schema
const created = await client.modelCreate(this.finderID, 'Folder2', [{
  some: 'data',
  numbers: [1, 2, 3]

React Native

The following has been tested on Android Only.

js-thread-client should be compatible with React Native. Here are some helpful pointers if you find issues testing it out.

Connecting to the threads daemon

You can run the daemon released as part of the early preview. To do so,

git clone
cd go-threads
go run threadsd/main.go

Make daemon available to RN

You can make the daemon API port available to your app with,

adb reverse tcp:6007 tcp:6007

Altenatively, you can ensure this is run whenever you run your app by modifying your package.json as follows.

  "scripts": {
    "bind": "adb reverse tcp:6007 tcp:6007",
    "android": "npm run bind && npx react-native run-android",

Then, run your app with,

npm run android

Buffer not found

js-threads-client relies on Buffer being available. To make Buffer available in your project, you may need to introduce a shim. Here are the steps.

install rn-nodeify

read more about rn-nodeify.

npm install -G rn-nodeify

run nodeify in the root of your project

rn-nodeify --install buffer --hack

This will create a shim.js in the root of your project. You need to import this at the top of your apps entry file (e.g. indes.js).

The top of index.js would look like,


add nodeify to your postinstall

Ensure that the shim is still configured after any module updates. Inside package.json add the following line to your scripts tag,

  "scripts": {
    "postinstall": "rn-nodeify --install buffer --hack"


To build the (Markdown-based) documentation output to the docs folder, run:

npm run docs


This project is a work in progress. As such, there's a few things you can do right now to help out:

  • Ask questions! We'll try to help. Be sure to drop a note (on the above issue) if there is anything you'd like to work on and we'll update the issue to let others know. Also get in touch on Slack.
  • Open issues, file issues, submit pull requests!
  • Perform code reviews. More eyes will help a) speed the project along b) ensure quality and c) reduce possible future bugs.
  • Take a look at the code. Contributions here that would be most helpful are top-level comments about how it should look based on your understanding. Again, the more eyes the better.
  • Add tests. There can never be enough tests.

Before you get started, be sure to read our contributors guide and our contributor covenant code of conduct.


Changelog is published to Releases.



You can’t perform that action at this time.