spin
Spin is the open source developer tool for building and running serverless applications powered by WebAssembly.
Top Related Projects
Quick Overview
SPIN (Spatial Interaction) is an open-source C++ framework for developing interactive 3D applications, particularly focused on virtual and augmented reality. It provides a comprehensive set of tools and libraries for creating immersive experiences, handling input devices, and managing 3D scenes.
Pros
- Robust 3D scene management and rendering capabilities
- Support for various input devices and VR/AR hardware
- Cross-platform compatibility (Windows, macOS, Linux)
- Extensible architecture allowing for custom modules and plugins
Cons
- Steep learning curve for beginners due to its comprehensive nature
- Limited documentation and examples compared to some more popular frameworks
- Requires knowledge of C++ programming
- Smaller community compared to some alternative VR/AR development tools
Code Examples
- Creating a basic 3D scene:
#include <spin/spin.h>
int main() {
spin::Scene scene;
auto cube = scene.createNode<spin::Cube>();
cube->setPosition(0, 0, -5);
cube->setColor(1, 0, 0); // Red cube
spin::Viewer viewer;
viewer.setScene(&scene);
viewer.run();
return 0;
}
- Handling user input:
class MyInputHandler : public spin::InputHandler {
public:
void onKeyPress(int key) override {
if (key == SPIN_KEY_SPACE) {
// Do something when space is pressed
}
}
};
// In your main function:
MyInputHandler inputHandler;
viewer.setInputHandler(&inputHandler);
- Adding a custom shader:
auto shaderProgram = std::make_shared<spin::ShaderProgram>();
shaderProgram->loadFromFile("vertex.glsl", "fragment.glsl");
auto node = scene.createNode<spin::Mesh>();
node->setShaderProgram(shaderProgram);
Getting Started
-
Clone the repository:
git clone https://github.com/spinframework/spin.git
-
Build the project using CMake:
cd spin mkdir build && cd build cmake .. make
-
Include SPIN in your project:
#include <spin/spin.h>
-
Link against the SPIN library in your CMakeLists.txt:
find_package(SPIN REQUIRED) target_link_libraries(your_project PRIVATE SPIN::SPIN)
Competitor Comparisons
Duck-themed multi-user virtual spaces in WebVR. Built with A-Frame.
Pros of Hubs
- More active development with frequent updates and contributions
- Broader feature set for virtual reality and 3D spaces
- Larger community and ecosystem support
Cons of Hubs
- Higher complexity and steeper learning curve
- Requires more resources to run and maintain
- Less focused on specific scientific visualization use cases
Code Comparison
Hubs (JavaScript):
export function getAvatarThumbnailUrl(avatarId) {
return proxiedUrlFor(`${avatarId}/thumbnail.png`);
}
SPIN (C++):
void ReferencedStateSet::setTexture(const char *textureName, osg::Texture *texture)
{
_textures[std::string(textureName)] = texture;
}
The code snippets demonstrate different approaches:
- Hubs focuses on web technologies and JavaScript
- SPIN uses C++ and OpenSceneGraph for 3D rendering
Hubs is a more comprehensive platform for creating virtual spaces, while SPIN is tailored for scientific visualization. Hubs offers a richer set of features but may be overkill for simpler projects. SPIN provides more direct control over 3D rendering but has a narrower scope of applications.
:a: Web framework for building virtual reality experiences.
Pros of A-Frame
- More active development and larger community support
- Extensive documentation and examples for easier learning
- Built on top of Three.js, providing a higher-level abstraction for 3D/VR development
Cons of A-Frame
- Potentially higher performance overhead due to abstraction layers
- Less flexibility for low-level customization compared to direct WebGL programming
Code Comparison
A-Frame (HTML-based declarative approach):
<a-scene>
<a-box position="-1 0.5 -3" rotation="0 45 0" color="#4CC3D9"></a-box>
<a-sphere position="0 1.25 -5" radius="1.25" color="#EF2D5E"></a-sphere>
<a-cylinder position="1 0.75 -3" radius="0.5" height="1.5" color="#FFC65D"></a-cylinder>
<a-plane position="0 0 -4" rotation="-90 0 0" width="4" height="4" color="#7BC8A4"></a-plane>
</a-scene>
SPIN (C++ based approach):
SceneNode *root = SceneManager::instance()->createNewScene("myScene");
Sphere *sphere = new Sphere("mySphere");
sphere->setTranslation(0, 1.25, -5);
sphere->setRadius(1.25);
sphere->setColor(osg::Vec4(0.94, 0.18, 0.37, 1.0));
root->addChild(sphere);
Note: The SPIN framework code example is an approximation, as the exact API might differ.
Powerful web graphics runtime built on WebGL, WebGPU, WebXR and glTF
Pros of PlayCanvas Engine
- More active development with frequent updates and contributions
- Comprehensive documentation and extensive examples
- Larger community support and ecosystem
Cons of PlayCanvas Engine
- Steeper learning curve due to more complex architecture
- Potentially overkill for simpler projects or prototypes
- Commercial licensing for some features
Code Comparison
PlayCanvas Engine:
var entity = new pc.Entity();
entity.addComponent('model', {
type: 'box'
});
app.root.addChild(entity);
SPIN Framework:
osg::ref_ptr<spin::ReferencedNode> node = new spin::ReferencedNode();
node->setName("MyNode");
sceneManager->worldNode->addChild(node.get());
Summary
PlayCanvas Engine is a more feature-rich and actively maintained 3D engine, suitable for complex web-based projects. It offers better documentation and community support but may be overwhelming for simpler tasks. SPIN Framework, while less actively developed, provides a simpler approach for specific use cases, particularly in C++ environments. The choice between the two depends on project requirements, target platform, and developer expertise.
Convert
designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME

