A lightweight WebAssembly application pool and runtime.
Serve Application Platform is a lightweight platform for running, managing, and distributing WebAssembly (Wasm) applications. It is not a container runtime like Docker, nor an orchestration system like Kubernetes. Instead, it is an application pool – a process manager that treats each Wasm module as an independent task, sharing host resources while maintaining isolation.
- Minimal resource usage: Each task can be limited to as low as 16 MB of memory.
- Flexible installation: Supports local files, HTTP downloads, and BitTorrent magnets.
- Observable: Built-in commands to list tasks (
ps) and view outputs (sout). - Extensible: Task forking (
fork), network permission controls, and custom memory limits. - Persistent: Node registration and configuration are saved to local JSON files.
| Feature | 描述 |
|---|---|
| Wasm runtime | Powered by wazero – pure Go, no CGO. |
| Node management | Register (reg), list (ls), remove (rm) Wasm applications. |
| Task management | Run (run), fork (fork), view output (sout), force-kill (kill) tasks. |
| Network distribution | Install via BitTorrent (install -bt) or HTTP (tcon). |
| Resource limits | Per-task memory caps (-sf) and network permission flags (-ol, -svr). |
| Built-in file server | Quick HTTP server (svr) for testing local downloads. |
| Project scaffolding | Generate templates for C, Go, or Python Wasm projects (mkproj). |
| Persistence | Node states saved to sap_state.json; mirrors stored in sap_config.json. |
git clone https://github.com/OFFMN-SHARP/serve-app-platform.git
cd serve-app-platform
CGO_ENABLED=0 go build -o serve-app-platform.exe- Start the interactive shell:
./serve-app-platform.exe
- Register a Wasm file (e.g.,
hello.wasm):reg hello.wasm - Run it using the returned Node GUID:
run <NodeGUID> - Check the output:
ps sout <TaskGUID>
You can also execute commands directly without entering the interactive shell. Simply pass the command and its arguments as command-line parameters.
Examples:
- Register a Wasm file:
serve-app-platform.exe reg hello.wasm
- Run a Node by GUID:
serve-app-platform.exe run <NodeGUID>
- Install via BitTorrent:
serve-app-platform.exe install -bt "magnet:..." - See all available commands (non-interactive help):
serve-app-platform.exe help
Note: Commands that require interactive input (like
exit) are not applicable in non-interactive mode. The platform will exit after completing the command.
| Command | 描述 |
|---|---|
ls [-wh <keyword>] |
List installed Nodes |
ps [-g] [-wh <keyword>] |
List tasks |
reg <path> [-ol] |
Register a local or remote Wasm file |
rm <NodeGUID> [-f] |
Remove a Node |
run <NodeGUID> [-sf <size>] [-ol] [-svr] |
Run a Wasm application |
fork <NodeGUID> [-force] |
Fork a new task |
sout <TaskGUID> [-wlog <dir>] |
View task output |
kill <TaskGUID> [-f] |
Terminate and clean up a task |
install -bt <magnet> [-dir] [-p] |
Download and install via BitTorrent |
tcon <URL> [-p <path>] |
Temporary download and run |
chpm <URL> |
Change the mirror source |
mkproj <name> [-golang/-py] |
Create a new Wasm project template |
svr [-p <port>] [-dir <directory>] |
Start the built-in file server |
about |
Show project information and disclaimer |
help |
Display this help |
exit |
Quit the platform |
The platform runs on a user-space microkernel built atop Go:
- Each Wasm app runs in a separate goroutine, sharing the host's memory space.
- Memory limits are enforced via wazero's
MemoryConfig. - Network permissions are passed as environment variables (
SAP_NETWORK_ENABLED,SAP_SERVER_ENABLED) to the Wasm guest. - Nodes (application definitions) are decoupled from tasks (running instances), enabling multi-instance forking.
- A read‑only swap file is mounted at
/swapfor each task.
- Go 1.21+ – core language
- wazero – pure‑Go Wasm runtime
- anacrolix/torrent – BitTorrent client
- google/uuid – UUID generation
This project is an independent open‑source project and is NOT affiliated with, endorsed by, or connected to SAP SE (Systems, Applications & Products in Data Processing).
The abbreviation "SAP" used in this project's history refers solely to Serve Application Platform and is not intended to infringe upon any trademark rights. For the full legal disclaimer, please see DISCLAIMER.md.
Issues and pull requests are welcome. Please ensure code formatting follows gofmt and add appropriate tests.