Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Rust Multi-Surface App Architecture Blueprint (v2)

1. Context

This revision introduces a first-class Interface & Communication Layer that sits above the typed core and enables:

The goal is to preserve strong typing internally while allowing flexible external interfaces.


2. Updated High-Level Architecture

Key insight

Core does not depend on transport or serialization.
Interfaces mediate between typed domain and external world.


3. Interface Layer Responsibilities

Responsibilities


Interface layer decomposition


4. Transport Layer

Transport becomes a thin envelope around payload.

This separation enables:


5. Payload Strategy

DTO layer (external representation)

Mapping layer


6. Serialization Strategy

Requirements


Multi-format SerDe model


ContextFormat
Public APIJSON
Internal RPCMessagePack
EventsJSON / CloudEvents
WASMWIT
High throughputCBOR

7. Zero-Config Strategy

Default path

No configuration required for most users.

Advanced users can override:


8. Multi-Surface Interaction Flow


9. Risk Mitigation Strategies

Risk 1 — Version drift across repos

Mitigation


Risk 2 — Serialization overhead

Mitigation


Risk 3 — Plugin ABI instability

Mitigation


Risk 4 — Integration complexity

Mitigation


Risk 5 — Debuggability loss with binary formats

Mitigation


10. Evolution Strategy

Layered evolution model

Principle

Each layer evolves independently with compatibility guarantees.


11. Contract Strategy

Contract sources


Contract sharing


12. Error Handling Model

Unified error envelope

{
  "type": "https://example/errors/invalid-input",
  "title": "Invalid input",
  "detail": "...",
  "trace_id": "...",
  "instance": "...",
  "metadata": {}
}

Based on RFC7807.


13. Security Strategy


14. Trade-off Summary

DecisionBenefitCost
Separate transport & payloadFlexibilityComplexity
Interface layerEvolution safetyExtra mapping
Multi-format SerDePerformanceTooling overhead
Contract-first designStabilitySlower iteration
WASM pluginsSafetyRuntime overhead

15. Final Opinionated Model

LayerResponsibility
CoreDomain + workflows
PluginsCapability extension
InterfaceContracts + mapping
PayloadDTO
SerDeEncoding
TransportDelivery
AdaptersSurface integration

16. Future Evolution Opportunities


17. Next Possible Deep Dives