Awesome
<h1 align="center">Wasm Workers Server</h1> <p align="center"> Develop and run serverless applications on WebAssembly š </p> <p align="center"> <a href="https://github.com/vmware-labs/wasm-workers-server/actions/workflows/build.yml"> <img alt="GitHub Workflow Status" src="https://img.shields.io/github/actions/workflow/status/vmware-labs/wasm-workers-server/build.yml?label=Build&style=flat-square"> </a> <a href="https://github.com/vmware-labs/wasm-workers-server/releases/latest"> <img alt="GitHub release (latest by date)" src="https://img.shields.io/github/v/release/vmware-labs/wasm-workers-server?label=Release&style=flat-square"> </a> <a href="https://github.com/vmware-labs/wasm-workers-server/blob/main/LICENSE"> <img alt="GitHub" src="https://img.shields.io/github/license/vmware-labs/wasm-workers-server?color=427ece&label=License&style=flat-square"> </a> <a href="https://github.com/vmware-labs/wasm-workers-server/graphs/contributors"> <img alt="GitHub contributors" src="https://img.shields.io/github/contributors/vmware-labs/wasm-workers-server?label=Contributors&style=flat-square"> </a> </p> <p align="center"> <a align="center" href="https://workers.wasmlabs.dev/">workers.wasmlabs.dev</a> </p> <br/>Wasm Workers Server (wws
) is an open source tool to develop and run serverless applications server on top of WebAssembly. The applications are composed by multiple modules called workers. Each of these tiny modules is in charge of replying to a specific HTTP endpoint in your application.
When you start wws
, it loads the existing workers in the given path or remote repository. You can write a worker in different languages like Rust, JavaScript, Go, Ruby and Python. The filenames and folders determine the final routes that will be served. For example, the index.js
will reply to the /
endpoint.
Getting started (5 minutes)
-
Download and install Wasm Worker Sever:
curl -fsSL https://workers.wasmlabs.dev/install | bash
-
Create an
index.js
file with the following content:addEventListener("fetch", event => { return event.respondWith( new Response("Hello from Wasm Workers Server!") ); });
-
Run
wws
:$ wws . āļø Preparing the project from: . āļø Loading routes from: . ā³ Loading workers from 1 routes... ā Workers loaded in 141.613666ms. - http://127.0.0.1:8080/ => ./index.js š Start serving requests at http://127.0.0.1:8080
-
Access to http://127.0.0.1:8080.
Congrats! You just created your first worker š. From this point, you can explore the different examples and guides:
- +20 Worker examples
- Guides to develop workers in different languages:
Run in a container
If you don't want to install anything locally you can just run wws
from the ghcr.io/vmware-labs/wws:latest
container image. You only need to mount your project in the /app
folder:
docker run --rm -v $(pwd):/app -p 8080:8080 ghcr.io/vmware-labs/wws:latest
Documentation
All our documentation is available at https://workers.wasmlabs.dev.
Features
You can find all the available features in the documentation. It includes dynamic routes, an in-memory K/V store, etc.
Language Support
Wasm Workers Server focuses on simplicity. We want you to run workers (written in different languages) safely in WebAssembly. For interpreted languages, we add different interpreters:
Language | Support | Requires an external runtime | Issue |
---|---|---|---|
Rust | ā | No | - |
JavaScript | ā | No | - |
Go | ā | No | #95 |
Ruby | ā | Yes | #63 |
Python | ā | Yes | #63 |
Zig | ā | No | #144 |
PHP | š§ | No | #100 |
To get more information about multi-language support in Wasm Workers Server, check our documentation.
Development
Prerequisites
To work with this project you will need to install:
Run the project
After installing the different prerequisites, you can run the development environment with:
$ cargo run -- --help
Wasm Workers Server is split into different Rust crates. The root project produces the wws
, while every crate provides specific features.
Contributing
See CONTRIBUTING.md and CODE_OF_CONDUCT.md.
License
Wasm Workers Server is distributed under the terms of the Apache License (Version 2.0).
See LICENSE for details.