App patterns
The product-layer shapes — what makes a P2P app feel like an app instead of
a protocol demo.
1. Render from the local view, always
The UI reads only the local fold (Hyperbee views,
merged gossip state) — never "the network". Boot offline shows everything
you had; peers arriving just makes it fresher. This single rule delivers
offline-first as a side effect and makes loading states nearly disappear:
the data is already here.
2. Optimistic writes with visible cost
Your own ops apply locally the instant they are minted — your post is on
screen before any peer has it. When writes carry proof-of-work, show the
mint honestly (minting pow… 80ms, a live counter on the submit button):
perceived honesty beats fake instancy, and it teaches users the spam gate
exists.
3. Soft refresh, never stomp input
Gossip arrives mid-keystroke. Debounce re-renders, and skip them while
focus is in an input — we learned to check document.activeElement
before repainting, and the TUI equivalent (never redraw over compose mode).
Losing a half-typed comment to a refresh is the fastest way to lose a user.
4. Identity UX: keys under names
Show nicknames, resolve them from signed profile records, fall back toanon-<keyprefix> — and keep the real key one tap away for out-of-band
verification (identity chapter). Offer key
backup/export early; there is no recovery flow to save anyone later. For
dev builds: multi-identity switching (our dev user switcher) turns
one browser into a test network.
5. Honest status surfaces
A P2P app should always answer: how many peers, how many records, which
transport, is crypto real? Our web build's status chip
(gossip-bridge · 3p · 214 recs) and the TUI header
(hot · 4 peers · tracking 12) exist because trust in a serverless app
comes from legibility — including showing when you are in an insecure dev
fallback, loudly.
6. Moderation as user power, not platform power
Local blocks apply instantly to your own view; published blocklists let
others opt in to your curation; unsubscribing un-moderates
(trust chapter). The app's job is making these
levers visible — not deciding for anyone.
7. Ship the smallest honest surface
Our whole product history in one pattern: Reddit-shape → HN-shape cut the UI
by half while the data model kept boards; the GUI stalled so the TUI
shipped; pinned posts are a constant in a file
(the build article). In P2P the hard risks live in
the protocol layer — spend UI ambition after the network works.