Codebase Orientation
Learn a Rust workspace by reading Cargo.toml boundaries, tracing the binary main path, and mapping where errors, config, and domain types live.
Busca en todas las páginas de la documentación
Learn a Rust workspace by reading Cargo.toml boundaries, tracing the binary main path, and mapping where errors, config, and domain types live.
# Workspace overview
cat Cargo.toml
cargo tree --depth 2
rg "^\[workspace\]" -l
# Entry points
fd main.rs
rg "#\[tokio::main\]" -l
# Public API surface
cargo doc --no-deps --openWhen to reach for this:
Typical Axum service workspace layout:
billing/
Cargo.toml # workspace root
crates/
api/ # binary: HTTP server
src/main.rs
src/routes/
src/state.rs
domain/ # lib: business logic, no axum
infra/ # lib: sqlx, reqwest adapters
migrations/ # sqlx migrate
Reading order:
Cargo.toml workspace members and shared depsapi/src/main.rs - startup, tracing, pool creationdomain/src/lib.rs - core types and traitsinfra - how DB and HTTP clients implement traitsmigrations/ - schema truthWhat this demonstrates:
api -> domain <- infra| Question | Where to look |
|---|---|
| How is config loaded? | config.rs, main.rs |
| What error type crosses boundaries? | error.rs, domain |
| Where are integration tests? | tests/, api/tests/ |
| CI gates? | .github/workflows/ |
| MSRV? | rust-toolchain.toml, rust-version |
rg "struct AppState" - shared handler statecargo doc - rustdoc on public itemsrust-analyzer goto-def across cratesCargo.toml first.Cargo.toml [features].cargo metadata | jq '.packages[].targets'.cargo doc and architecture/ ADRs.| Alternative | Use When | Don't Use When |
|---|---|---|
| Architecture ADR index | Documented system | Greenfield chaos |
| Onboarding video | Large legacy | Repo has good docs |
| Pairing tour | Complex domain | Solo time-boxed orientation |
Workspace Cargo.toml signals monorepo; clone once, build with --workspace.
Check build.rs, OUT_DIR, and sqlx prepare artifacts - do not hand-edit.
Stack versions: This page was written for Rust 1.97.0 (edition 2024), Tokio 1.x, Axum 0.8, serde 1.0, sqlx 0.8, clap 4, and Polars 0.46+.
Revisado por Chris St. John·Última actualización: 16 jul 2026