Pp2pbuilders
learn › Holepunch walkthroughs

8 min read · also at #/learn/hp-pear

Pear: run, stage, release, seed

Pear is Holepunch's runtime for P2P applications:
desktop and terminal apps that load from a pear:// link — peer-to-peer,
not from a store or a CDN.

Run someone's app

npm i -g pear
pear                      # first run bootstraps the runtime
pear run pear://dqz1e6fwyrz1mxj7eqsmcar3hnegrj491t5hnqjm9mda9tz8dzfy

That last command is p2pbuilders itself: Pear resolves the key on the DHT,
replicates the app's Hyperdrive from whoever seeds it, and runs it locally.

Anatomy of a Pear app

A Pear app is a directory with a package.json carrying a pear field:

"pear": {
  "name": "p2pbuilders",
  "type": "terminal",
  "main": "src/terminal/main.js"
}

type: "terminal" gives you a TUI on Bare — no browser,
no Electron. Desktop GUI apps use the same flow with an HTML entry.

Ship your own

pear touch                          # mint a pear:// key (once per app)
pear stage --no-ask pear://<key> .  # sync working tree → versioned build
pear release pear://<key> .         # point the bare link at that build
pear run pear://<key>               # anyone, anywhere

Staging publishes your tree as a Hyperdrive under the key. Release
marks the version that a bare pear run Legacy app — migration required: pear://<key> resolves to — so you
can stage experimental builds without breaking users.

Two gotchas from our own staging sessions:

/tmp/yourapp and stage from there.

process alive, or pin the drive on relays
(Staying online).

Full docs: https://docs.pears.com

« Trust without a boss Bare: the small JS runtime »