| … | … | @@ -1,8 +1,10 @@ |
| 1 | 1 | # p2pbuilders |
| 2 | 2 | |
| 3 | | A permissionless, peer-to-peer Hacker News clone on the [Pear](https://docs.pears.com/) + [Bare](https://github.com/holepunchto/bare) stack. Single feed, one hypercore per identity, hashcash-gated posts, reputation-weighted voting. Posts are mirrored across the [p2p-hiverelay](https://github.com/bigdestiny2/P2P-Hiverelay) network so they stay online when authors close their laptops. |
| 3 | A permissionless, peer-to-peer Hacker News clone that lives **entirely in your terminal**. One feed, one hypercore per identity, hashcash-gated posts, reputation-weighted voting — built on the [Pear](https://docs.pears.com/) + [Bare](https://github.com/holepunchto/bare) stack. Posts are mirrored across the [p2p-hiverelay](https://github.com/bigdestiny2/P2P-Hiverelay) network so they stay online when authors close their laptops. |
| 4 | 4 | |
| 5 | | Repo: https://github.com/bigdestiny2/p2pbuilders · Live: `pear run pear://gopfpwat99tcuaakasfnftrds3j6t7srdmi3qidbhm9xeizt1a5y` |
| 5 | It's a **TUI** — no browser, no webview, no GUI. You run one command and drive the whole board from the `›` prompt. |
| 6 | |
| 7 | Repo: https://github.com/bigdestiny2/p2pbuilders · Live: `pear run pear://dqz1e6fwyrz1mxj7eqsmcar3hnegrj491t5hnqjm9mda9tz8dzfy` |
| 6 | 8 | |
| 7 | 9 | ## Try it |
| 8 | 10 | |
| … | … | @@ -17,15 +19,68 @@ export PATH="$HOME/Library/Application Support/pear/bin:$PATH" |
| 17 | 19 | Run p2pbuilders: |
| 18 | 20 | |
| 19 | 21 | ``` |
| 20 | | pear run pear://gopfpwat99tcuaakasfnftrds3j6t7srdmi3qidbhm9xeizt1a5y |
| 22 | pear run pear://dqz1e6fwyrz1mxj7eqsmcar3hnegrj491t5hnqjm9mda9tz8dzfy |
| 21 | 23 | ``` |
| 22 | 24 | |
| 23 | | Type `help` at the prompt. |
| 25 | You'll land on the feed. Type `help` at the `›` prompt, or `submit "hello"` to say hi. |
| 26 | |
| 27 | ## Using it |
| 28 | |
| 29 | The whole app is keyboard-driven from the `›` prompt. Type `help` any time to see this list in-app. |
| 30 | |
| 31 | **Feed** |
| 32 | |
| 33 | | command | what it does | |
| 34 | | --- | --- | |
| 35 | | `submit` | new post — opens the multi-line editor | |
| 36 | | `submit "title" <body>` | new post in one line | |
| 37 | | `open <n>` | open the thread for post #n | |
| 38 | | `up <n>` / `down <n>` | vote post #n up or down | |
| 39 | | `sort <hot\|new\|top>` | change how the feed is ordered | |
| 40 | | `refresh` / `r` | reload the feed | |
| 41 | |
| 42 | **Inside a thread** |
| 43 | |
| 44 | | command | what it does | |
| 45 | | --- | --- | |
| 46 | | `reply` | reply — opens the multi-line editor | |
| 47 | | `reply <body>` | reply in one line | |
| 48 | | `up` / `down` | vote on the post you're viewing | |
| 49 | | `back` / `b` | return to the feed | |
| 50 | |
| 51 | **Compose editor** (after `submit` / `reply` with no inline text) |
| 52 | |
| 53 | | key | what it does | |
| 54 | | --- | --- | |
| 55 | | `<your text>` | any line joins the body | |
| 56 | | `.` | submit — on its own line | |
| 57 | | `:q` | cancel | |
| 58 | |
| 59 | **Moderation** |
| 60 | |
| 61 | | command | what it does | |
| 62 | | --- | --- | |
| 63 | | `delete <n>` | delete a post (author, or admin for anyone) | |
| 64 | | `delete` | delete the thread you're viewing | |
| 65 | |
| 66 | **Identity + infra** |
| 67 | |
| 68 | | command | what it does | |
| 69 | | --- | --- | |
| 70 | | `nick <name>` | set your nickname | |
| 71 | | `me` | show your pubkey + stats | |
| 72 | | `relays` | which relays are pinning you (or the current thread's author) | |
| 73 | | `opid <n>` | print a post's opId | |
| 74 | | `quit` / `q` | exit | |
| 75 | |
| 76 | > Posts and comments carry a small proof-of-work (~80ms / ~20ms), so there's a brief `minting pow…` pause before they land. That's normal. |
| 24 | 77 | |
| 25 | 78 | ## What's in here |
| 26 | 79 | |
| 27 | 80 | ``` |
| 28 | 81 | src/ |
| 82 | ├── terminal/ |
| 83 | │ └── main.js ← THE APP. the Pear terminal (TUI) entry — readline feed/thread UI |
| 29 | 84 | ├── backend/ shared Node/Bare backend (ops, PoW, indexer, reputation, antispam) |
| 30 | 85 | │ ├── ops.js signed append-only op schema (post, comment, vote, edit, tombstone, |
| 31 | 86 | │ │ follow, block, profile, board_create, blocklist_publish) |
| … | … | @@ -36,22 +91,21 @@ src/ |
| 36 | 91 | │ ├── swarm.js hyperswarm + protomux announce channel for peer discovery |
| 37 | 92 | │ ├── rpc.js JSON-RPC dispatch shared by every transport |
| 38 | 93 | │ └── server.js optional Node HTTP/WS dev server |
| 39 | | ├── terminal/ |
| 40 | | │ └── main.js the Pear terminal entry (readline UI) |
| 41 | 94 | ├── bare/ |
| 42 | 95 | │ ├── harness.js Pear/bare-kit shared backend bootstrap |
| 43 | | │ └── ios-entry.js bare-kit-pear iOS entry |
| 96 | │ └── ios-entry.js bare-kit-pear iOS entry (parked) |
| 44 | 97 | ├── pear/ |
| 45 | 98 | │ └── worker.js Pear desktop worker (parked) |
| 46 | 99 | └── relay/ |
| 47 | 100 | └── server.js self-hosted hiverelay with @hyperswarm/dht-relay endpoint |
| 48 | 101 | |
| 49 | | public/ HTML/CSS/JS for the browser/desktop UI (dev mode) |
| 102 | landing/ static site for p2pbuilders.com |
| 103 | public/ parked browser/desktop UI (dev mode) — not the terminal app |
| 50 | 104 | ios-app/ minimal Xcode project using bare-kit-pear (parked) |
| 51 | 105 | scripts/ |
| 52 | 106 | publish.js publish a directory to hiverelay |
| 53 | 107 | seed-pear.js ask hiverelay to seed a pear:// key |
| 54 | | probe-relays.mjs list relays currently pinning a key |
| 108 | probe-relays.mjs list relays currently pinning the live key |
| 55 | 109 | test/ 41 tests covering every layer |
| 56 | 110 | ``` |
| 57 | 111 | |
| … | … | @@ -78,43 +132,54 @@ git clone https://github.com/bigdestiny2/p2pbuilders.git |
| 78 | 132 | cd p2pbuilders |
| 79 | 133 | npm install |
| 80 | 134 | |
| 81 | | # run the Node dev server (browser at http://localhost:8787) |
| 82 | | npm run dev |
| 83 | | |
| 84 | | # run the terminal app under standalone Bare (no Pear needed) |
| 135 | # run the terminal app (TUI) under standalone Bare — no Pear needed |
| 85 | 136 | ./node_modules/bare/bin/bare src/terminal/main.js |
| 86 | 137 | |
| 138 | # run the optional Node dev server (browser at http://localhost:8787) |
| 139 | npm run dev |
| 140 | |
| 87 | 141 | # run the full test suite (41 tests) |
| 88 | 142 | npm test |
| 89 | 143 | ``` |
| 90 | 144 | |
| 91 | 145 | ## Stage a new build to Pear |
| 92 | 146 | |
| 147 | Staging publishes the current working tree to a `pear://` link that anyone can `pear run`. |
| 148 | |
| 93 | 149 | ``` |
| 94 | | # 1. make sure /tmp/p2pbuilders symlinks to this project (Pear chokes on paths |
| 95 | | # containing spaces inside pear-electron/pre) |
| 150 | # 1. symlink to a space-free path (Pear chokes on paths with spaces in |
| 151 | # pear-electron/pre). |
| 96 | 152 | ln -sfn "$(pwd)" /tmp/p2pbuilders |
| 97 | | |
| 98 | | # 2. stage from the space-free path |
| 99 | 153 | cd /tmp/p2pbuilders |
| 100 | | pear stage --no-ask dev . # prints pear://0.<n>.<key> |
| 101 | 154 | |
| 102 | | # 3. run it |
| 103 | | pear run pear://<that-key> |
| 155 | # 2. generate a fresh link (once per app — reuse it for later builds) |
| 156 | pear touch # prints pear://<key> |
| 157 | |
| 158 | # 3. sync the working tree to that link |
| 159 | pear stage --no-ask pear://<key> . # prints pear://0.<n>.<key> |
| 160 | |
| 161 | # 4. point the unversioned link at this build, so `pear run pear://<key>` |
| 162 | # serves what you just staged |
| 163 | pear release pear://<key> . |
| 164 | |
| 165 | # 5. run it |
| 166 | pear run pear://<key> |
| 104 | 167 | ``` |
| 105 | 168 | |
| 106 | | ## Seed an app or user to hiverelay |
| 169 | ## Keep it online (seed to hiverelay) |
| 107 | 170 | |
| 108 | 171 | ``` |
| 109 | | node scripts/publish.js # publish ./public as a hyperdrive |
| 110 | | node scripts/seed-pear.js pear://<pear-key> |
| 111 | | node scripts/probe-relays.mjs # see which relays are pinning it |
| 172 | node scripts/seed-pear.js pear://<key> # ask relays to pin the app (or any user core) |
| 173 | node scripts/probe-relays.mjs # see which relays are pinning the live key |
| 174 | node scripts/publish.js # publish ./public as a hyperdrive |
| 112 | 175 | ``` |
| 113 | 176 | |
| 177 | `seed-pear.js` stays running so your local replica is available while relays catch up — leave it up, or Ctrl+C once `seeded on N relay(s)` prints. |
| 178 | |
| 114 | 179 | ## Status |
| 115 | 180 | |
| 116 | 181 | **Shipping now:** |
| 117 | | - Terminal app via `pear run pear://…` |
| 182 | - Terminal app (TUI) via `pear run pear://…` |
| 118 | 183 | - Full backend verified with 41 tests |
| 119 | 184 | - Auto-seeding to the public hiverelay network |
| 120 | 185 | |