Decomp Buddy
Decomp Buddy's raccoon typing on a laptop

For Developers · Add-On Guide

Make A Decomp Buddy Add-On

An add-on is a small web page (HTML, JavaScript, CSS, pictures) packed in a zip file. Players drop the zip onto Decomp Buddy and it's installed. An add-on can:

  • add its own screen, with a button in the sidebar;
  • add a panel to every game page;
  • run in the background while Decomp Buddy is open, hearing about every game that's played;
  • add its own list to Browse's List filter;
  • read the whole catalog and the player's installed games, with their play time;
  • start a game or open its set-up;
  • open and save files that the player picks;
  • reach websites you name, for your own data, scores, news or pictures;
  • keep its own storage, show notifications, copy to the clipboard, and put a badge on its button.

Add-ons need Decomp Buddy 0.36.1 or newer. The sample add-on, Play Log, is a good one to copy.

Your First Add-On, Step By Step

You need a text editor, and Decomp Buddy on your computer. No other tools, accounts or build steps.

1. Make a folder called hello-addon anywhere you like, for example on your Desktop.

2. Make a file in it called addon.json with this inside:

{
  "id": "hello-addon",
  "name": "Hello",
  "version": "1.0.0",
  "description": "My first add-on: counts the games I have installed.",
  "author": "Your Name",
  "screen": { "title": "Hello" }
}

3. Make index.html:

<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Hello</title>
<link rel="stylesheet" href="style.css">
<script src="/__db/sdk.js"></script>
<script src="main.js" defer></script>
</head>
<body>
  <h1>Hello!</h1>
  <p id="count">Counting…</p>
  <button id="random">Play Something At Random</button>
</body>
</html>

4. Make main.js:

const DB = window.DecompBuddy;

async function start() {
  const games = await DB.library.list();
  document.getElementById("count").textContent = `You have ${games.length} games installed.`;
  document.getElementById("random").onclick = () => {
    const known = games.filter((g) => g.id);
    if (known.length) DB.library.play(known[Math.floor(Math.random() * known.length)].id);
  };
}
start();

5. Make style.css:

body { font: 15px/1.5 system-ui, sans-serif; background: var(--db-bg); color: var(--db-fg); padding: 20px; }
button { background: var(--db-accent); color: var(--db-accentfg); border: 0; border-radius: 8px; padding: 8px 14px; }

6. Load it. In Decomp Buddy, open Add-Ons in the sidebar, then Make Your Own → Load A Folder While I Work On It…, and choose your hello-addon folder. A Hello button appears in the sidebar. Click it.

7. Change something. Edit the <h1> in index.html and save. The add-on reloads by itself.

8. Share it. Zip the folder. Anyone can drag that zip onto their Add-Ons screen to install it.

Where An Add-On Shows Up

Say where in addon.json. An add-on needs at least one of these, and can have any mix.

