# Fermyon Spin — Build and Run WebAssembly Microservices > Open-source framework for building, distributing, and running serverless applications as WebAssembly components with sub-millisecond cold starts. ## Install Save as a script file and run: # Fermyon Spin — Build and Run WebAssembly Microservices ## Quick Use ```bash # Install Spin curl -fsSL https://developer.fermyon.com/downloads/install.sh | bash sudo mv spin /usr/local/bin/ # Create and run a new app spin new -t http-rust my-app cd my-app && spin build && spin up # App running at http://127.0.0.1:3000 ``` ## Introduction Spin is an open-source framework by Fermyon for building and running event-driven microservice applications using WebAssembly (Wasm) components. It delivers sub-millisecond cold starts, strong sandboxing, and polyglot development — you can write components in Rust, Go, Python, JavaScript, or any language that compiles to Wasm. ## What Spin Does - Compiles application code into WebAssembly components and runs them in a secure sandbox - Handles HTTP triggers with sub-millisecond startup for serverless workloads - Supports multiple languages (Rust, Go, Python, TypeScript, C#) within the same application - Provides built-in key-value store, SQLite database, and outbound HTTP/Redis clients - Distributes apps as OCI artifacts, pushable to any container registry ## Architecture Overview Spin uses Wasmtime as its WebAssembly runtime, executing each request in an isolated Wasm component. The Spin runtime handles routing, triggers, and host-component interfaces. Applications are defined in a `spin.toml` manifest that declares components, triggers, and dependencies. The WASI (WebAssembly System Interface) provides controlled access to system resources like filesystem and networking. ## Self-Hosting & Configuration - Install the Spin CLI from the official install script or Homebrew (`brew install fermyon/tap/spin`) - Define application components in `spin.toml` with trigger routes and build commands - Run locally with `spin up` or deploy to Fermyon Cloud, Kubernetes (via SpinKube), or any Wasm-capable host - Configure runtime options like listen address, TLS, and log level via CLI flags - Use `spin registry push` to publish apps as OCI artifacts to any container registry ## Key Features - Sub-millisecond cold starts compared to seconds for traditional containers - Strong isolation through WebAssembly sandboxing without Linux namespace overhead - Built-in key-value store and SQLite for stateful applications without external dependencies - Component model support enabling mix-and-match of languages per route - Plugin system for extending the CLI with custom commands ## Comparison with Similar Tools - **Fastly Compute** — Commercial Wasm platform; Spin is open-source and self-hostable - **Cloudflare Workers** — V8-based edge runtime; Spin uses Wasm for broader language support - **wasmCloud** — Actor-model Wasm framework; Spin is simpler with an HTTP-first approach - **Docker/Containers** — Heavier isolation; Spin offers faster startup and smaller footprint - **AWS Lambda** — Managed serverless; Spin runs anywhere with no cloud lock-in ## FAQ **Q: Which languages does Spin support?** A: Rust, Go, Python, TypeScript/JavaScript, and C#. Any language that compiles to WASI-compatible Wasm can work. **Q: Can I run Spin on Kubernetes?** A: Yes. SpinKube integrates Spin with Kubernetes, letting you deploy Wasm workloads alongside containers. **Q: How does Spin handle state?** A: Spin provides built-in key-value and SQLite stores. You can also connect to external databases via outbound HTTP or Redis. **Q: Is Spin production-ready?** A: Spin is used in production by Fermyon Cloud customers and is backed by the Bytecode Alliance's Wasm standards. ## Sources - https://github.com/fermyon/spin - https://developer.fermyon.com/spin --- Source: https://tokrepo.com/en/workflows/asset-6c3f3b40 Author: Script Depot