Video: https://youtu.be/vCTUfypEsi8
Live swap demo: https://tgoh.github.io/treflex/swap/
For the past few years I've been developing a framework where application logic runs without a renderer.
The problem
In most front-end code, logic is tied to components. A fetch starts in an effect, a timer lives in a component, a multi-step flow lives in whichever page is open. That's fine until the logic needs to outlive the component: switch tabs mid-search and it's cut off, or it starts twice when the component remounts. The usual fix is to hoist it to a parent or a global store, but a parent is still a component with its own mount lifetime, and a global has no lifetime at all. Neither matches what the logic is actually about.
Logic lives with the state
In Treflex, logic lives with the state it works on. A piece of state (an entity) owns its actions, timers and connections, and they live exactly as long as it does. When the entity is removed, all of its work stops.
This means the renderer is just a view onto the state. In the demo, the buttons at the bottom left (in the menu on mobile) swap between the Solid and React renderers in real time, on the same Treflex state. Even when the entire front end is torn down, timers and in-flight actions keep running, because they belong to entities rather than components. Only view state like scroll position resets.
And because all of it is plain data, the whole app (state, timers and connections) saves to JSON and comes back on reload, and any work the reload cut off is reported so the app can pick up where it left off.
Why another state framework?
AI agents write most of this code now, but async front-end code is where agents slip: races, double-starts, work that dies on unmount. Treflex makes that code checkable. There's no UI in the logic, so everything in your entities can be unit tested without rendering anything. A test decides the order effects answer in, so a race that would be flaky in a browser is a test that does the same thing every run. And the rules are enforced by the runtime and a lint plugin, with error messages that say what to change, so an agent finds out it got it wrong in a test or in lint, not in a bug report.
Try it
It's 0.2 and the API is still moving. I'd love to hear if you have any feedback or questions.