Quick Look
DStack is under heavy development, currently some docs is not finished yet
Let's discover DStack in less than 15 minutes.
Introduction
DStack was created to bring together some of the popular libraries/technologies for the decentralized web (like IPFS) into a single ecosystem to provide an easy way for developing decentralized web applications where your infrastructure is a single source of truth.
For example, you can use PubSub API to create real-time events client-side
or Shard API to share temporary/preview files or structured data between clients without the need to upload to your servers
For example, you can create a collaborative real-time WYSIWYG editor with file preview support where all events and file previews are handled without your server infrastructure.
WYSIWYG Demo
Play with DStack in browser console
Add DStack to your project
- Yarn
- NPM
yarn add @dstack-js/lib
npm i -S @dstack-js/lib
Initialize Stack
- Public Relay
- Custom Relay
- Non-browser environment
import { Stack } from '@dstack-js/lib';
console.log('My Peer ID is:', stack.id);
import { Stack } from '@dstack-js/lib';
const stack = await Stack.create({
namespace: 'namespace',
relay: 'https://relay.dstack.dev:443/graphql'
});
console.log('My Peer ID is:', stack.id);
import { Stack } from '@dstack-js/lib';
import wrtc from '@dstack-js/wrtc';
const stack = await Stack.create({
namespace: 'namespace',
wrtc
});
console.log('My Peer ID is:', stack.id);
Interact with PubSub
stack.pubsub.subscribe('topic', (msg) => {
console.log('Received a message', msg.from, msg.data);
});
stack.pubsub.publish('topic', 'Hello, DStack!');
Interact with Store
// Set value
const shard = await Shard.new(stack, ShardKind.Object, {hello: 'world'})
await stack.store.set('hello', shard));
// Get value
const shard = await stack.store.get('hello');
Tell others that you use DStack
Here is an badge for you:
[](https://dstack.dev)
We are searching for projects who are interested to use DStack in production to collect feedback, bug reports and feature requests, you can apply here