| Crates.io | cargo-setupx |
| lib.rs | cargo-setupx |
| version | 0.1.0 |
| created_at | 2025-10-14 17:28:17.997644+00 |
| updated_at | 2025-10-14 17:28:17.997644+00 |
| description | Rust-based CLI and library that automates the initial setup of new Rust projects with modular configuration packs |
| homepage | |
| repository | https://github.com/ricardoferreirades/cargo-setupx |
| max_upload_size | |
| id | 1882791 |
| size | 69,122 |
Automate Rust project setup with modular configuration packs
A Rust-based CLI and library that automates the initial setup of new Rust projects. Provides modular configuration packs that can be selectively applied to standardize development environments.
Quality Pack - Code quality configuration files
rustfmt.toml - Code formatting rulesclippy.toml - Linting configuration_typos.toml - Spell checking setupMakefile - Common development commandsHooks Pack - Git hooks for automated quality checks
.githooks/pre-push - Pre-push quality gate.githooks/setup.sh - Hooks installation scriptcore.hooksPath automaticallyArchitecture Pack - Project structure scaffolding
cargo install cargo-setupx
Or install from source:
git clone https://github.com/ricardoferreirades/cargo-setupx.git
cd cargo-setupx
cargo install --path .
# In your Rust project directory
cargo setupx --all
# Quality pack only
cargo setupx --quality
# Hooks pack only
cargo setupx --hooks
# Architecture pack (clean)
cargo setupx --arch=clean
# Quality + Hooks
cargo setupx --quality --hooks
# Overwrite existing files
cargo setupx --all --force
# Skip confirmation prompt
cargo setupx --all --yes
# Show help
cargo setupx --help
# Apply to current directory
cargo setupx --quality --hooks
# Apply to specific directory
cargo setupx --all /path/to/project
# Force overwrite with no prompts
cargo setupx --all --force --yes
use cargo_setupx::{Config, apply_packs};
use std::path::Path;
let config = Config {
quality: true,
hooks: true,
arch: Some("clean".to_string()),
force: false,
yes: false,
};
apply_packs(&config, Path::new(".")).expect("Failed to apply packs");
--quality)Creates the following files in your project root:
clippy.toml # Clippy linter configuration
rustfmt.toml # Rustfmt formatter settings
_typos.toml # Typos spell checker config
Makefile # Development commands
Makefile commands:
make fmt - Format code (cargo fmt + taplo)make lint - Run clippy lintermake lint-fix - Auto-fix linting issuesmake check - Type check without buildingmake spell - Check spellingmake spell-fix - Auto-fix spelling errorsmake quality - Run all quality checksmake test - Run testsmake run - Run the application--hooks)Creates Git hooks for automated quality checks:
.githooks/
โโโ pre-push # Pre-push quality gate (executable)
โโโ setup.sh # Hook installation script (executable)
โโโ README.md # Hooks documentation
The pre-push hook runs:
cargo fmt --check)taplo format --check)cargo clippy -- -D warnings)typos)cargo check)cargo test)Push is blocked if any check fails!
--arch=clean)Note: Currently only Clean Architecture is supported. Other patterns (hexagonal, onion) are planned.
Creates Clean Architecture folder structure:
src/
โโโ domain/
โ โโโ entities/
โ โโโ repositories/
โ โโโ services/
โโโ application/
โ โโโ dto/
โ โโโ use_cases/
โโโ infrastructure/
โ โโโ database/
โ โโโ config/
โ โโโ http/
โโโ presentation/
โโโ handlers/
Each directory includes:
mod.rs with documentationFor full functionality, install these tools:
# Taplo (TOML formatter)
cargo install taplo-cli
# Typos (spell checker)
cargo install typos-cli
After running cargo setupx --all, use these commands:
# Initial setup
make setup-hooks # Configure git hooks
# Daily development
make quality # Run all checks
make fmt # Format code
make lint-fix # Fix linting issues
make spell-fix # Fix spelling
# Testing
make test # Run tests
make check # Quick type check
# Building
make build # Build release
make clean # Clean artifacts
Running cargo setupx multiple times is safe. It will:
--force is used)Use --force to overwrite existing files:
cargo setupx --all --force
Use --yes to skip confirmation prompts:
cargo setupx --all --yes
# Create new Rust project
cargo new my-awesome-project
cd my-awesome-project
# Apply all packs
cargo setupx --all
# Setup git hooks
make setup-hooks
# Verify everything works
make quality
# In your existing project
cd my-existing-project
# Apply quality + hooks (no architecture changes)
cargo setupx --quality --hooks --yes
# Setup hooks
make setup-hooks
# Create library
cargo new --lib my-library
cd my-library
# Apply quality pack + clean architecture
cargo setupx --quality --arch=clean
# Verify
make quality
Run the test suite:
cargo test
Run specific tests:
cargo test quality
cargo test hooks
cargo test architecture
Generate and open documentation:
cargo doc --open
Contributions are welcome! Please feel free to submit a Pull Request.
git checkout -b feat/amazing-feature)make quality)git commit -m 'feat: add amazing feature')git push origin feat/amazing-feature)This project is licensed under the MIT License - see the LICENSE file for details.
.setupx.tomlMade with โค๏ธ by Ricardo Ferreira