Usually you'd get Earthstar into an app by bundling it along with the rest of your code using Browserify, Webpack, Rollup, etc.
This is an alternative, more old-fashioned way: use the "standalone browser build" which is a single, pre-bundled js file containing only Earthstar. Just drop it into your HTML.
npm build-standaloneto generate the standalone bundle in
This needs to be done by hand whenever an npm version is released, and we may sometimes forget to do it. Check the history of those files to see when they were last updated.
We used to put version numbers in the files but it was too much work to update by hand, so now they don't have version numbers. PRs accepted to automate this process :)
The script creates a global named
earthstar which contains all of Earthstar's exported functions etc.
Link it into your HTML in one of these ways:
- Download one of the bundle files from the
dist/directory on github and put it into your own project directory. In your HTML, add
- Or load it from a CDN:
We have 2 example HTML files you can start with: