Scaffold Production-Ready Rust Applications
Rust Project Scaffolding generates idiomatic binary, library, workspace, and Axum web API structures with dev tooling configured.
Why it matters
Automate the creation of idiomatic, safe, and performant Rust applications. This asset generates complete project structures, including cargo tooling, module organization, testing setup, and configuration, adhering to Rust best practices for various project types like binaries, libraries, workspaces, and web APIs.
Outcomes
What it gets done
Generate project structure for binaries, libraries, workspaces, and web APIs (Axum).
Configure Cargo.toml with appropriate dependencies and profiles.
Set up basic src/main.rs or src/lib.rs with essential modules.
Include development tool configurations for Makefiles, rustfmt, and clippy.
Install
Add it to your toolbox
Run in your project directory:
curl -fsSL https://spark.entire.vc/get/ag-systems-programming-rust-project | bash Overview
Rust Project Scaffolding
Rust Project Scaffolding generates idiomatic Rust project structures - binary, library, workspace, or Axum web API - with Cargo.toml, error handling, tests, and dev tooling configured. Use it when scaffolding a new Rust project or needing structure and build-configuration guidance. Not for tasks unrelated to Rust project scaffolding.
What it does
Rust Project Scaffolding generates complete, production-ready Rust project structures across five project types - binary (CLI tools, services), library (reusable crates), workspace (multi-crate monorepos), web API (Axum-based REST services), and WebAssembly - each with idiomatic module organization, a working Cargo.toml, an entry point, and a test/benchmark layout. It also configures the surrounding development tooling: a Makefile with build, test, lint, fmt, run, clean, and bench targets, an rustfmt.toml, and a clippy.toml with a cognitive-complexity threshold.
When to use - and when NOT to
Use it when scaffolding a new Rust project or needing guidance and checklists for Rust project structure, dependency setup, or build configuration. It is explicitly out of scope for anything unrelated to Rust project scaffolding, or when a different domain or tool is actually needed - and, like other skills in this set, is not a substitute for environment-specific validation and calls for stopping to ask when required inputs or success criteria are missing.
Inputs and outputs
Input: the target project type - binary, library, workspace, web API, or WebAssembly - and any specific requirements. Output: a complete directory tree, a populated Cargo.toml, and a working entry point for that project type - for a binary, a clap-based CLI (Cli/Commands/InitArgs/RunArgs) with a tokio async main and an AppError enum implementing Display and std::error::Error; for a library, a documented lib.rs with a doctest example and pub use re-exports; for a workspace, a root Cargo.toml with workspace members, a shared resolver = "2", and workspace.dependencies; for a web API, an Axum Router wired to routes/, handlers/, models/, services/, and middleware/ modules with CORS and tracing configured.
#[tokio::main]
async fn main() {
tracing_subscriber::fmt::init();
let app = Router::new()
.route("/health", get(routes::health::health_check))
.nest("/api/users", routes::users::router())
.layer(CorsLayer::permissive());
let addr = SocketAddr::from(([0, 0, 0, 0], 3000));
tracing::info!("Listening on {}", addr);
let listener = tokio::net::TcpListener::bind(addr).await.unwrap();
axum::serve(listener, app).await.unwrap();
}
Alongside the project itself it generates a Makefile (cargo build/test/clippy -D warnings/fmt --check/run/clean/bench), an rustfmt.toml (100-character max width, 4-space tabs), and a clippy.toml (a cognitive-complexity-threshold of 30), plus release-profile tuning - opt-level 3, LTO, a single codegen unit.
Integrations
Targets the standard Rust toolchain - cargo, clippy, rustfmt - and, for web APIs, the Axum/Tokio/Tower/sqlx stack, with a Postgres-configured sqlx feature set, plus tracing-subscriber for structured logging.
Who it's for
Developers starting a new Rust project - whether a CLI binary, a shared library, a multi-crate workspace, or an Axum web API - who want idiomatic structure, dependency choices, error handling, and dev tooling (lint, format, test, benchmark) set up correctly from the first commit rather than assembled ad hoc.
FAQ
Common questions
Discussion
Questions & comments ยท 0
Sign In Sign in to leave a comment.