Stream: beginners

Topic: Can u use Multiple Platforms in One Project?


view this post on Zulip Jonas (Nov 12 2025 at 22:53):

Can you use Multiple Platforms in One Project? For Example, when all Platforms are written in Rust.

view this post on Zulip Hannes (Nov 13 2025 at 00:12):

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.

view this post on Zulip Niclas Ahden (Nov 13 2025 at 07:48):

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.

view this post on Zulip Hannes (Nov 14 2025 at 01:29):

:point_up: Thanks Niclas, that's a perfect example of what I was trying to explain :)

view this post on Zulip Drewry Pope (Nov 16 2025 at 05:56):

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.

view this post on Zulip Brendan Hansknecht (Nov 16 2025 at 06:11):

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:

  1. given them all functions but make some of the functions error if called
  2. use a totally separate platform api to not even give them the functions

Last updated: Nov 28 2025 at 12:16 UTC