
How to Use Transformers.js in a Chrome Extension — announced via Hugging Face on April 23, 2026. By the end, you will have the same architecture used in this project: a background service worker that hosts models, a side panel chat UI, and a content script for page-level actions. The background service worker also handles chrome.action.onClicked to open the side panel for the active tab. This project uses a side panel for persistent chat, but the orchestration pattern is the same. The orchestration rule is simple: the background is the single coordinator; side panel and content script are specialized workers that request actions and render results.
We recently released a Transformers.js demo browser extension powered by Gemma 4 E2B to help users navigate the web.
While building it, we ran into several practical observations about Manifest V3 runtimes, model loading, and messaging that are worth sharing.
This guide is for developers who want to run local AI features in a Chrome extension with Transformers.js under Manifest V3 constraints.
By the end, you will have the same architecture used in this project: a background service worker that hosts models, a side panel chat UI, and a content script for page-level actions.
In this guide, we will recreate the core architecture of Transformers.js Gemma 4 Browser Assistant , using the published extension as a reference and the open-source codebase as the implementation map.
Before diving in, a quick scope note: I will not go deep on the React UI layer or Vite build configuration. The focus here is the high-level architecture decisions: what runs in each Chrome runtime and how those pieces are orchestrated.
In MV3, your architecture starts in public/manifest.json . This project defines three entry points:
If Manifest V3 is new to you, read this short overview first: What is Manifest V3? .
The background service worker also handles chrome.action.onClicked to open the side panel for the active tab. Related entry point to know: a popup can be defined with action.default_popup and works well for quick actions. This project uses a side panel for persistent chat, but the orchestration pattern is the same.
The key design decision is to keep heavy orchestration in the background and keep UI/page logic thin.
How to Use Transformers.js in a Chrome Extension — announced via Hugging Face on April 23, 2026 Reported by Hugging Face on April 23, 2026.