Building a Chrome extension with Next.js and automating 40% of a sales rep's day-to-day tasks at Fuse AI
September 2024
I joined Fuse AI, a YC W25 startup building sales automation with AI. My first project was a Chrome extension that could automate 40% of a sales rep's day-to-day tasks.
Why Chrome extension?
Sales reps work all day long in web apps in their browser. They login to their CRM, LinkedIn, email, and calendar. A Chrome extension can run on top of all these web apps and "see" what the sales rep is doing, and help them with what they are doing.
Architecture
I built a Chrome extension in Next.js. You can build a Chrome extension in Next.js! 🤯 (It's a little bit hacky but here's how: an extension popup and side panel are just web pages, the background service worker handles the Chrome APIs, the extension popup and side panel are React apps that communicate with chrome.runtime.sendMessage, the hardest part: build content scripts)
extension/
├── manifest.json
├── popup/ # Next.js static export
├── sidepanel/ # Same — static export
├── background.js # Service worker
└── content-scripts/ # Injected into web pages
What is a content script?
A content script is a piece of JavaScript that runs in the context of the web page, but in an isolated JavaScript environment. We needed to be able to detect pages on LinkedIn, parse information, and fill forms on LinkedIn. Everything we needed was on the page, but the problem is LinkedIn changes the names of their class attributes all the time. We had to come up with an architecture for resilient selectors that used data attributes and ARIA labels instead of class names.
What Worked
- Next.js static export. Fast popup load.
- Message passing pattern. UI and Chrome APIs stay separate.
- Feature flags. Gradually release features for Chrome Web Store reviews.
What Didn't Work
- Manifest V3 service workers. They go into idle mode after 30 seconds
- Chrome Web Store reviews. One took 3 weeks
- Content script isolation. Debugging goes to a different DevTools panel
The Outcome
40% Task Automation Rate. The extension was Fuse AI's main product surface.