Can you use Multiple Platforms in One Project? For Example, when all Platforms are written in Rust.
Depends on what you mean by a project, can you clarify?
If you mean a project is an application (a built binary), then you can only have one platform in a single application because the platform is in charge of the entrypoint to your application, so having two platforms would mean having two entrypoints which doesn't make sense.
If you meant a wider meaning of project, then if you have two similar platforms that have the same API then you could write some shared Roc code and import it in two different applications which each use a different platform. The other way to use two platforms would be writing two applications and then having one application start the other, e.g. by running the built binary.
Another example: I’m working on a web app where the backend uses one platform, the front-end another, and a third one for my background jobs. I share Roc code between them, but each part outputs a single binary.
:point_up: Thanks Niclas, that's a perfect example of what I was trying to explain :)
I've been thinking of a hosted platform that runs roc code, the best I've come up with is having a metadata file that lists capabilities (built as libraries the service has a registry of) and then it will autogenerate the roc 'platform' out of the capability set. (Caching the platform dlib so it can be reused for future requests with the same requirements set.)
I don't just want one 'service' platform because some users may not be trusted to run http, or have authorization to use computationally expensive capabilities, or perhaps free users don't get blob store access but paid users or users connecting to a paid user's endpoint do.
With the new zig compiler, that should be a lot easier to manage. When calling into roc, you explicitly pass in a struct with all effects. You have two options for less trusted users:
Last updated: Nov 28 2025 at 12:16 UTC