Back to Templates
Rust CLI

Rust CLI Starter with Clap 4, Tokio, anyhow & cargo-nextest

Rust CLI with clap, testing, and CI

terminal
npx setupkaro init my-cli --template rust-cli
Zero installNo telemetryMIT License

What's Included

  • Clap 4 derive-based CLI with subcommands and arg validation
  • Tokio runtime (optional async commands)
  • anyhow + thiserror for ergonomic error handling
  • clippy (pedantic, nursery, cargo) + rustfmt
  • cargo-nextest (fast tests) + cargo-tarpaulin (coverage)
  • cargo-audit + cargo-deny for supply chain security
  • GitHub Actions: fmt, clippy, test (nextest), audit, build, docker
  • Distroless Dockerfile (static binary) + docker-compose
  • Generated README with cargo-binstall install instructions

Generated Folder Structure

src/
main.rs
cli.rs
commands/
errors.rs
tests/
integration_test.rs
.github/workflows/ci.yml
Dockerfile
docker-compose.yml
Cargo.toml
rustfmt.toml
clippy.toml
README.md

Quick Start Commands

Generate Project

terminal
npx setupkaro init my-cli --template rust-cli

Next Steps

cd my-app
cargo build
cargo run -- --help

Frequently Asked Questions

Why Clap derive instead of builder pattern?
Derive API is more ergonomic, less boilerplate, and Clap 4's derive is feature-complete.
Does it include a TUI framework (ratatui, crossterm)?
No — this is a standard CLI template. Add `ratatui` or `crossterm` after generation if needed.
What about cross-compilation?
The README documents using `cross` for cross-compilation. GitHub Actions builds for linux/amd64, linux/arm64.
Can I use this for a library crate instead?
This template is for binaries. For libraries, use `cargo new --lib` and add the lint/test config manually.

Generate Another Template

React + TypeScript

Vite + React + TS with Tailwind and React Router

terminal
npx setupkaro init my-app --template react-ts

Replace my-app with your project name.

Ready to generate your Rust CLI project?

One command. Production-ready. Start building in seconds.

terminal
npx setupkaro init my-cli --template rust-cli