Cargo-Forge is an interactive, intelligent Rust project generator that creates production-ready project structures with best practices, optional features, and comprehensive tooling setup. It's designed to get you from idea to implementation faster than traditional boilerplate approaches.
While both tools generate Rust projects from templates, Cargo-Forge offers several unique advantages:
- Interactive TUI: Beautiful terminal interface for selecting options
- Intelligent defaults: Smart suggestions based on project type
- Validated combinations: Ensures selected features work together
- Built-in templates: No need to find external template repositories
- Feature integration: Seamlessly combines multiple features (auth, database, CI)
- Dry-run mode: Preview what will be generated before creation
Yes! Cargo-Forge is completely free and open source under the MIT/Apache-2.0 dual license. There are no paid tiers or premium features - everything is available to everyone.
- Rust 1.70.0 or later
- Cargo (comes with Rust)
- Git (optional but recommended)
- OS: Windows, macOS, or Linux
cargo install cargo-forgeThat's it! The command will be available as cargo-forge.
Yes, you can build from source:
git clone https://github.com/marcuspat/cargo-forge
cd cargo-forge
cargo install --path .cargo install cargo-forge --forceYes, using cargo-run:
cargo run --git https://github.com/marcuspat/cargo-forge -- new my-projectThe simplest way is to run:
cargo-forge newThis starts the interactive mode where you can choose all options step by step.
Yes! Use the --non-interactive flag:
cargo-forge new my-project --project-type api-server --non-interactiveThis uses sensible defaults without prompting for input.
Create a configuration file at ~/.config/cargo-forge/config.toml:
[defaults]
author = "Your Name"
license = "MIT"
always_add_ci = trueYes, use the --dry-run flag:
cargo-forge new my-project --dry-runThis shows what would be created without actually generating files.
Use the init command in your project directory:
cd existing-project
cargo-forge init --project-type library- cli-tool: For command-line applications and developer tools
- library: For reusable Rust crates
- api-server: For REST APIs and web services
- wasm-app: For browser-based applications
- game-engine: For game development with Bevy
- embedded: For microcontroller/IoT projects
- workspace: For multi-crate projects
Not automatically, but you can:
- Generate a new project with the desired type
- Copy your existing code over
- Or manually add the required dependencies and structure
Yes, use the workspace project type to combine multiple crates with different purposes in a single repository.
Common features include:
- Authentication: JWT, OAuth, password-based
- Database: PostgreSQL, MySQL, SQLite
- CI/CD: GitHub Actions, GitLab CI
- Docker: Containerization support
- Testing: Property tests, benchmarks, E2E tests
Currently, features must be selected during generation. We're working on a cargo-forge add-feature command for future releases.
While Cargo-Forge uses built-in templates, you can:
- Fork the repository
- Modify templates in the
templates/directory - Build and use your custom version
Not directly, but you can:
- Use
--dry-runto preview - Delete unwanted files after generation
- Submit a feature request for more granular control
Cargo-Forge uses Tera, a Jinja2-like template engine for Rust.
Templates are embedded in the binary using include_dir!, making Cargo-Forge a single self-contained executable.
Not directly in templates, but you can pass values through the CLI:
cargo-forge new my-project --author "$USER"Yes, Cargo-Forge automatically handles path conversions across platforms.
Common reasons:
- Invalid project name (must be valid Rust identifier)
- Directory already exists
- No write permissions
- Disk space issues
Check for:
- Typos in variable names
- Missing
.teraextension - Incorrect conditional syntax
- Special characters in input values
Enable debug logging:
RUST_LOG=debug cargo-forge new my-projectCargo-Forge outputs errors directly to stderr. Capture them with:
cargo-forge new my-project 2> error.logYes! Commit all generated files so other developers can:
- See the complete project structure
- Build without running Cargo-Forge
- Track changes over time
After generation:
- Run
cargo updatemonthly - Use
cargo auditfor security updates - Test thoroughly after updates
Absolutely! Generated files are just a starting point. Modify them to fit your needs - that's the whole point!
- Run
cargo-forge newinteractively - Review generated files
- Run tests to ensure everything works
- Start implementing your features
- Keep the README updated
We welcome contributions! See CONTRIBUTING.md for:
- Code contributions
- Template improvements
- Documentation updates
- Bug reports
- Feature requests
Use the GitHub issue tracker with:
- Clear description
- Steps to reproduce
- Expected vs actual behavior
- System information
Yes! New project types are welcome. See the contributing guide for details on adding project types.
Open a discussion on GitHub Discussions or create a feature request issue.
Yes, Cargo-Forge is designed to be scriptable:
#!/bin/bash
for proj in api cli lib; do
cargo-forge new "$proj-service" \
--project-type "$proj" \
--non-interactive
doneCargo-Forge generates standard Rust projects that work with:
- cargo-watch
- cargo-release
- cargo-audit
- rust-analyzer
- Any Cargo subcommand
Yes, modify the generated Cargo.toml:
[registries]
my-registry = { index = "https://my-registry.com/index" }Currently, Cargo-Forge is CLI-only. A library API is planned for future releases.
Upcoming features include:
- Plugin system for custom generators
- Web interface option
- More project types (GraphQL, gRPC)
- Template marketplace
- Project update/migration commands
Check the roadmap for planned features and timelines.
- Watch the GitHub repository
- Join our Discord server
- Follow the blog
- Subscribe to release notifications
Cargo-Forge is open source software.
- Read all documentation
- Try each project type
- Experiment with features
- Contribute to the project
- Help others in the community
Don't see your question? Open a discussion on GitHub!