Skip to content

Add trusted-server-adapter-axum native dev server (PR 16)#643

Open
prk-Jr wants to merge 16 commits intofeature/edgezero-pr15-remove-fastly-corefrom
feature/edgezero-pr16-axum-dev-server
Open

Add trusted-server-adapter-axum native dev server (PR 16)#643
prk-Jr wants to merge 16 commits intofeature/edgezero-pr15-remove-fastly-corefrom
feature/edgezero-pr16-axum-dev-server

Conversation

@prk-Jr
Copy link
Copy Markdown
Collaborator

@prk-Jr prk-Jr commented Apr 17, 2026

Summary

  • Adds trusted-server-adapter-axum as a native (non-WASM) dev server so the full trusted-server pipeline can be run and tested locally without Fastly Compute or Viceroy
  • Promotes the axum adapter to a first-class workspace member by removing the global target = "wasm32-wasip1" override from .cargo/config.toml; Fastly-specific commands now pass --target wasm32-wasip1 explicitly
  • Extends the integration test matrix so WordPress and Next.js scenarios run against both Fastly (Viceroy) and Axum, verifying identical behaviour across platforms

Changes

File Change
crates/trusted-server-adapter-axum/src/platform.rs PlatformConfigStore, PlatformSecretStore, PlatformBackend, PlatformGeo, PlatformHttpClient — env-var-backed implementations
crates/trusted-server-adapter-axum/src/middleware.rs FinalizeResponseMiddleware + AuthMiddleware — mirrors Fastly adapter, always emits X-Geo-Info-Available: false
crates/trusted-server-adapter-axum/src/app.rs TrustedServerApp implementing Hooks with all 11 routes wired
crates/trusted-server-adapter-axum/src/main.rs + axum.toml Binary entry point; config drives port (default 8787)
crates/trusted-server-adapter-axum/tests/routes.rs 8 integration tests via EdgeZeroAxumService (no live TCP server)
crates/integration-tests/tests/environments/axum.rs AxumDevServer runtime environment added to the matrix
crates/integration-tests/tests/environments/mod.rs Register AxumDevServer alongside FastlyViceroy
crates/integration-tests/tests/integration.rs test_wordpress_axum + test_nextjs_axum individual test functions
scripts/integration-tests.sh Also builds the Axum native binary with test-specific env vars
.cargo/config.toml Remove global target = "wasm32-wasip1"; keep only the viceroy runner
Cargo.toml Move trusted-server-adapter-axum from [exclude] to [members]
crates/trusted-server-adapter-axum/Cargo.toml Adopt workspace deps + lints
.github/workflows/test.yml Add test-axum CI job; test-rust now passes --target wasm32-wasip1 explicitly
CLAUDE.md Document axum adapter in workspace layout + build commands
.gitignore (root + adapter) Ignore .edgezero/ (local KV store created by dev server)

Closes

Closes #497

Test plan

  • cargo test --workspace (Fastly/WASM crates via Viceroy)
  • cargo test -p trusted-server-adapter-axum (8 route + middleware tests)
  • cargo clippy --workspace --all-targets --all-features -- -D warnings
  • cargo fmt --all -- --check
  • JS tests: cd crates/js/lib && npx vitest run (282 tests)
  • Integration tests: test_wordpress_fastly, test_nextjs_fastly, test_wordpress_axum, test_nextjs_axum all pass
  • Manual testing: cargo run -p trusted-server-adapter-axum starts on port 8787

Checklist

  • Changes follow CLAUDE.md conventions
  • No unwrap() in production code — use expect("should ...")
  • Uses log macros (not println!)
  • New code has tests
  • No secrets or credentials committed

prk-Jr added 12 commits April 17, 2026 11:13
Move trusted-server-adapter-axum from workspace exclude to members list.
Remove the global `target = "wasm32-wasip1"` build override from
.cargo/config.toml (which forced the axum crate out of the workspace)
and pass --target wasm32-wasip1 explicitly only for Fastly CI commands.
Delete the now-redundant crate-local .cargo/config.toml.

Update CI test-rust job to exclude the axum crate and pass the explicit
target; test-axum job runs from the workspace root with -p flag.
Add .edgezero/ to .gitignore to exclude the local KV store file.
Register AxumDevServer alongside FastlyViceroy in RUNTIME_ENVIRONMENTS so
the full framework x runtime scenario matrix (WordPress, Next.js) runs
against both platforms.

AxumDevServer spawns the native trusted-server-axum binary (no WASM or
Viceroy), binds to the fixed port 8787 (baked into axum.toml at compile
time), and polls for any HTTP response as readiness (root returns 403 in
test env). Binary path defaults to target/debug/trusted-server-axum,
overridable via AXUM_BINARY_PATH.

Settings are baked in at build time via TRUSTED_SERVER__* env vars, same
as Fastly. The integration-tests.sh script now builds both the WASM and
the native Axum binary with test-specific overrides (origin=127.0.0.1:8888).

Add test_wordpress_axum and test_nextjs_axum individual test functions.
Ignore .edgezero/ at workspace root (local KV store from the dev server).
@prk-Jr prk-Jr self-assigned this Apr 17, 2026
@prk-Jr prk-Jr linked an issue Apr 17, 2026 that may be closed by this pull request
prk-Jr added 3 commits April 17, 2026 13:42
- README: update Quick Start and Development commands for both runtimes
- getting-started: add Axum as Option A (no Fastly CLI needed)
- architecture: add trusted-server-adapter-axum to Core Components;
  add Runtime Targets table
- testing: fix cargo test commands; add Axum adapter section; split
  Local Server Testing into Axum vs Fastly; restore clippy step in
  CI/CD workflow example alongside new test-axum job
The integration test matrix includes AxumDevServer which requires the
native trusted-server-axum binary. Add build-axum step to the shared
setup action, package the binary alongside the WASM artifact, and pass
AXUM_BINARY_PATH to the integration test run step.
@prk-Jr prk-Jr marked this pull request as draft April 17, 2026 08:27
@prk-Jr prk-Jr marked this pull request as ready for review April 18, 2026 14:14
@prk-Jr prk-Jr requested review from ChristianPavilonis and aram356 and removed request for aram356 April 18, 2026 14:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Axum dev server entry point

1 participant