Hello Rust¶
A minimal Actix-web application in Rust. Multi-stage Docker build compiling to a static binary. One container, one service, no database, no cache.
Overview¶
| Repository | git@gitlab.com:appmecca-sample-apps/hello-rust.git |
| Tech Stack | Rust 1.84 / Actix-web |
| Services | web (port 8080) |
| Database | None |
| Cache | None |
| URL Pattern | https://hello-rust-web.{env}.appmecca.net |
What This App Demonstrates¶
- Deploying a Rust application on AppMecca
- Multi-stage Docker build (Rust compiler + Debian runtime)
- Compiled binary with minimal runtime overhead
- Health check endpoint pattern
appmecca.yaml¶
containers:
- name: hello-rust
dockerfile: Dockerfile
context: .
deploy:
- name: web
container: hello-rust
port: 8080
health_check:
path: /health
The configuration is identical in structure to any other single-container app. Actix-web is configured to listen on port 8080.
Step-by-Step Deployment¶
1. Register the app¶
2. Build the container¶
Expected output
Rust builds are slow the first time because the compiler downloads and compiles all dependencies from source. Subsequent builds with cached Docker layers are faster.
3. Deploy¶
Expected output
4. Verify¶
Test the endpoint:
Key Concepts¶
Multi-stage Docker builds for Rust¶
Rust compiles to a native binary, making multi-stage builds particularly effective. The build stage uses the full Rust toolchain (~1.5 GB). The runtime stage needs only a minimal Debian image plus your compiled binary (~30 MB final image). No runtime interpreter, no garbage collector, no virtual machine.
Image size comparison
| Stage | Image size |
|---|---|
rust:1.84-slim (build stage) |
~1.5 GB |
| Final image (Debian slim + binary) | ~30 MB |
Actix-web¶
Actix-web is one of the fastest web frameworks available in any language. It uses Rust's async runtime (Tokio) for non-blocking I/O and achieves exceptional throughput. Despite the performance, the API is straightforward for simple services.
Any language, same workflow
AppMecca does not care what language your application is written in. As long as your container listens on the declared port and responds to health checks, the deployment workflow is identical.
What's Next?¶
- Go Web Server -- another compiled language deployment
- Hello Java -- see the same pattern in Java
- Hello Bun -- see the same pattern with Bun/TypeScript
- App with Database -- add PostgreSQL to your application