Overview
The crates/ directory is flat. It currently holds the core library, three adapters, and supporting crates, and the pluggable provider model will soon add per-vendor provider crates (Edge Cookie, device, and geo, each potentially with multiple vendor implementations). A flat crates/ root will not scale and is already harder to navigate than it needs to be.
This proposes grouping crates by role using subdirectories. Cargo workspaces support nested member paths, so this is a file move plus a workspace-member path update, with no change to crate names or runtime behaviour.
Proposed structure
Exact naming is open for discussion, but the shape would be:
crates/
core/ # trusted-server-core
adapters/
fastly/ # trusted-server-adapter-fastly
axum/ # trusted-server-adapter-axum
cloudflare/ # trusted-server-adapter-cloudflare
providers/
edgecookie/<vendor>/ # e.g. providers/edgecookie/51degrees (future)
device/<vendor>/
geo/<vendor>/
support/
openrtb/ # trusted-server-openrtb
js/ # trusted-server-js
integration-tests/
Package names (for example trusted-server-adapter-fastly) stay the same. Only the directory layout and the workspace member paths change.
Rationale
- Discoverability: a crate's role is obvious from its path.
- Room to grow: per-vendor provider crates get a clear home under
providers/<type>/<vendor> without crowding the root.
- Clean separation: adapters, core, providers, and supporting crates become visually distinct.
Tasks
Notes
- Purely a move: no runtime behaviour changes. Best landed as a standalone, mechanical PR so it stays reviewable and does not collide with feature work.
default-members must continue to point at the Fastly adapter so Viceroy can locate the binary via cargo run --bin.
- Timing should be coordinated to minimise rebase pain for in-flight branches.
- Related to the pluggable provider model work, which is what motivates the
providers/ subtree.
Overview
The
crates/directory is flat. It currently holds the core library, three adapters, and supporting crates, and the pluggable provider model will soon add per-vendor provider crates (Edge Cookie, device, and geo, each potentially with multiple vendor implementations). A flatcrates/root will not scale and is already harder to navigate than it needs to be.This proposes grouping crates by role using subdirectories. Cargo workspaces support nested member paths, so this is a file move plus a workspace-member path update, with no change to crate names or runtime behaviour.
Proposed structure
Exact naming is open for discussion, but the shape would be:
Package names (for example
trusted-server-adapter-fastly) stay the same. Only the directory layout and the workspace member paths change.Rationale
providers/<type>/<vendor>without crowding the root.Tasks
crates/adapters/.crates/providers/<type>/<vendor>(placeholders where only the in-core default exists).openrtb,js,integration-tests) as agreed.Cargo.tomlworkspacemembers,default-members, and all path dependencies..cargo/config.tomlaliases andfastly.tomlbuild paths where they reference crate locations.wasm32-wasip1,wasm32-unknown-unknown, native) and the JS build.Notes
default-membersmust continue to point at the Fastly adapter so Viceroy can locate the binary viacargo run --bin.providers/subtree.