Skip to main content

Quickstart

The following is a minimal guide to running an Extism plug-in in your language and platform of choice. This document should get you from 0 to "Hello, World!" as quickly as possible.

Choose A Language​

In Extism parlance, your normal (non-wasm) application is known as the "host". We offer a variety of libraries, which we call "Host SDKs", to help you embed Extism plug-ins into your application.

First choose the language of your application:

Install the Dependency​

The module is hosted on npm. Put the @extism/extism dependency in your package.json:

npm install @extism/extism --save
Supported Runtimes

This library is also compatible with Browsers, Deno, and Bun but this guide will assume we're running in node.js.

Import the library and load a plug-in​

We suggest you copy paste the following code here into a node.js shell:

Count Vowels Plugin

count_vowels.wasm is an example plugin that counts vowels. It was written in Rust, but can be written in any of the supported PDK languages.

repl.js
const createPlugin = require("@extism/extism")

const plugin = await createPlugin(
'https://github.com/extism/plugins/releases/latest/download/count_vowels.wasm',
{ useWasi: true }
);

Call an export function​

Let's call the "count_vowels" export function on the plugin. This counts the number of vowels in the string we pass in and returns a JSON encoded result.

repl.js
let out = await plugin.call("count_vowels", "Hello, World!");
console.log(out.text())
// => '{"count":3,"total":3,"vowels":"aeiouAEIOU"}'

Documentation​

Congrats! You just ran your first Extism plug-in. To learn more about what this javascript library can do, see the js-sdk README and reference docs.

If you're interested in learning how to write a plug-in, see the plugin quickstart.

Need help?​

If you've encountered a bug or think something is missing, please open an issue on the Extism GitHub repository.

There is an active community on Discord where the project maintainers and users can help you. Come hang out!