Contributing
Contributing to Rusta
Thanks for wanting to contribute! This document explains the expected workflow, testing, and how to add docs or examples.
Quickstart
- Fork the repo and open a PR against
main. - Keep work on a feature branch:
git checkout -b feature/your-change. - Run the workspace checks locally before opening a PR:
cargo check --workspacecargo test --workspaceRepository Layout
rusta/├── rusta/ # Core framework (controllers, routing, DI)├── rusta-di/ # Dependency injection container├── rusta-di-macros/ # Proc-macros for #[injectable], #[controller]├── rusta-apm/ # Application Performance Monitoring├── rusta-logger/ # Structured logging├── rusta-example/ # Full example app (blog API)├── cargo-rusta/ # CLI scaffolder├── docs/ # Reference documentation├── rusta-docs/ # Astro documentation site└── .github/workflows/ # CI workflowsDevelopment Workflow
Run the example app
cargo run -p rusta-exampleRun tests
# All workspace testscargo test --workspace
# Specific cratecargo test -p rusta
# Integration tests (require Docker)cd rusta-exampledocker build -t rusta-example:test -f Dockerfile .cargo test --testsWhen you change proc-macros
Run cargo test in rusta-di-macros and rebuild dependent crates:
cargo test -p rusta-di-macroscargo check -p rusta --testsUse cargo-rusta to scaffold new projects
cargo run -p cargo-rusta -- new my-test-projectDocumentation
Reference docs
Docs live in docs/ (markdown files). To edit:
docs/getting-started.md— Getting started guidedocs/guides-*.md— How-to guidesdocs/reference-*.md— API referencedocs/recipes.md— Common patterns
Documentation website
The website source lives in rusta-docs/src/content/docs/. To add a new page:
- Create a new
.mdfile in the appropriate subdirectory - Add it to the sidebar in
rusta-docs/astro.config.mjs:
{ label: "My New Page", slug: "my-new-page" }- Optionally add a section divider:
{ label: "Section Name", items: [ { label: "Page 1", slug: "page-1" }, { label: "Page 2", slug: "page-2" }, ],}Build the docs site locally
cd rusta-docsnpm installnpm run devCode Style
- Follow existing project patterns
- Keep public API changes minimal and document them in
CHANGELOG.md - Run
cargo fmtbefore committing - Use
cargo clippyfor linting
Tests & CI
Local testing
- Add unit tests next to the code (
#[cfg(test)] mod tests) - Add integration tests under
tests/directories - Use the testcontainers setup for end-to-end tests
CI
GitHub Actions runs on every push and PR. See .github/workflows/ci.yml for the full pipeline. The pipeline:
- Checks the workspace compiles
- Builds and tests the
cargo-rustaCLI - Runs all workspace tests
- Deploys docs on main branch
- Publishes crates on tagged releases
Issue & PR Etiquette
- Reference related issues in PR descriptions (e.g. “Fixes #123”)
- Keep PRs focused — one feature or fix per PR
- Add a changelog fragment under
CHANGELOG.md(Unreleased section) - Be responsive to review feedback
Commit message format
We use Conventional Commits:
feat: add new apm middlewarefix: handle empty body in #[post]docs: update integration testing guidechore: bump dependenciesRelease Process
- Update
CHANGELOG.mdwith the new version - Bump versions in all
Cargo.tomlfiles - Commit:
git commit -m "chore: release v0.1.0" - Tag:
git tag v0.1.0 - Push:
git push origin main --tags - CI will publish all crates in dependency order
Adding a New Crate
To add a new crate to the workspace:
- Create the crate directory:
mkdir new-crate - Add
Cargo.tomlwith the package metadata - Add
src/lib.rs(orsrc/main.rs) - Add to the workspace members in
Cargo.toml:
[workspace]members = ["rusta", "rusta-di", ..., "new-crate"]- Add publish step in
.github/workflows/ci.yml:
- name: Publish `new-crate` run: cargo publish -p new-crateContact
- If unsure about a breaking change or design, open an issue first to discuss
- For security issues, see
SECURITY.mdif present, or contact maintainers privately