# Rust as a Service

- URL: https://www.ardanlabs.com/team-live-training-courses/rust_as_a_service/

### Course Description

---

This course teaches integrating Rust into service-oriented architectures, covering REST server development, data handling, error management, and modularization. You'll learn tracing, automated OpenAPI documentation, configuration for different environments, and alternative connectivity mechanisms like gRPC and WebSockets. Explore deploying a test service in a containerized environment, along with insights into service design, deployment strategies, and scaling. This prepares you for deploying high-performance Rust services in enterprise environments.

### Course Outline

---

<details>
    <summary>Introduction:</summary>

- 1.0 - Introduction
</details>


<details>
    <summary>REST Service:</summary>

- 2.1 - Minimal HTTP Server
- 2.2 - Service Stack
- 2.3 - Extractors
- 2.4 - Add a Simple Tower Layer (State)
- 2.5 - Add a Simple Tower Layer (Mutable State)
- 2.6 - Multiple States - Extension Layers
- 2.7 - Quick Recap on State and Layers
- 2.8 - Nesting Multiple Routers
- 2.9 - Nested Routers with State
- 2.10 - Calling Other Services
- 2.11 - Returning Status Codes
- 2.12 - Using IntoResponse
- 2.13 - Error Handling with IntoResponse
- 2.14 - Quick Recap on Nesting, Making Calls and Responses
- 2.15 - Serving Static Content with Tower
- 2.16 - Simple Header-Based Authentication
- 2.17 - Simple Header-Based Auth with Middleware
- 2.18 - Middleware Auth with Injection
- 2.19 - Selectively Applying Layers
- 2.20 - Router Layers
- 2.21 - Layer Recap
</details>

<details>
    <summary>Tracing:</summary>

- 3.1 - Minimal Example
- 3.2 - Logging Axum/Tower
- 3.3 - Timing Spans
- 3.4 - Axum Spans
- 3.5 - Logging to a File
- 3.6 - Structured Logging to JSON
- 3.7 - OpenTelemetry
</details>

<details>
    <summary>OpenAPI Documentation:</summary>

- 4.1 - OpenAPI Documentation
</details>

<details>
    <summary>Handling Service Configuration:</summary>

- 5.1 - Environment Variables with .env
- 5.2 - The Config Crate - Basics
- 5.3 - Loading Config via HTTP
- 5.4 - CLI configuration with Clap
- 5.5 - Recap
</details>

<details>
    <summary>Handling Service Configuration:</summary>

- 6.1 - Hello Tonic - Protocol Definition
- 6.2 - Hello Tonic - Project Definition and Build
- 6.3 - Hello Tonic - The Server
- 6.4 - Hello Tonic - The Client
- 6.5 - gRPC Streaming
- 6.6 - gRPC Streaming - Protocol Definition
- 6.7 - gRPC Streaming - The Server
- 6.8 - gRPC Streaming - The Client
- 6.9 - Recap So Far
- 6.10 - Authentication
- 6.11 - Tracing
- 6.12 - When to use gRPC
</details>

<details>
    <summary>Web Sockets:</summary>

- 7.1 - Minimal Echo Server
- 7.2 - A native WS client
- 7.3 - JSON
</details>

<details>
    <summary>Service Deployment:</summary>

- 8.1 - Test Service
- 8.2 - Native Host Deployment
- 8.3 - Docker Deployment
</details>

<details>
    <summary>Service Design:</summary>

- 9.1 - Understanding Your Company Architecture
- 9.2 - Designing Individual Services
- 9.3 - Combining Services into a Modular Monolith
- 9.4 - Service Exposure
- 9.5 - Scaling Out
</details>

<details>
    <summary>Wrap Up:</summary>

- 10.1 - Wrap Up
</details>
