CLI tool for generating structured Rust backend projects using clean architecture principles and a terminal user interface.
Backend Builder provides a TUI to configure and generate a Rust API template. The generated project is organized into domain, application, and infrastructure layers. The tool uses a marker-based injection system to surgically remove or include code blocks based on user selection, ensuring the output is always a valid and compilable Rust project.
- Rust 1.82.0 or later.
- Cargo.
- Diesel CLI (for database migrations).
- Postgres or SQLite.
- OpenSSL and pkg-config (on Linux systems).
Install the tool globally using Cargo:
cargo install --path .After installation, run the tool from any directory:
backend-builder- Project Metadata: Define project name and description.
- Database: Select between Postgres, SQLite, or None.
- Authentication: Optional JWT implementation.
- Encryption: Choose between Bcrypt or Argon2 for password hashing.
- Domain Selection: Include or exclude the default User domain.
- Documentation: Optional Swagger/OpenAPI integration.
- TAB: Move to next field.
- BACKTAB: Move to previous field.
- ENTER: Toggle selection or trigger generation.
- BACKSPACE: Delete characters in text fields.
- ESC: Quit application.
The tool embeds a base template using the include_dir crate. During generation, it processes the source files and removes blocks delimited by @marker and @end tags if the corresponding feature is disabled. It also modifies Cargo.toml to include only the necessary dependencies.