Skip to content

Commit 4e51206

Browse files
committed
Add Spin adapter to public docs and README
- README Quick Start: add cargo test-spin - README Development: replace broad workspace clippy with target-matched aliases and note why; add cargo test-spin to test list - architecture.md: mention Cloudflare/Spin in the high-level overview; add trusted-server-adapter-spin section with build/test/lint commands and known MVP limits; expand Runtime Targets table to include all four adapters; add note on target-matched clippy requirement
1 parent 4d10761 commit 4e51206

2 files changed

Lines changed: 46 additions & 8 deletions

File tree

README.md

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ cargo test-axum
3434
# Run tests (Cloudflare Workers adapter — native host)
3535
cargo test-cloudflare
3636

37+
# Run tests (Spin adapter — native host)
38+
cargo test-spin
39+
3740
# Start local server — Axum (no Fastly CLI or Viceroy required)
3841
cargo run -p trusted-server-adapter-axum
3942

@@ -47,13 +50,19 @@ fastly compute serve
4750
# Format code
4851
cargo fmt
4952

50-
# Lint
51-
cargo clippy --workspace --all-targets --all-features -- -D warnings
53+
# Lint — use target-matched aliases (workspace has multiple WASM runtimes;
54+
# broad --all-features clippy is not a reliable gate across adapters)
55+
cargo clippy-fastly
56+
cargo clippy-axum
57+
cargo clippy-cloudflare
58+
cargo clippy-spin-native
59+
cargo clippy-spin-wasm
5260

5361
# Run all tests
5462
cargo test-fastly # Fastly/WASM (requires Viceroy)
5563
cargo test-axum # Axum native adapter
5664
cargo test-cloudflare # Cloudflare Workers adapter (native host)
65+
cargo test-spin # Spin adapter (native host)
5766
```
5867

5968
See [CONTRIBUTING.md](CONTRIBUTING.md) for contribution guidelines.

docs/guide/architecture.md

Lines changed: 35 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Understanding the architecture of Trusted Server.
44

55
## High-Level Overview
66

7-
Trusted Server is built as a Rust-based edge computing application. The core logic lives in a platform-agnostic library; platform-specific adapters target different runtimes (Fastly Compute, native Axum).
7+
Trusted Server is built as a Rust-based edge computing application. The core logic lives in a platform-agnostic library; platform-specific adapters target different runtimes (Fastly Compute, Cloudflare Workers, Fermyon Spin, native Axum).
88

99
```mermaid
1010
flowchart TD
@@ -61,6 +61,33 @@ Native Axum dev/test adapter (native binary):
6161
| Admin key management (`/admin/keys/*`) | Returns 501 Not Implemented |
6262
| Auction fan-out ordering | Requests run concurrently via `tokio::spawn`; `select` returns first-to-complete but does not replicate Fastly's priority-queue tie-breaking |
6363

64+
### trusted-server-adapter-spin
65+
66+
Fermyon Spin adapter (`wasm32-wasip1` component):
67+
68+
- Production-capable deployment target for the Spin runtime
69+
- Platform services (config store, secret store, KV) backed by Spin component variables and the EdgeZero KV handle
70+
- Outbound HTTP via `spin_sdk::http::send` — no configurable per-request timeout (see rustdoc)
71+
- Single auction provider only; multi-provider fan-out requires the Fastly adapter
72+
73+
```bash
74+
# Check (native)
75+
cargo check -p trusted-server-adapter-spin
76+
77+
# Check (WASM component target)
78+
cargo check-spin
79+
80+
# Build WASM artifact
81+
cargo build --package trusted-server-adapter-spin --target wasm32-wasip1 --features spin --release
82+
83+
# Test (native host)
84+
cargo test-spin
85+
86+
# Lint
87+
cargo clippy-spin-native
88+
cargo clippy-spin-wasm
89+
```
90+
6491
## Design Patterns
6592

6693
### RequestWrapper Trait
@@ -124,12 +151,14 @@ User data is not persisted in storage - only processed in-flight at the edge.
124151

125152
## Runtime Targets
126153

127-
| Adapter | Target | Use case |
128-
| ------------------------------- | --------------- | ----------------------------------------------------------------- |
129-
| `trusted-server-adapter-fastly` | `wasm32-wasip1` | Production on Fastly Compute |
130-
| `trusted-server-adapter-axum` | native | Local development and integration testing (see limitations above) |
154+
| Adapter | Target | Use case |
155+
| ----------------------------------- | ------------------------- | ----------------------------------------------------------------- |
156+
| `trusted-server-adapter-fastly` | `wasm32-wasip1` | Production on Fastly Compute |
157+
| `trusted-server-adapter-cloudflare` | `wasm32-unknown-unknown` | Production on Cloudflare Workers |
158+
| `trusted-server-adapter-spin` | `wasm32-wasip1` component | Production on Fermyon Spin |
159+
| `trusted-server-adapter-axum` | native | Local development and integration testing (see limitations above) |
131160

132-
The Fastly adapter compiles to WebAssembly for sandboxed, low-cold-start edge execution. The Axum adapter is a standard native binary — no WASM toolchain required for local development.
161+
The workspace has multiple WASM runtimes with runtime-specific SDKs. Use target-matched clippy aliases (`cargo clippy-fastly`, `cargo clippy-spin-native`, etc.) rather than broad `--all-features` workspace clippy — the latter is not a reliable gate across adapters.
133162

134163
## Next Steps
135164

0 commit comments

Comments
 (0)