Expand description
§📦 Rust Microservice
Rust Microservice Framework is a high-performance Rust crate designed to simplify
the creation, configuration, and initialization of microservice-oriented web servers.
It provides a unified system for handling configuration from multiple sources
and a web server bootstrap layer powered by actix-web and tokio.
§✨ Features
-
Multi-source configuration management
- YAML configuration file loading using
serde_yamlandconfig - Environment variable overrides
- Command-line parameter parsing using
clap - Automatic deserialization into strongly typed structures using
serde
- YAML configuration file loading using
-
Web server initialization
- HTTP server powered by
actix-web - Asynchronous runtime handled by
tokio - Built-in routing integration for exposing microservice endpoints
- Input/output serialization using
serde_jsonandserde-xml-rs
- HTTP server powered by
-
Extensible architecture
- Supports custom modules for controllers, services, repositories, and middleware
- Easy integration with external crates and microservice ecosystems
§🛠️ Configuration System
The framework provides a configuration loader that merges settings from:
- YAML files – typically
config.yamlor environment-specific variations - Environment variables – allowing container-friendly overrides
- Command-line parameters – using
clapfor high-level CLI ergonomics
Configuration sources follow a layered precedence model:
Environment variables > CLI parameters > YAML configuration fileAfter loading the configuration, the framework exposes a typed Settings
instance for application modules and endpoint handlers.
§🌐 Web SERVER Module
The server module is responsible for:
- Initializing the
actix-webHTTP server - Registering routers and microservice endpoints
- Managing middlewares and shared application state
- Running the asynchronous runtime using
tokio::mainor a custom runtime
This framework encourages a modular architecture where each microservice registers its own route handlers, serializers, and business logic.
§⚙️ Serialization Support
The crate includes seamless integration with:
- JSON serialization/deserialization via
serde_json - XML handling via
serde-xml-rs
These serializers allow exposing multiple content-types or supporting legacy systems.
§⚡ Usage
Add the crate dependency in your project’s Cargo.toml:
rust-microservice = "0.1.3"Modules§
- settings
- The server behavior is fully driven by a YAML configuration file. This file defines network settings, security providers, data sources, and observability integrations used at runtime.
- test
- 🔬 Test Environment Infrastructure
Structs§
- Login
Form - Represents the payload used for authentication requests following the OAuth2-style “password” or “client credentials” grant patterns.
- Server
- Represents the high-level server controller responsible for loading configuration, applying custom setup, and running the application.
- Server
Wrappers - Represents the middleware wrappers applied to the HTTP server.
- Token
- Represents an authentication token response typically returned by an OAuth2 / OpenID Connect authorization server.
Enums§
- Server
Error - Represents all possible errors that can occur within the server lifecycle.
Functions§
- server_
wrappers - Creates a
ServerWrappersinstance from the givenSettings.
Type Aliases§
- Result
- A type alias for a
Resultwith theServerErrorerror type.