Hacker News new | ask | show | jobs
Show HN: StateSurface – server-owned state and NDJSON streaming for MPA pages (github.com)
1 points by superlucky84 106 days ago
Hi HN,

I built an experimental web runtime called StateSurface:

https://github.com/superlucky84/state-surface https://state-surface.subtleflo.com/

It explores a simple idea:

Server owns state. Client owns DOM projection. Pages are real MPA HTML, and in-page updates stream over NDJSON.

The model has four pieces: - Surface: HTML page shell with <h-state> anchors - Template: stateless TSX projection - Transition: server-side async generator yielding state frames - Action: declarative HTML trigger

This is not production-ready — it’s a prototype to explore whether server-owned state + streaming UI can be a useful alternative to SPA-heavy architectures.

Would love feedback, especially from people familiar with htmx, LiveView, Hotwire, or server-driven UI in general.

1 comments

A bit more context on why I built this:

I like MPA simplicity, but I also wanted progressive in-page updates without turning everything into a SPA with client state, router logic, and hydration complexity.

So this project is basically me asking:

Can the server remain the source of truth for UI state, while the client only handles DOM projection for named slots?

I’m not claiming this replaces React/Next/etc. I’m trying to see whether this model is useful for a narrower class of apps: - streaming interfaces - server-driven workflows - multi-step forms - dashboards - agent / assistant-style UIs

Very interested in where people think this idea is promising vs fundamentally awkward.