Introducing a Best-Practices Rust Workspace GitHub Template
An artist's[1] interpretation of a Rust workspace template.
tl;dr
I've created a Rust workspace GitHub template that has best practices implementations and scaffolding with as few "opinions" as reasonable. It's intended to be near-zero effort to get up and going and is scalable.
As I get further involved with Rust development both personally and professionally - I've found I need an easy way to onboard new projects with best-practices as "batteries included". Rust (and cargo) already do an incredible job of bringing modern software practices into development and tooling. I needed a template that enforced these and has base implementations (or scaffolding) for most libraries and applications. I'll certainly be using it for my Rust projects and I hope that it's a help for you too!
Features
- Only Rust- or cargo-ecosystem tooling
- Robust Continuous Integration (CI)
- Fast and parallel
- Dependency auditing
- Unused dependencies
- Vulnerability checks
- Licenses
- Static analysis for security and auditing
- via zizmor
- Local development matches as much as possible
- Strict workspace-wide linting configuration for safety
- Automatic versioning and releasing
- Commits should adhere to Conventional Commits
release-plz
- Modern and fast testing
nextestcargo-llvm-covfor coverage
- Benchmarking
- GitHub templates
CODEOWNERS- Dependabot
- Pull request template
- Bug report template
- Feature request template
- Security policy
- Code of conduct
- Contributing guidelines
- Sensible default dependencies
- Project defaults
LICENSEfile
Technologies
cargofor all Rust project functions, naturallyMakeas interface for project actions
Assumptions
The template uses release-plz for version control and releasing. It requires Conventional Commits for commit messages to know how to bump the version (using Semantic Versioning).
The template assumes that main will be the default git branch.
This template has been tested for local dev using macOS. Other operating systems may work or could easily be extended to include them.
Future
I'll continually be updating this template as I use it and new best practices come out. All feedback is welcome (PRs preferred) and I certainly hope you will contribute too.
cheers -
scm
The images in this post were generated by AI and reviewed by a human.