dæ’vi:d

Open source · TypeScript, Web Components, GitHub API, Cloudflare Workers

Prototype comments: Feedback on Coded Prototypes, Saved in GitHub

A comment panel that goes into any deployed prototype with one script tag. Reviewers leave threads on each page, and every thread is saved as a GitHub discussion in the team’s repository.

Loading demoOpen a thread, leave a comment, then switch to CheckoutOpen full screen
A prototype page with the comments panel open on a thread: the opening comment with a reaction, a reply, and a nested reply.

Problem

At S&P Global, the team’s prototypes were deployed from one repository, so anyone could open them in a browser. A design file has comments. A deployed prototype had none, so feedback had to be written up somewhere else, away from the screen it was about.

The team already worked in GitHub, so I put the comments there. I built the first version near the end of my contract and tested it on the team’s GitHub Enterprise. The version on this page is my own rewrite, published as open source.

How it works

One script tag, every page. The deploy step adds the panel to every prototype page, so nobody sets anything up per prototype. It works whatever the prototype is built with, and it follows page changes in single-page apps.

The comments panel listing the open threads on the current page, with a page switcher at the top
A thread in the comments panel with a reaction, a reply to a reply being written, and Resolve and Reply buttons

Threads, and a reply in progress

Every thread is a GitHub discussion. The page goes into the title, like “[/checkout] Pay button has no loading state”, so the list still reads well on GitHub. Replies, reactions, edits and resolving go straight from the browser to GitHub under the reviewer’s own account, so notifications and @mentions work the way the team already knows.

prototype page ──▶ GitHub Discussions      reads and writes, as the reviewer
      │
      └── sign-in only ──▶ worker ──▶ GitHub ──▶ back to the page

The only server is a small worker that handles sign-in and stores nothing.

Signing in uses the reviewer’s GitHub account. There are no separate accounts or passwords. Access comes from GitHub, so only people who can see the repository can read or leave feedback.

The comments panel asking the reviewer to sign in with GitHub

Decisions

No comment backend. GitHub already handles accounts, permissions, storage and notifications, and the team was already there. The trade-off is GitHub’s rate limit: fine for a team, wrong for a public website.

A GitHub App, not an OAuth App. OAuth permissions can’t be narrowed to discussions, so commenting would have needed access that can also change code. A GitHub App gets discussions and nothing else.

Sign-in by redirect, not a popup. GitHub’s sign-in page stops a popup from handing the token back to the page that opened it. So the page redirects, the token comes back in the part of the address browsers never send to a server, and it is cleared right away.

Kept apart from the prototype. The panel brings no framework and keeps its styles in a shadow root. The prototype’s CSS can’t break the panel, and the panel can’t break the prototype.

Next

  • Pin a comment to a spot on the screen, not just to the page
  • Show new comments without reopening the panel

Read next