Development
Getting started
git clone https://github.com/terranchi/tyr.gitcd tyrPrerequisites
- Rust 1.90+ (via rustup)
- protoc — protocol buffer compiler
- PostgreSQL 14+ (locally or via Docker)
- pnpm 9+ and Node 22+ — for the web UI
- Docker — for compose stacks and CI parity
macOS:
brew install rustup protobuf pnpm postgresql@17Ubuntu:
sudo apt install protobuf-compiler postgresqlcurl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | shcurl -fsSL https://get.pnpm.io/install.sh | sh -Workspace layout
crates/├── tyr-agent/ # tyrd — eBPF agent (Linux-only build target for agent code)├── tyr-cli/ # tyr — admin CLI├── tyr-common/ # shared types, policy compiler, Cedar bindings└── tyr-server/ # tyr-server — control plane
proto/ # .proto files for gRPCweb/ # Svelte 5 dashboard (pnpm workspace)examples/policies/ # Starter policiesdeploy/ # Docker + docker-composedocs/adr/ # Architecture decision recordsdocs-site/ # This documentation site (Astro Starlight)Build
cargo build --workspace # all cratescargo build --release -p tyr-server # just the servercd web && pnpm install && pnpm build # web UITest
Tests require PostgreSQL. Quickest setup:
docker compose -f deploy/docker-compose.dev.yml up -d postgresDATABASE_URL=postgres://tyr:tyr-dev-password@localhost:5432/tyr \ cargo test --workspaceOr use the repo’s rtk wrapper script (sources env automatically).
Running one crate’s tests
DATABASE_URL=... cargo test -p tyr-serverCoverage
cargo install cargo-llvm-covDATABASE_URL=... cargo llvm-cov --workspace --lcov --output-path lcov.infoPre-commit hook enforces ≥75% line coverage per crate.
Lint
cargo fmt --all -- --checkcargo clippy --workspace --all-targets -- -D warningsBoth run in CI and as pre-commit hooks. Run them locally before pushing.
Running locally end-to-end
# Start Postgresdocker compose -f deploy/docker-compose.dev.yml up -d postgres
# Server (terminal 1)DATABASE_URL=postgres://tyr:tyr-dev-password@localhost:5432/tyr \TYR_WEB_DIR=web/build \TYR_REST_NO_TLS=true \cargo run -p tyr-server
# Web UI dev server (terminal 2, for HMR)cd web && pnpm dev
# Agent (terminal 3) — Linux-onlysudo -E cargo run -p tyr-agent -- \ --server http://localhost:7700 \ --name dev-laptop
# CLIcargo run -p tyr-cli -- --server http://localhost:7701 agent listProtocol buffers
When editing .proto files:
# the build.rs auto-regenerates; just rebuildcargo build -p tyr-commonArchitecture decision records
Major decisions live in docs/adr/:
- 001 — Policy engine
- 002 — gRPC event schema
- 003 — Agent identity
- 004 — Kernel enforcement model
- 005 — Multi-env control plane
- 006 — TLS interception
Before major features, write a new ADR under docs/adr/. Propose via PR for discussion.
Commit style
- Conventional-ish: prefer
feat:,fix:,docs:,refactor:,test:,chore:. - One logical change per commit.
- Tests accompany feature commits.
Pull requests
- Open against
main. - CI must be green — fmt, clippy, tests, coverage, docs build.
- For breaking changes, update the CHANGELOG and note in PR description.