Spin is a framework for building, deploying, and running fast, secure, and composable cloud microservices with WebAssembly.
What is Spin?
Spin is an open source framework for building and running fast, secure, and composable cloud microservices with WebAssembly. It aims to be the easiest way to get started with WebAssembly microservices, and takes advantage of the latest developments in the WebAssembly component model and Wasmtime runtime.
Spin offers a simple CLI that helps you create, distribute, and execute applications, and in the next sections we will learn more about Spin applications and how to get started.
Getting started
See the Install Spin page of the Spin documentation for a detailed guide on installing and configuring Spin, but in short run the following commands:
curl -fsSL https://spinframework.dev/downloads/install.sh | bash
sudo mv ./spin /usr/local/bin/spin
Alternatively, you could build Spin from source.
To get started writing apps, follow the quickstart guide, and then follow the Rust, JavaScript, Python, or Go language guides, and the guide on writing Spin applications.
Usage
Below is an example of using the spin
CLI to create a new Spin application. To run the example you will need to install the wasm32-wasip1
target for Rust.
$ rustup target add wasm32-wasip1
First, run the spin new
command to create a Spin application from a template.
# Create a new Spin application named 'hello-rust' based on the Rust http template, accepting all defaults
$ spin new --accept-defaults -t http-rust hello-rust
Running the spin new
command created a hello-rust
directory with all the necessary files for your application. Change to the hello-rust
directory and build the application with spin build
, then run it locally with spin up
:
# Compile to Wasm by executing the `build` command.
$ spin build
Executing the build command for component hello-rust: cargo build --target wasm32-wasip1 --release
Finished release [optimized] target(s) in 0.03s
Successfully ran the build command for the Spin components.
# Run the application locally.
$ spin up
Logging component stdio to ".spin/logs/"
Serving http://127.0.0.1:3000
Available Routes:
hello-rust: http://127.0.0.1:3000 (wildcard)
That's it! Now that the application is running, use your browser or cURL in another shell to try it out:
# Send a request to the application.
$ curl -i 127.0.0.1:3000
HTTP/1.1 200 OK
content-type: text/plain
transfer-encoding: chunked
date: Sun, 02 Mar 2025 20:09:11 GMT
Hello World!
You can make the app do more by editting the src/lib.rs
file in the hello-rust
directory using your favorite editor or IDE. To learn more about writing Spin applications see Writing Applications in the Spin documentation. To learn how to publish and distribute your application see the Publishing and Distribution guide in the Spin documentation.
Language Support for Spin Features
The table below summarizes the feature support in each of the language SDKs.
Feature | Rust SDK Supported? | TypeScript SDK Supported? | Python SDK Supported? | Tiny Go SDK Supported? | C# SDK Supported? |
---|---|---|---|---|---|
Triggers | |||||
HTTP | Supported | Supported | Supported | Supported | Supported |
Redis | Supported | Supported | Supported | Supported | Not Supported |
APIs | |||||
Outbound HTTP | Supported | Supported | Supported | Supported | Supported |
Configuration Variables | Supported | Supported | Supported | Supported | Supported |
Key Value Storage | Supported | Supported | Supported | Supported | Not Supported |
SQLite Storage | Supported | Supported | Supported | Supported | Not Supported |
MySQL | Supported | Supported | Not Supported | Supported | Not Supported |
PostgreSQL | Supported | Supported | Not Supported | Supported | Supported |
Outbound Redis | Supported | Supported | Supported | Supported | Supported |
Serverless AI | Supported | Supported | Supported | Supported | Not Supported |
Extensibility | |||||
Authoring Custom Triggers | Supported | Not Supported | Not Supported | Not Supported | Not Supported |
Getting Involved and Contributing
We are delighted that you are interested in making Spin better! Thank you!
Each Monday at 2:30om UTC and 9:00pm UTC (alternating), we meet to discuss Spin issues, roadmap, and ideas in our Spin Project Meetings. Subscribe to this Google Calendar for meeting dates.
The Spin Project Meeting agenda is a public document. The document contains a rolling agenda with the date and time of each meeting, the Zoom link, and topics of discussion for the day. You will also find the meeting minutes for each meeting and the link to the recording. If you have something you would like to demo or discuss at the project meeting, we encourage you to add it to the agenda.
You can find the contributing guide here.
Stay in Touch
Follow us on Twitter: @spinframework
You can join the Spin community in the Spin CNCF Slack channel where you can ask questions, get help, and show off the cool things you are doing with Spin!
Top Related Projects
Convert
designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot