Has anyone explored the idea of making universal apps in Roc. These are single programs which execute in more than one place. I.e. a single program describing a server and client. The first place I saw this was https://github.com/blitz-js/blitz
I've had a go implementing this in my language and it didn't take too much effort. However my language is very feature limited and makes it pretty safe to pass code around by being pure by construction.
I don't quite know what a Roc solution would look like, but I think we roc making the platform layer explicit it could be interesting. Is there a way for a Roc platform to check that it is compatible with another platform
The first thing that comes to mind is https://www.lamdera.com/. It's written in Elm instead of Roc but given that languages are quite similar I think it could be a good reference when considering something like this for Roc.
It's a shame that lamdera is a service. I'd like to just have a built program I could deploy myself. I don't know if the lambdera model requires it too be a service
I believe the reason for it being a service is that it lets Lamdera manage the hosting which in turn means deploying to production requires almost no configuration (just an app name and SSH public key). If Lamdera wasn't a service and you could deploy wherever, that would probably bring in a lot more complexity.
Declarative programming lends itself very well for this, in that you only program your declarative structure once, and then can re-use it in multiple contexts for multiple purposes.
The first thing that comes to mind is of course logic programming languages like Prolog. It excels in these kinds of things, although the tooling and guidance around Prolog are a rather lackluster
That said, we should implement a (mini)Kanren for Roc at some point! (It is 'logic programming as a library')
The HTTP tooling in Roc is still in active development and heavily in flux, but it definitely will be possible to create a higher level abstraction on top so you could have a generalized "API builder" DSL. The built datastructure you could then re-use for both your client and server.
Ok so I had a crack at implementing something myself. https://vimeo.com/733332434
I like the interface but I've no idea how one would make it fast
Last updated: Jun 16 2026 at 16:19 UTC