In addon.jsonWhat it does
"screen": { "title": "Hello" }A button in the sidebar under Add-Ons, opening the add-on's page full size.
"gamePanel": { "title": "Your Notes" }A panel on every game page. games.current() tells you which game, and the gameShown event fires when the player moves to another game.
"setupPanel": { "title": "Dump Helper" }A panel on Game Setup, above the rows for the files the player brings. setup.current() lists the games and their rows, setup.attach() offers a file for a row, and the setupChanged event fires when a row changes. See [Game Setup](#game-setup).
"background": trueA hidden copy of the page that runs from start-up, so it hears gamePlayed even when nobody opens the add-on. It can't open windows, start games or open files (those need the player looking at the add-on).

The same page is used for all three. Ask DecompBuddy.info() which one you're in:

const { place } = await DecompBuddy.info(); // "screen", "gamePanel", "setupPanel" or "background"

addon.json

{
  "id": "play-log",
  "name": "Play Log",
  "version": "1.0.0",
  "description": "What it does, in a sentence or two.",
  "author": "Your Name",
  "homepage": "https://github.com/you/play-log",
  "entry": "index.html",
  "hosts": ["https://example.com"],
  "screen": { "title": "Play Log" },
  "gamePanel": { "title": "Your Notes" },
  "background": false
}
FieldNeededWhat it means
idYes2 to 41 lowercase letters, digits and dashes. Never change it: it's how a new version finds the old one and keeps what it saved.
nameYesWhat players see. 40 characters at most.
versionYesNumbers and dots, like 1.0.2.
descriptionYesOne or two sentences, 300 characters at most. Players see it before they install.
authorYesYou, as you want to be shown.
homepageNoAn https:// link to your project.
entryNoThe page to open. Defaults to index.html.
hostsNoUp to 10 websites your add-on talks to, each just https:// and a name. Players see this list before they install.
screen, gamePanel, setupPanel, backgroundAt least oneSee above.

Anything else in addon.json is refused, so a typo can't quietly turn into a permission.

The Page

  • Load the SDK first: <script src="/__db/sdk.js"></script>. Decomp Buddy serves it itself.
  • Code goes in .js files. Inline <script> blocks and onclick="…" attributes are blocked. Inline style="…" is fine.
  • Everything is served from your folder. Link files by their path, like img/logo.png. Pictures can also come from the websites in hosts.
  • Colors: the app's colors arrive as CSS variables, so your add-on matches light mode, dark mode and the seasonal looks: --db-bg, --db-fg, --db-card, --db-line, --db-muted, --db-accent, --db-accentfg.
  • Size: a screen fills the window. A game-page panel grows to fit its content, up to 2,000 pixels tall.
  • No frames, no plug-ins, and nothing loads from websites that aren't in hosts.

window.DecompBuddy

Every call returns a Promise. Errors come back as a rejected Promise with a plain message, so wrap calls in try/catch where they might fail.

The Catalog And The Player's Games

CallWhat you get
games.list()Every game in the catalog: { id, slug, title, console, platforms, completeness, features, genres, repo, url }. completeness is playable, mostly, partial, wip or unknown. features lists fps60, widescreen, hd, raytracing, mods, online, coop, lightgun, randomizer.
games.current()On a game-page panel, the game being shown. Anywhere else, null.
games.install(id)Opens that game's set-up in Decomp Buddy. The player presses Set Up.
library.list()Games installed on this computer: { id, title, console, minutesPlayed, lastPlayed }. id is null for a game the catalog doesn't know.
library.play(id)Starts an installed game, like pressing Play.

Your Own Storage

CallWhat it does
storage.get(key)What you saved under that key, or null.
storage.set(key, value)Saves anything JSON can hold. set(key, null) deletes it. 1 MB in all, kept on this computer. Keys starting __db are reserved.

Storage survives updates of your add-on (same id). It goes to the Trash with the add-on when the player removes it.

The Internet

const r = await DecompBuddy.net.fetch("https://example.com/api/scores?game=zelda", { headers: { Accept: "application/json" } });
if (r.status === 200) console.log(JSON.parse(r.body));
CallWhat it does
net.fetch(url, { method, headers, body, as })Only https:// addresses on your hosts. method is GET (the default) or POST. Resolves to { status, headers, body }. body is text, or base64 with as: "base64" (for pictures and other binary files). 5 MB at most.
  • Cookies are never sent, and headers like Cookie, Origin and Host are dropped. Send an API key in a header of your own, like X-Api-Key.
  • Redirects aren't followed: they come back as a 3xx with headers.location. Follow them yourself if they're on your hosts.
  • Plain fetch() and XMLHttpRequest from your page are blocked. Use net.fetch.

Files The Player Picks

const f = await DecompBuddy.files.open({ accept: ["json"] });
if (f) console.log(f.name, JSON.parse(f.data));
await DecompBuddy.files.save("my-backlog.json", JSON.stringify(myList, null, 2));
CallWhat it does
files.open({ accept, as })Opens the system's own Open window. accept is a list of extensions like ["json", "txt"]. Resolves to { name, size, data }, or null if the player cancels. data is text, or base64 with as: "base64". 10 MB at most.
files.save(name, data, { encoding })Opens the system's own Save window, starting in Downloads with your file name. encoding is "text" (the default) or "base64". 50 MB at most. Resolves to the saved file's name, or null if the player cancels.

Your add-on never sees a folder or a path, only the one file the player chose.

Each file you opened or saved also has a ref (from files.open, or from files.save with { ref: true }). It names that file for [setup.attach](#game-setup), for this add-on only, until Decomp Buddy closes.

Game Setup

A setupPanel add-on sits on Game Setup, above the rows for the files the player brings (their game file, a BIOS, an update). It can help with those rows: explain what each one needs, and offer a file the player opened or saved through your add-on.

const games = await DecompBuddy.setup.current();
// [{ id, title, console, rows: [{ row, label, kind, formats, expectedFilename, region, filled, check, summary }] }]
DecompBuddy.on("setupChanged", (games) => redraw(games)); // a row was filled, cleared or checked

const f = await DecompBuddy.files.open({ accept: ["iso", "bin", "cue"], as: "base64" });
if (f) {
  const result = await DecompBuddy.setup.attach(games[0].id, 0, f); // or f.ref
  // null: the player said no. { check, summary }: it was checked, like Choose….
}
CallWhat it does
setup.current()The games being set up and their file rows. kind is game, bios, update, dlc or other; check is match, mismatch, unverified, checking or null (nothing chosen yet).
setup.attach(gameId, row, file)Offers a file your add-on opened or saved (the object, or its ref) for one row. Decomp Buddy asks the player first ("Use This File?", with your add-on's name, the file's name and size, and the row). If they say yes, the file goes through exactly the same checks as Choose…: unpacking an archive, converting a format it knows, and the checksum, size and region checks. Resolves to { check, summary }, or null if the player said no. Only from the panel, while it's showing.

You can only attach a file this add-on opened or saved in this session. A made-up ref, or another add-on's, is refused.

The Window

CallWhat it does
ui.openGame(id)Opens that game's page in Decomp Buddy.
ui.openLink(url)Opens an https:// link in the player's browser.
ui.toast(text)A short message at the bottom of the window, 140 characters at most.
ui.notify(title, body)A desktop notification. One every 10 seconds at most.
ui.setBadge(text)A small badge on your sidebar button (4 characters at most), or "" to clear it. Needs a screen.
clipboard.copy(text)Copies text.
browse.setList({ title, ids })Your own list in Browse's List filter, made of game ids from games.list(). Pass null to remove it. It stays across restarts.
info(){ app, version, place }.

Events

DecompBuddy.on("gamePlayed", ({ id, title, minutes }) => { /* a game just closed */ });
EventWhenWhat you get
gamePlayedA game closes after being played for a couple of minutes or more.{ id, title, minutes }
gameShownA game-page panel moves to another game.{ id }
themeThe app's colors change. The CSS variables update by themselves.the new colors

Only While The Player Is Looking

library.play, games.install, files.open and files.save only work from your screen or panel while it's showing. A background add-on, or a page the player can't see, gets the error "Only from the add-on's screen or panel, while it's showing." Nothing can start a game or open a window behind the player's back.

Recipes

A Panel That Shows Data From Your Website

addon.json gets "hosts": ["https://api.example.com"] and "gamePanel": { "title": "Speedrun Times" }. Then:

const DB = window.DecompBuddy, out = document.getElementById("out");
async function show() {
  const game = await DB.games.current(); if (!game) return;
  out.textContent = "Loading…";
  try {
    const r = await DB.net.fetch(`https://api.example.com/times?title=${encodeURIComponent(game.title)}`);
    const times = r.status === 200 ? JSON.parse(r.body) : [];
    out.textContent = times.length ? times.map((t) => `${t.runner}: ${t.time}`).join("\n") : "No times yet.";
  } catch (err) { out.textContent = `Couldn't load: ${err.message}`; }
}
DB.on("gameShown", show);
show();

A Background Add-On That Keeps Count

"background": true and "screen": { "title": "Sessions" }. The background copy counts, and the screen shows it:

const DB = window.DecompBuddy;
const { place } = await DB.info();
if (place === "background") {
  DB.on("gamePlayed", async ({ title, minutes }) => {
    const log = (await DB.storage.get("log")) || [];
    log.push({ title, minutes, at: new Date().toISOString() });
    await DB.storage.set("log", log.slice(-500));
    if (log.length % 10 === 0) DB.ui.notify("Ten more sessions", `You've played ${log.length} sessions.`);
  });
} else {
  const log = (await DB.storage.get("log")) || [];
  document.getElementById("out").textContent = log.map((l) => `${l.title}: ${l.minutes} min`).join("\n");
  DB.ui.setBadge(String(log.length));
}

(Top-level await needs <script type="module" src="main.js">.)

A Backlog List In Browse

const DB = window.DecompBuddy;
const backlog = (await DB.storage.get("backlog")) || [];
await DB.browse.setList({ title: "My Backlog", ids: backlog });

Browse → List → My Backlog now shows just those games.

Export And Import

document.getElementById("export").onclick = async () =>
  DecompBuddy.files.save("backlog.json", JSON.stringify(await DecompBuddy.storage.get("backlog") || []));
document.getElementById("import").onclick = async () => {
  const f = await DecompBuddy.files.open({ accept: ["json"] });
  if (f) await DecompBuddy.storage.set("backlog", JSON.parse(f.data));
};

Limits

WhatLimit
Files in an add-on5,000, 200 MB in all, web files only (.html .js .mjs .css .json .txt .md, pictures (.avif too), fonts, sounds (.mp3 .ogg .wav .m4a .flac .opus), video (.mp4 .webm))
Storage20 MB per add-on
net.fetch100 MB per answer, 2 minutes, https:// on your hosts only. What you send with POST: up to 10 MB
files.open / files.save200 MB / 500 MB
Notificationsone every 5 seconds
Websites in hosts50. https://*.example.com counts as one and covers all of example.com's subdomains
A game-page panel4,000 pixels tall

Video and music don't count against net.fetch. A <video>, <audio> or <img> whose address is on one of your hosts plays straight from that website, streamed, with no size limit. A media player only needs its servers in hosts (often one https://*. entry).

Packing And Sharing

  • Zip it: zip your folder. addon.json can be at the top of the zip or inside one folder; both work.
  • Installing: players drag the zip onto the Add-Ons screen, or use Install From A Zip File…. Before anything is installed they see the name, the author, where it shows up and the websites it uses.
  • From GitHub: players paste your project's link into Install From GitHub. Decomp Buddy takes your latest release's .zip with "addon" in its name, or your main branch if there isn't one.
  • Updating: raise version (numbers only, like 1.2.0) and put out the new zip. Installing it replaces the old version and keeps what it saved. Players who installed from your GitHub link, or from the Official Add-On List, are told on the Add-Ons screen when a newer version is out and update with one press.
  • The Official Add-On List: send your project's link at decompbuddy.com/developers/addons. Once it's approved, we take your newest release's zip, check addon.json and every file, scan it for malware and pin that exact file. It then shows in the app under Official Add-Ons and at decompbuddy.com/addons, where an Install In Decomp Buddy button opens the app at your add-on. A new version goes through the same checks before players are offered it.
  • Removing: the player presses Remove. The add-on and what it saved go to the Trash.

The Walls, And Why

An add-on runs in its own sandboxed frame, walled off from the rest of the app. It can't:

  • open files the player didn't pick, start programs, or see the computer;
  • reach the Decomp Buddy page around it (everything goes through window.DecompBuddy);
  • reach websites that aren't in hosts, or send cookies;
  • navigate itself to another add-on's page or a website;
  • start games or open windows without the player looking at it.

That's what lets players install add-ons from people they don't know. Please don't build an add-on that downloads games or helps anyone get games they don't own: those will never be listed by Decomp Buddy.

When Something's Wrong

What you seeWhy, and the fix
The add-on is listed as Can't loadaddon.json has a mistake. The message says which field.
A blank screenYour script stopped. Open View → Toggle Developer Tools and read the Console.
"Refused to execute inline script"Move the code from <script>…</script> or onclick="…" into a .js file.
"can only reach …"That website isn't in hosts. Add it (just https:// and the name) and reinstall.
"Only from the add-on's screen or panel, while it's showing"That call can't run in the background or while hidden. Call it from a button on your screen.
Pictures from a website don't showAdd that website to hosts.
The zip won't installIt has a file that isn't a web file (like an .exe), a hidden file, or no addon.json. The message names the file.

Questions

Can my add-on run when Decomp Buddy is closed? No. Background add-ons run while Decomp Buddy is open, including when it's running in the menu bar or system tray.

Can I use a framework or npm packages? Yes. Build them into plain .js files and ship those in the zip.

Can I sell my add-on? It's yours. Decomp Buddy doesn't take a cut, and doesn't host payments.

Is there an official list of add-ons? Yes: the Official Add-On List (see Packing And Sharing). You can also share your zip or your GitHub link anywhere; both install the same way.

Can I link straight to my add-on? Once it's on the official list, decompbuddy://addon?id=<your id> opens Decomp Buddy at it, with the usual look-first window before anything is installed.

Get Your Add-On On The Official List

The Official Add-On List is shown inside Decomp Buddy, so players can install your add-on in one press. Put your add-on's zip in a release on GitHub or GitLab, then send us the project's link. We check its addon.json and every file, scan it for malware and pin that exact zip. New versions are checked the same way before players are offered them.

Kirby AI

Ask about any game here: what to play, what it needs, how to set it up.

Kirby is an AI and can get things wrong. Your question goes to our server and to Anthropic's Claude to be answered; we don't keep it. Privacy

Decomp Buddy's raccoon mascot, taking notes on a clipboard