[Ideas/Features] Cross platform js addons support using Rust backend and Svelte frontend

[Ideas/Features] Cross platform addons support using Rust backend and Svelte frontend

After viewing the code of import-csv, I think that the addons support will be available using Rust backend and Svelte UI.


All the important methods are implemented in backend which called using fetch request from frontend to backend. So, the frontend can access decks info, note type info etc. It also can also modify the decks data and notes data. The Anki ecosystem will use webview to load the addons pages and serve request from rust back over localhost.


The addons download and extract will be similar to existing addons implementation.
The webview already implemented in Anki, so the code will be reused to create the webview window for serving addon-name.html file.


The addons can be distributed to npm or addons page of ankiweb. But downloading from npm will download whole project, so may be only built project should be published by addon developer.


The Anki, AnkiDroid and AnkiMobile will download the addons from npm or addons page and extract the content in some folder like addons dir.

A meta.json file will store the information like name, version, licence etc. config.json will store the information about how the addons should be opened i.e. through deck options menu, file menu or inside reviewer or note editor. It will also store others configuration related to addons. A button will be added for installed addons to menu depending on config.json.

When the button clicked it will open the webview and load the addon-name.html.

The webserver then serve the content when requested using addon-name.
The file will be served


Addon Development

The addons development should be done on Anki source with web browser as loading the pages on localhost. The card-info will be useful in getting started.

Then the page built using bazel and the published. The tar.gz must contains addon-name.js/html/css, meta.json and config.json file.


The addons should be harmless to the system. Addons must not make request to web url other than localhost. It should not unnecessary modify contents of decks and notes.

More features

If addons required more features which is not available then it should be requested or implemented in rust backend and PR created to upstream. If approved and merged then the features will be available to AnkiDroid and AnkiMobile also.

1 Like

While possible from a technical perspective, this is not something I’d like to rush into. Anki is still in the fairly early stages of migrating to Svelte/TypeScript, and until more of that has been done, and we have a better idea of how everything will fit together, I don’t want to be committing to a specific API or architecture.

The addons should be harmless to the system.

While not as dangerous as Python-based add-ons, they’d still be able to delete or corrupt your data, or transfer it to another server without your knowledge.


“Anki is still in the fairly early stages of migrating to Svelte/TypeScript”

What changes about addon development or card templates?

Add-ons will need updating to work with the new screens (eg old stats vs new stats screens).

Thanks, I will wait till it has stable release.