Has anyone created a Chrome Extension with Rust?

People,

I am interested in Rust generated WASM and I am wondering whether this approach would allow Chrome Extensions to be built?

I suppose an intermediate step would be for the JS to call a WASM module for the more heavy duty stuff . .

Thanks,
Phil.

2 Likes

This SO post from 2018 says it works (and there has been much improvement in WASM land since then, so it is probably even easier now to write a Chrome extension in WASM than it was five years ago). I found the WebNav extension that is open source and uses Rust and TypeScript. It was last updated in November 2022, but I guess it might still be a good place to start looking into building Chrome extensions with Rust+WASM. The Extension-with-WASM repo looks like another great project to look into and see how the basic setup works. It is a very minimal repo, so I'd recommend starting with this. But yeah, you probably have to have at least some JS glue code, though in Extension-with-WASM, it looks very much bearable.

3 Likes

Thanks so much! - I will check out those links . .

1 Like

I made webnav. Let me know if you have any questions!

3 Likes

@Feel-ix-343 ,

Thanks for replying!

Well my #1 priority is to see if I can create a Rust / WASM replacement for this:

which I make VERY heavy use of for Chrome, Chromium, Brave etc - this extension mostly does what I want for these browsers but I grind it to halt with the number of browsers, windows and tabs I quite frequently have open at once - after days of work this requires a log out from Sway (on Fedora Linux) back to a console to start again.

After looking at the Web_Nav page another idea occurs to me as well! Anyway, looking at Web_Nav maybe it is the interesting first step I could take to get started with Rust on an app that I have an immediate, particular interest in . . I have had a couple of attempts to get started but don't get very far and I have to get back to other, more pressing issues . .

Let me know what you think of TabFern and maybe we could have a Telegram chat?

1 Like

I built chrome extension in Rust for my product. Here is my tech-stack

  • Leptos (replacing with dioxus) => UI components
  • tailwindcss => styling
  • web-sys => general browser APIs
  • web-extensions-sys for access chrome extension APIs

I tried a few libraries for UI for reducing the WASM size. The smallest one built is <100kb. However, it becomes less important compare with DX. I end up using Leptos.
Here is github repos I referenced: GitHub - web-extensions-rs/web-extensions-sys: WebExtension API WASM bindings in Rust

6 Likes

I will have a look but it seems like it will be over my head . .

Thanks!

May I ask you why you are willing to replace Leptos? I wanted to use it for my project too but I'd be curious to hear what didn't work out for you. Sorry if I jump in the convo.

Also @philip_rhoades , did you manage to build your extension at the end? would you be willing to share some of the code? I am trying to get my way there with rust too :slight_smile:

1 Like

Both Leptos and Dioxus make the job done well for web. But Dioxus has a better future roadmap for fullstack development. Dioxus is working on Deploy.

Ettore,

I built a FF/CR addon with Rust/WASM and wrote a detailed explanation how it works here spotify-playlist-builder/Book.md at master · rimutaka/spotify-playlist-builder · GitHub

2 Likes

I will take a look at that - thanks!

Haven't got there yet - too many other, more critical, things need doing . .

I did not check if this was already posted.

There is GitHub - Pauan/tab-organizer: Google Chrome Extension that makes it easier to manage many tabs! ,

by the same author as

GitHub - Pauan/rust-dominator: Zero-cost ultra-high-performance declarative DOM library using FRP signals for Rust! and
GitHub - Pauan/rust-signals: Zero-cost functional reactive Signals for Rust

Warning: be ready to eat the async compile time.

1 Like

Thanks!

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.