node package manager
Love JavaScript? Your insights can make it even better. Take the 2017 JavaScript Ecosystem Survey »


Build Status

Hoodie Global Share Plugin

Make selected objects publically accessible via store methods.


hoodie install global-share


The Global Share Plugin extends all promises returned by methods with two additional functions: publish and unpublish.

// publish all my todos'task').publish()
// unpublish specific note'note', 'abc1234').unpublish()

All objects marked as public are accessible (read-only) via the API

// list all public tasks'task').then(showAllPublicTasks)
// update list of tasks on change'task:change', handleTaskChange)

Full Frontend API

add / remove own objects from the public global store

// publish / unpublish can be called on all promises 
// return by any method. 
promise =, attributes).publish()
promise =, id).publish()
promise =, id, attributes).publish()
promise =* type */).publish()
promise =, id, changedAttributes).publish()
promise =* type, */ changedAttributes).publish()
promise =, id).publish()
promise =* type */).publish()
// it works the same on scoped stores 
promise =
promise =, id).update(changedAttributes).publish()
// publish / unpublish return own promises that only resolve 
// if the objects were published successfully on the server 
promise.then(handlePublishSuccess, handleStoreOrPublishError);

access objects from / listen to changes in the public global store

// has all read-only methods from, 
// with the same footprint 
promise =, id)
promise =* type */)
// you can listen on changes as well'add', handleNewObject)'task:change', handleChangedTask)'task:123:remove', handleTask123Removed)

How it works internally

The plugin's worker creates a new database hoodie-plugin-global-share that all objects from all user databases that are marked as public are replicated to.

Calling .publish() on a store method in the frontend adds a $public: true flag to the respecitve objects, that is used by the filtered replications from user databases → hoodie-plugin-global-share database.

Calling .unpublish() uses the hoodie.task API internally to start globalshareunpublish task with object types/IDs to be unpublished. The task gets picked up by the worker which then removes all objects with the passed types/IDs from the hoodie-plugin-global-share database.


We love contributors <3 If you need any help getting started, please don't hesitate to get in touch at any time.

For Questions/Bug reports specific to the Global Share Plugin:

For more generic questions to Hoodie Architecture etc.

If you want to send pull requests, please make sure to add according tests. Run tests with


License & Copyright

Copyright 2012-2014 and other contributors
Licensed under the Apache License 2.0.