You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/platform/typescript-sdk.md
+9-5Lines changed: 9 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -69,6 +69,15 @@ The SDK has two layers:
69
69
70
70
This two-layer split keeps control-plane operations (which act on the server) cleanly separate from per-VM operations (which act on a specific VM), making the API easier to navigate as the surface grows.
71
71
72
+
## Examples
73
+
74
+
Runnable examples live in [`examples/` in the SDK repo](https://github.com/slicervm/sdk-ts/tree/master/examples). Each is a self-contained TypeScript project — `npm install && npm start`.
75
+
76
+
*[`run-command`](https://github.com/slicervm/sdk-ts/tree/master/examples/run-command) — canonical hello-world: create a VM, run `uname -a`, delete the VM. The same code is shown inline in the Quickstart above.
77
+
*[`nginx`](https://github.com/slicervm/sdk-ts/tree/master/examples/nginx) — install nginx via userdata, port-forward host `127.0.0.1:8080` → VM `:80`, fetch the welcome page from the host through the tunnel. Full create-to-fetch-to-teardown in ~6 seconds.
78
+
*[`k3s`](https://github.com/slicervm/sdk-ts/tree/master/examples/k3s) — provision a single-node K3s cluster via userdata + `k3sup`, port-forward `:6443` to a local port, rewrite the kubeconfig, and run host-side `kubectl get nodes` against it. Mirrors the [Go k3s example](https://github.com/slicervm/sdk/tree/main/examples/k3s-userdata) but uses port-forwarding so guest IP routability is irrelevant.
79
+
*[`ffmpeg`](https://github.com/slicervm/sdk-ts/tree/master/examples/ffmpeg) — full walkthrough on the [Video conversion (TypeScript)](/platform/typescript-video-conversion/) page. Streams a video into the VM via `vm.fs.writeFile`, transcodes with ffmpeg, streams the result back through `execBuffered({ stdio: 'base64' })` — no intermediate file on the guest disk.
80
+
72
81
## Connecting to the API
73
82
74
83
Pass a base URL and bearer token:
@@ -308,11 +317,6 @@ The SDK base64-encodes secret data transparently; pass plaintext.
308
317
|`client.secrets.patch(name, { data, ... })`| Update a secret |
309
318
|`client.secrets.delete(name)`| Delete a secret |
310
319
311
-
## Examples
312
-
313
-
*[Video conversion with TypeScript](/platform/typescript-video-conversion/) — create a VM, install ffmpeg, transcode a video, and stream the binary result back via `stdio: 'base64'`. Full e2e walkthrough with runnable source.
314
-
*[`examples/` in the SDK repo](https://github.com/slicervm/sdk-ts/tree/master/examples) — more runnable examples.
315
-
316
320
## See also
317
321
318
322
*[SDK source on GitHub](https://github.com/slicervm/sdk-ts) — issues, releases, changelog
0 commit comments