SAService Architect Open designer
SAService ArchitectDocumentation
Code generation workspace -> Cargo packages

Generate Rust Microservices: Cargo Workspace Structure

Rust generation creates a Cargo workspace whose services and contracts also build independently.

When to use

Use this reference when generating, reviewing or operating a Service Architect project.

Behavior

  • Each service and referenced Module has its own Cargo.toml.
  • src/main.rs starts the service and src/lib.rs exposes package code.
  • src/internal/app contains generated ServiceLib graph wiring.
  • src/internal/functions contains business implementations and tests.
  • Public types are emitted below <Module.name>/src/types when Type.module selects that Module.
  • Modules selected by HTTP connectors include generate-openapi.generated.sh and generated transport modules.

Run a complete Rust microservice example

Cargo workspaces, Axum HTTP endpoints, Tonic RPC contracts and Tokio tasks.

The runnable Rust example contains business implementations as well as generated infrastructure. A new Designer archive provides extension points for your own business code.

Install Git, GNU Make, Docker with Compose v2, and the host toolchain required by the repository README. Run these commands from the example workspace root; make help lists the targets available in that version.

git clone https://github.com/gorundebug/rustexample.git
cd rustexample
make help
make init
make docker-up
  • Use the service README and generated configuration for endpoint addresses and example requests.
  • When finished, make docker-down stops the stack while preserving its volumes.
  • Continue with the visual design guide or safe regeneration.

Rust service directories

Important paths in each generated Rust service.

PathOwnershipDescription
Cargo.tomlManaged

Standalone crate metadata and locked dependencies.

src/main.rsPreserved entrypoint

Starts the service executable.

src/lib.rsManaged

Exports the service crate.

src/internal/app/Generated

Runtime graph and transport assembly.

src/internal/functions/Preserved

Business stream functions and endpoint handlers.

src/internal/config/Mixed

Generated configuration model and extensions.

src/internal/types/Mixed

Service-local Rust contracts.

generate-openapi.generated.shGenerated when needed

Pinned OpenAPI transport binding generation.

Rust service tree

<service-name>/
  Cargo.toml
  src/main.rs + src/lib.rs
  src/internal/app/
  src/internal/functions/
  src/internal/config/ + types/
  config/ + graph/ + docs/
  grafana/ + helm/