Development Setup
This page covers everything you need to build, test, and iterate on Dwaar locally.
Prerequisites
Section titled “Prerequisites”| Requirement | Notes |
|---|---|
| Rust (stable) | Install via rustup. Dwaar tracks the current stable toolchain. |
| OpenSSL headers | libssl-dev (Debian/Ubuntu), openssl-devel (Fedora), or brew install openssl (macOS). |
| Docker | Required only if you want to run integration tests that exercise Docker label discovery. |
| MaxMind GeoLite2 DB | Optional. Needed to build/run with the geo feature enabled. Download from MaxMind. |
| Wasmtime | Optional. Needed to build/run with the wasm-plugins feature enabled. |
Building
Section titled “Building”Build the entire workspace:
cargo build --workspaceBuild with optional features:
# Enable GeoIP supportcargo build --workspace --features geo
# Enable WASM plugin supportcargo build --workspace --features wasm-plugins
# Enable bothcargo build --workspace --features geo,wasm-pluginsBuild a release binary:
cargo build --release -p dwaar-ingressThe resulting binary is at target/release/dwaar.
Running Tests
Section titled “Running Tests”Run the full unit test suite:
cargo test --workspaceRun tests for a single crate:
cargo test -p dwaar-configRun integration tests (requires Docker):
cargo test --workspace --test '*'Benchmarks (requires nightly for some):
cargo bench -p dwaar-logCode Style
Section titled “Code Style”All contributions must pass these checks before opening a PR:
# Formattingcargo fmt --all -- --check
# Lints (zero warnings policy)cargo clippy --workspace --all-targets -- -D warnings
# Testscargo test --workspaceThe CI pipeline enforces all three. Run them locally first to avoid round trips.
Additional standards:
- Every public function and type must have a doc comment.
- New async code must not call
tokio::spawnat request time; use aBackgroundServiceinstead. - Unsafe blocks require a
// SAFETY:comment explaining the invariant.
Project Structure
Section titled “Project Structure”Dwaar is a Cargo workspace. Each crate has a single, focused responsibility:
dwaar-ingress— binary entry point and Pingora server bootstrapdwaar-cli— CLI argument parsingdwaar-core— the hot-pathProxyHttpimplementationdwaar-config— Dwaarfile parsing and hot-reloaddwaar-tls— ACME and SNIdwaar-analytics— JS injection, beacon collection, Prometheusdwaar-plugins— plugin trait and built-in middlewaredwaar-admin— admin APIdwaar-docker— Docker label discoverydwaar-geo— GeoIP lookupsdwaar-log— async request logging
See the Crate Map for per-crate dependency graphs and interface details.
Related
Section titled “Related”- Architecture Overview
- Architecture for Contributors
- CONTRIBUTING.md — PR process, commit convention, release workflow