Use when local RPC-style bridge calls must round-trip custom classes cleanly
Most workers do not need a transport file. Add one when Devflare’s local RPC-style bridge must encode and decode custom values, especially across Durable Object method calls in tests.
is Devflare’s custom serialization hook for local RPC-style bridge calls, especially the Durable Object round-trips Devflare manages in tests. It customizes the serialization layer for that bridge; it is not a replacement for ordinary fetch request or response handling. Its job is to let values that would otherwise collapse into plain JSON be rebuilt as real class instances on the caller side.
- Best for
- Bridge-backed Durable Object results that return custom classes
- Usually unnecessary
- Strings, numbers, arrays, and plain JSON objects
- Disable rule
Reach for it only when local RPC-style bridge calls must preserve real classes
Most workers do not need a transport file because plain data already crosses the bridge naturally.
Add when a local RPC-style bridge call returns a custom class instance and you want the caller to receive that class again instead of a plain object.
Good fit
A Durable Object method or another Devflare-managed RPC boundary returns a small domain value like , , or another class with behavior you want to keep intact.
Usually unnecessary
The handler or RPC call returns plain strings, numbers, arrays, or JSON objects that do not need custom decode logic.
Think “bridge-backed RPC”, not “normal JSON responses”
This file matters when Devflare is proxying values across its local RPC bridge. It is not a replacement for ordinary Worker request or response serialization.
Export one named object with small encode and decode pairs
Keep each entry boring and explicit: detect one value shape, encode it into plain data, and decode that data back into the class on the caller side.
- Return or from when the value is not a match.
- Keep the encoded payload plain and JSON-friendly.
- Use one transport key per value type so decoding stays obvious in code review.
Keep the transport file next to the class it knows how to round-trip
The transport file teaches Devflare how to turn a custom class into plain data for the bridge, then rebuild that class for the caller.
A tiny test is still the easiest proof of the round-trip
Keep the first proof small
If the transport works, you should be able to prove it with one class, one method call, and one assertion before you hide it inside bigger helpers.
Test the round-trip, not just the numeric value
Know the autodiscovery and disable rules
- Use the conventional path when you want the default location.
- Use when the transport file lives somewhere else.
- Set when you want to disable the convention explicitly for a package.
- If the file exists but does not export a named object, Devflare warns and continues without custom transport decoding.
Do not treat the warning as success
If Devflare warns that the file does not export a named object, custom decode is off. The test may still run, but your class round-trip will not.
Point at a custom transport path when the convention is not enough
Disable transport autodiscovery explicitly
Previous
Handler styles
Devflare runtime supports event-first handlers, request-wide middleware, route method handlers, and explicit markers for ambiguous two-argument worker-style or resolve-style functions.
Next
Why tests feel native
Devflare’s standout testing trick is that the same config, bindings, env surface, runtime helpers, and even direct Durable Object method calls can stay available in Bun tests without a hand-built fake layer in the middle.