Development Setup
Development Setup
This guide walks you through setting up your local environment for contributing to Rusta.
Prerequisites
- Rust 1.79+ (2021 edition) — install via rustup
- Docker — required for integration tests
- Node.js 18+ — only needed for docs site development
- Git — for version control
Clone the Repository
git clone https://github.com/beejay141/rusta.gitcd rustaVerify the Build
Run a quick check to make sure everything compiles:
cargo check --workspaceThis compiles all crates in the workspace without running tests.
Run the Example App
The fastest way to see Rusta in action:
# Start MongoDBdocker compose up mongo -d
# Run the examplecargo run -p rusta-exampleThe API will be available at http://localhost:3001.
Run Tests
Unit tests
cargo test --workspace --libIntegration tests
Integration tests use testcontainers and require Docker:
# Build the test image firstdocker build -t rusta-example:test -f rusta-example/Dockerfile .
# Run integration testscargo test -p rusta-example --testsSpecific test
cargo test -p rusta-example test_register_success -- --nocaptureIDE Setup
VS Code
Recommended extensions:
rust-lang.rust-analyzer— Rust language servertamasfe.even-better-toml— TOML supportEditorConfig.EditorConfig— EditorConfig support
IntelliJ / CLion
- Install the Rust plugin
- Open the workspace root as a project
Project Structure
rusta/├── rusta/ # Core framework├── rusta-di/ # Dependency injection├── rusta-di-macros/ # Proc-macros├── rusta-apm/ # APM├── rusta-logger/ # Logger├── rusta-example/ # Example blog API├── cargo-rusta/ # CLI scaffolder├── docs/ # Reference docs (markdown)├── rusta-docs/ # Astro docs site└── .github/workflows/ # CICommon Tasks
Format code
cargo fmt --allLint code
cargo clippy --workspace --all-targetsBuild release binaries
cargo build --release --workspaceBuild the docs site
cd rusta-docsnpm installnpm run devThe site will be available at http://localhost:4321.
Test the CLI scaffolder
# Build the CLIcargo build --release -p cargo-rusta
# Scaffold a test projectcd /tmprm -rf test-project../rusta/target/release/cargo-rusta new test-project --template defaultcd test-projectcargo checkTroubleshooting
“linker not found” on Linux
Install build essentials:
sudo apt install build-essential pkg-config libssl-devDocker permission errors
Add your user to the docker group:
sudo usermod -aG docker $USER# Log out and back in for changes to take effectProc-macro errors
If you see cryptic errors from rusta-di-macros, try:
cargo cleancargo check --workspaceStale build artifacts
cargo cleanrm -rf targetcargo build --workspaceNext Steps
- Read the Contributing Guide for workflow and PR etiquette
- Browse the Guides to understand the framework
- Look at the Examples for real-world usage