Skip to content
wireframe home
Menu

The stack, layer by layer

Four nouns, two directions, one fixed order. Knowing which layer owns what is most of knowing wireframe.

wireframe 0.4.0-alpha1 · samples verified 2026-12-02

Plate 03 · Civic setting System architecture. An elevated crossing reveals the street plan beneath the city. Civic setting for the Common Signal series. The title is the artwork’s.

Four nouns

wireframe keeps each layer’s vocabulary separate, so transport concerns do not leak into routing and routing does not leak into the domain.

Frame
The transport unit a FrameCodec cuts from the byte stream and writes back to it. It knows its own length and, perhaps, a correlation ID; it does not know what its payload means.
Fragment
A bounded slice of an oversized payload, with a header saying which message it belongs to and where it falls. Optional, and invisible above the transport.
Envelope
The routable wrapper decoded from a frame’s payload: a message ID, an optional correlation ID, and the payload bytes. Packet is the trait; Envelope is the bundled type.
Message
The typed value inside an envelope’s payload, encoded by the serializer. Bincode by default.

Inbound

  1. Accept. A worker accepts a TCP connection. The application was prepared once, before the server reported readiness, and every connection shares it.
  2. Preamble. If one is configured, the server reads it first, up to 1 KiB under a 10-second deadline by default. Bytes read past it are replayed. Without one, nothing is read, and the connection goes straight to the application, which may speak first.
  3. Decode frames. The codec cuts frames from the stream.
  4. Deserialize. The serializer decodes an envelope, which must fill the frame exactly. A metadata-aware serializer can read routing fields first, but the framework still deserializes fully unless should_deserialize_after_parse returns false.
  5. Reassemble. With fragmentation on, fragments carried in envelopes are rejoined into whole messages.
  6. Assemble. With a message assembler installed, protocol-level multi-frame messages are joined for ordinary routes. A streaming route can start receiving chunks before assembly is complete.
  7. Route. The message ID selects one route. No route: the message is logged and dropped.
  8. Middleware and handler. The buffered route’s middleware stack runs, outermost first, around the handler. Streaming routes call their handlers directly.

Outbound

A route reply goes back out through the middleware and is rebuilt as an envelope with the request’s message ID and correlation ID. A route_response handler returns a Response, which may be one frame, several, a stream, or nothing; each frame takes the request’s correlation ID. A streaming_route can return a payload to send under the request’s IDs. The connection’s actor writes each frame: fragmented if it is too large and fragmentation is on, then serialized, wrapped by the codec, passed to before_send, and encoded. The order is fixed, so each fragment is its own frame. A stream’s terminator skips fragmentation and serialization but still meets before_send, and so do pushes, which are written between replies and between the frames of a streamed one.

Where state lives

ScopeMechanism
Application-wideValues captured by handler and middleware closures, typically an Arc
Per connectionThe value returned by on_connection_setup, handed to on_connection_teardown
Per middleware layerFields of the Transform, such as the counter in the middleware guide
Across connectionsSessionRegistry, holding weak push handles by connection ID. Server connections add themselves before on_connection_setup runs and leave when their task ends; share one with with_session_registry

What this release does not do

A frank list, because every one of these appears somewhere in the upstream design documents. The README lists what to know before building on this release:

  • A route handler observes and does not reply; middleware answers for it. A route_response handler returns its reply.
  • middleware::from_fn cannot be passed to WireframeApp::wrap.
  • A connection serves one request at a time. A live request body or a long streamed reply delays the next dispatch. Pushes can slip between reply frames.
  • ConnectionContext cannot hold your own data.
  • Idle connections stay open while the server runs. Shutdown closes them. Running tasks can still delay the drain.
  • There is no built-in TLS.

The roadmap says what is in progress.