# The Plugin Registry Pattern

**URL:** <https://talk.observablehq.com/t/the-plugin-registry-pattern/10739>\
**Category:** Show and tell\
**Created:** [July 7, 2026, 4:41am UTC](https://talk.observablehq.com/t/the-plugin-registry-pattern/10739 "2026-07-07T04:41:19Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![tomlarkworthy](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/tomlarkworthy/32/5940_2.png) [@tomlarkworthy](https://talk.observablehq.com/u/tomlarkworthy)\
**Post date:** [July 7, 2026, 4:41am UTC](https://talk.observablehq.com/t/the-plugin-registry-pattern/10739/1 "2026-07-07T04:41:19Z")

</div>

When building extensible things I want the extenders to be decoupled from the extender, as I do not know how many extensions will be built apriori and I want 3rd parties to be able to extend so its not possible to import all extensions upfront. So far I used to do this with a simple `viewof inputs(new Set())` in the extendable which works pretty well. Extenders inject their plugin into the set and trigger a reactive update so now the extendee can reactively trigger a refresh using the new functionality. However, over time I also want to replace the extendee with a new implementation e.g. I have had exporter, exporter-2 and exporter-3 over time. Then it becomes bad that all the extendees have to reference the thing they are extending. Its the same kind of coupling the other way that only bites much later.

My solution is to decouple both sides via a centralized named plugin repository. Bonus is we can provide a nicer API than raw viewof wrangling. The plugin system manages all N x M plugin sets once and forall!

> **[Plugin Registry](https://observablehq.com/@tomlarkworthy/plugin-registry)**
>
> A foundational notebook for decoupled plugin wiring: \\\`plugins\\\` maps a name to a set of values.
> N providers add values under a name; M consumers read that name's set as a live Generator. Neither side
> references the other — they meet only at the...

---

<div class="post-metadata">

**Author:** ![mbostock](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/mbostock/32/9_2.png) [@mbostock](https://talk.observablehq.com/u/mbostock)\
**Post date:** [July 7, 2026, 1:02pm UTC](https://talk.observablehq.com/t/the-plugin-registry-pattern/10739/2 "2026-07-07T13:02:57Z")

</div>

It’s a bit abstract to me but I’m glad you got a pattern working that you like!

I noticed that your notebook doesn’t work in [New Observable](https://new.observablehq.com/@tomlarkworthy/plugin-registry); it‘s because in the new standard library, `Generators.observe` returns an async generator rather than a synchronous generator that yields promises (because async generators didn’t exist at the time the standard library was first released).

To fix it, you need to say `(await gen.next()).value` instead of `(await gen.next().value)`.

---

<div class="post-metadata">

**Author:** ![tomlarkworthy](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/tomlarkworthy/32/5940_2.png) [@tomlarkworthy](https://talk.observablehq.com/u/tomlarkworthy)\
**Post date:** [July 7, 2026, 5:44pm UTC](https://talk.observablehq.com/t/the-plugin-registry-pattern/10739/3 "2026-07-07T17:44:22Z")

</div>

Thanks, works on 2.0 as well now!

> **[Plugin Registry](https://new.observablehq.com/@tomlarkworthy/plugin-registry)**
>
> An Observable notebook by Tom Larkworthy

It was `await (await X.next()).value)` (double `await`) that worked across both.

yes the that level of abstraction would not be appropriate for most notebooks.
