Serve web apps and data from your browser.
Build next generation applications on top of peer-to-peer browser nodes and databases, secured by blockchain.
<script src="https://cdn.io/microverse.js">
Build next generation applications on top of peer-to-peer browser nodes and databases, secured by blockchain.
<script src="https://cdn.io/microverse.js">
Instead of relying centralized servers, Microverse turns browsers into peers to run workloads and serve contents.
// Create new peer, can pass-in which cluster to join, defaults to public cluster
var peer = microverse.peer.create({
clusterId: 'public' // You can create new clusters by signing up
});
// Returns connected peer
// {peerId: 'QmPXMe1o24', peerSecret: 'D3gk5aOb...', clusterId: 'public'}
// Connect to existing peer
// Created and connected peers will be stored in browser until reconnected
var peer = microverse.peer.connect({
peerId: 'QMPXMelo24',
peerSecret: 'D3gk5aOb...',
clusterId: 'public'
})
Microverse comes bundled with a decentralized database.
// Create new database collection
// The current peer will be the admin of the database
peer.db.create('todos');
// As admin, you can allow other peers to access your db
peer.db('todos').addRole({
peerId: 'ABv12Kb',
permission: 'read' // Available permissions: read/write/admin
// read: can only read documents
// write: insert, update. delete documents
// admin: delete db, list/add/remove roles
});
// As admin, you can list all peers and their roles
peer.db('todos').listRoles();
// As admin, you can remove peers' access to your db
peer.db('todos').removeRole({peerId: 'ABv12Kb'});
// Insert document
peer.db('todos').insert({
id: '1',
text: 'Finish hello world tutorial',
completed: false
}).then(() => {
// Do something
});
// Read documents
peer.db('todos').find({
completed: false
}).then(todos => { console.log(todos); });
// Update document
peer.db('todos').update('1', {
$set: { completed: true }
});
// Remove document
peer.db('todos').remove('1');
You can run any NPM and Javascript on any peer using workers.
// Create a worker
var worker = peer.worker.create({
init: () => {
_require('pokemon@latest', (pokemon) => {
window.pokemon = pokemon;
});
},
sean: () => {
return pokemon.random();
}
});
// Run a worker
worker.exec({
fn: () = {
sean();
}
})
You can upload a zip bundle to a peer, and Microverse will be able to serve it as a static website.
// Get website zip bundle from file upload input
var bundle = document.getElementById('file-input').files[0];
// Serve website from connected peer from a connected peer
peer.serve(bundle);
// Returns URL to view website in browser: https://mcvr.se/QMPXMelo24
Store large amounts of data or analytics. Process or analyze them to gather insight without spending money on servers.
Like BitTorrent, you can store, upload and download files peer-to-peer. Significantly that bandwith cost.
Potential to make money without placing ads! Sites with many visitors can get visitors’ browsers to mine cryptocurrencies for them.
Run almost any kind of one-off or long running compute tasks and services, using the CPU, memory and even GPU of the clients.
<script src="https://cdn.io/microverse.js">
npm install --save microverseRead Documentation