Hacker News
Hacker News front page, with Show, Ask, New, and Best
Browse Hacker News without leaving Gloom. Top, New, Best, Show, and Ask feeds with scores, comment counts, and one-key article opening.
Install
gloom install gloom-sh/gloom-hackernewsRestart Gloom after installing. Requires Gloom 0.15.0 or newer.
What it adds
One pane you can open from the command bar:
- Hacker News
Network access
Contacts these domains while it runs:
hacker-news.firebaseio.com
Readme
This is also the reference plugin
It is the smallest complete Gloom plugin: about 400 lines, no dependencies beyond the host, and it uses only the public gloomberb/* API. If you are writing your own plugin, start here rather than from scratch.
| File | What it shows |
|---|---|
index.tsx | The whole plugin contract: id, metadata, targets, hosts, a pane, and a command-bar template |
types.ts | The plugin and pane ids, the feed list, and the story shape the other files share |
client.ts | Talking to a third-party API through createThrottledFetch, and normalizing its responses |
pane.tsx | A table-plus-detail pane using shared components: title-bar tabs, a detail that opens on a StatGrid, pane-scoped state, and the pane footer |
client.test.ts | Testing the part with real branching, and nothing else |
gloom.json | The directory manifest: name, icon, targets, hosts, linkHosts, the pane it contributes, and minGloom |
Getting started
git clone https://github.com/gloom-sh/gloom-hackernews my-plugin
cd my-plugin
bun install
bun test
bun run typecheck
gloom plugin link . # Gloom loads this checkout
gloom plugin doctor my-plugin # checks it the way the terminal, desktop and web willStart Gloom, press Ctrl+P, type HN and press Enter.
Rename the ids in types.ts and gloom.json, point client.ts at your own API (and hosts at its host), and reshape pane.tsx. Gloom loads an edit when it restarts. Once it is on GitHub, anyone can install it:
gloom install your-github-user/my-pluginThings worth copying
Import from gloomberb/*, never from a renderer. gloomberb/ui, gloomberb/components, gloomberb/react, gloomberb/theme, and gloomberb/utils are the renderer contract. A plugin that imports OpenTUI, Electrobun, or DOM APIs directly stops working on the other two renderers.
Declare targets honestly. This plugin makes public HTTPS reads only, so it runs everywhere. Anything using Node builtins is not web-capable, and the registry verifies this with an import scan rather than trusting the declaration.
Declare every host you fetch. In hosts, in the plugin and in gloom.json: the web app proxies exactly the plugin's list, and the plugin directory shows gloom.json's. A page the pane only opens as a link goes in linkHosts in gloom.json.
Use createThrottledFetch. It provides rate limiting, retries, timeouts, and request deduplication, and it routes through the host's transport, which is what lets the same code run in the terminal and in the browser.
Keep pane state in usePluginPaneState. It is scoped per pane instance, so two copies of the pane in one layout stay independent and both survive a restart.
Put status in the footer, not the body. Only things that change (loading, error, staleness) belong there.
Let the host draw the chrome. usePaneHeaderTabs puts the feed strip in the desktop title bar and returns false in the terminal, where the pane draws its own Tabs. An open story starts on a StatGrid of its figures, because the stack bar already names it.