This page refers to an older version of Spin. Go to the latest version.

Building Spin components in other languages

This document is continuously evolving as we improve language SDKs and add more examples on how to build Spin components in various programming languages.

See the document on writing Rust and Go components for Spin for detailed guides.

WebAssembly is becoming a popular compilation target for programming languages, and as language toolchains add support for the WebAssembly component model, building Spin components will also become supported.

As a general rule:

  • if your language supports the WebAssembly component model, building Spin components is supported either through an official Spin SDK (such as the Spin SDK for Rust), or through using bindings generators like wit-bindgen (for languages such as C and C++)
  • if your language compiles to WASI, but doesn’t have support for the component model, you can build Spin HTTP components that use the Wagi executor — for example in languages such as Grain, AssemblyScript, or Python.
  • if your language doesn’t currently compile to WASI, there is no way to build and run Spin components in that programming language

Make sure to check out a more complex Spin application with components built in multiple programming languages.

AssemblyScript

AssemblyScript is a TypeScript-based language that compiles directly to WebAssembly. AssemblyScript has WASI/Wagi support, and so can be used with Spin.

C/C++

C and C++ are both broadly supported in the WebAssembly ecosystem. WASI/Wagi support means that both can be used to write Spin apps.

C# and .NET Languages

.NET has experimental support for WASI, so many (if not all) .NET languages, including C# and F#, can be used to write Spin applications.

Grain

Grain, a new functional programming language, has WASI/Wagi support and can be used to write Spin apps.

Python

Python’s interpreter can be compiled to WebAssembly, and it has WASI support. It is known to work for Spin.

Ruby

Upstream Ruby officially supports WebAssembly and WASI, and we here at Fermyon have successfully run Ruby apps in Spin.

Zig

Zig is a low-level systems language that has support for Wasm and WASI, and can be used to write Spin apps.