# cargo-quickstart
A blazing fast and opinionated `cargo` subcommand to bootstrap modern Rust projects with confidence and speed.
βΈ»
## β¨ Features
- π Quickly scaffold `bin`, `lib`, or hybrid projects.
- π οΈ Preconfigured best-practice templates: `.vscode/`, `.cargo/config.toml`, `.gitignore`.
- π Full documentation scaffolding: README, CHANGELOG, CONTRIBUTING, CODE_OF_CONDUCT.
- π§© Flexible template system with variants (minimal/extended).
- π‘οΈ Built-in Git integration and license generation (MIT, Apache-2.0).
- π― Fast CI/CD-ready projects out of the box.
- π Shell completions for Bash, Zsh, Fish, PowerShell, and Elvish.
- π§° Project health diagnostics with the `doctor` command.
- π Comprehensive benchmarking infrastructure for performance optimization.
βΈ»
## π Quickstart
```bash
cargo quickstart my-awesome-project --bin --edition 2021 --git --license MIT
```
This will scaffold a full project with Git initialized, best practices set up, and documentation templates ready to go.
βΈ»
## π Why cargo-quickstart?
While `cargo new` and `cargo-generate` are powerful, `cargo-quickstart` offers **fast, reproducible, and opinionated** project setups without manual boilerplate, ideal for teams and solo developers alike.
βΈ»
## π¦ Installation
Until published on crates.io:
```bash
git clone https://github.com/sm-moshi/cargo-quickstart
cd cargo-quickstart
cargo install --path crates/quickstart-cli
```
βΈ»
## π€ Roadmap
- β
Working CLI, project generator, template system
- β
VS Code integration with optimal settings
- β
Documentation stubs: CHANGELOG, CONTRIBUTING, CODE_OF_CONDUCT
- β
Doctor command for project health diagnostics
- β
Shell completions for all major shells
- π Interactive mode, remote templates, template variants
- π Mid-term: Config file support, template info/discovery
- π Future: Remote/custom template support, smart-release
(See [ROADMAP.md](docs/ROADMAP.md) for full details.)
βΈ»
## π€ Contributing
Contributions, feature ideas, bug reports are warmly welcome! Have fun!
See [CONTRIBUTING.md](docs/CONTRIBUTING.md).
βΈ»
## π License
Dual-licensed under MIT OR Apache-2.0.
## Template System Directory Structure
The template system uses a flexible, file-based approach for project scaffolding. Templates are stored in a `templates/` directory at the project root, with the following structure:
```text
/templates
/base # Common files for all projects (placed at project root)
README.md.hbs
CHANGELOG.md.hbs
CONTRIBUTING.md.hbs
CODE_OF_CONDUCT.md.hbs
.gitignore.hbs
Cargo.toml.hbs
/.vscode/ # VS Code configuration templates
settings.json.hbs
extensions.json.hbs
launch.json.hbs
tasks.json.hbs
/.cargo/
config.toml.hbs
/binary
/minimal/src/main.rs.hbs
/extended/src/main.rs.hbs
/library
/minimal/src/lib.rs.hbs
/extended/src/lib.rs.hbs
```
- **Base templates**: Files in `base/` are always placed at the root of the generated project (e.g., `README.md`, not `base/README.md`).
- **Type/variant templates**: Files in `binary/` and `library/` are placed according to their subdirectory structure.
- **File extension**: Only `.hbs` files are treated as templates using Handlebars syntax for variable substitution.
### Template Variables
Templates use a consistent set of variables:
- `name`: Project name (used throughout all templates)
- `project.is_binary` / `project.is_library`: Conditional sections for project type
- `date.year`: Dynamic year generation for documentation
## Shell Completions π
cargo-quickstart supports shell completions for Bash, Zsh, Fish, PowerShell, and Elvish. To generate completions, use the `completions` subcommand:
```
cargo quickstart completions <shell> [--output <path>]
```
- If `--output` is omitted, completions are printed to stdout.
- Example (Bash):
```sh
cargo quickstart completions bash > /usr/local/etc/bash_completion.d/cargo-quickstart
```
- Example (Zsh):
```sh
cargo quickstart completions zsh > "${fpath[1]}/_cargo-quickstart"
```
- Example (Fish):
```sh
cargo quickstart completions fish | source
```
## VS Code Integration βοΈ
Generated projects include comprehensive VS Code configuration:
- **settings.json**: Rust-analyzer settings optimized for development
- **extensions.json**: Recommended extensions for Rust development
- **launch.json**: Debug configurations for binary applications and library tests
- **tasks.json**: Common cargo commands with problem matcher configurations
These configurations provide an optimal developer experience right out of the box.
## Doctor Command π©Ί
Use the `doctor` command to check the health of your project:
```
cargo quickstart doctor
```
This analyzes your project structure, dependencies, and configuration to identify potential issues and provide recommendations for improvements.