Has the Roc community settled on conventions on how an idiomatic Roc project is organized? For example source code in src or lib, tests in tests, CLI programs in bin etc?
I dont think there is an accepted convention... I have ben trying to document everything I have learnt into a book (so I'm not repeating myself a thousand times working with Agents) here
https://lukewilliamboswell.github.io/roc-automation/
You're welcome to use this, or provide feedback. :smile:
It's been written by Agents ... and re-written probably 100 times over the past 3 months. Some people wont like my approach... but as I think of something I fork off an agent to go and capture that thought somewhere. I try to read through it and clean it up semi-regularly.
"it depends", imho.
I've found there isn't a single valid answer.
Different projects have different requirements, some implement their own host & platform, some will include apps, others won't. Some will have packages, some won't... some will generate hosts and platforms from specifications...
This is a general guideline for I've been organising mine:
.cache/vendor/
.cache/vendor/roc-glue/commitid/ZigGlue.roc
.cache/some_temp_workspace/
.bundle_out/bundle_a/hash.tar.gz
.bundle_out/bundle_b/hash.tar.gz
.roc_out/app_a/main
host/
hosts/host_a_zig/
hosts/host_b_rust/
.host_out/host_a/main.zig
platform/
platforms/platform_a/
platforms/platform_b/
platforms/platform_b/modules/
platforms/platform_b/.targets_out/x64musl/
.platform_out/platform_a/main.roc
packages/package_a/
.package_out/
glue/LangGlue.roc
app/
apps/app_a.roc
apps/app_b.roc
apps/app_a/
apps/app_b/
scripts/ci.roc
vendor/provider_a/commitid/some_committed_thing.ext
I've found that naming things to be semantically correct, according to their (pluralised) category, as appropriate is a good way to go. And perhaps a distinction between kind of apps... if they're intended to be used by the end user, or as code examples/samples, or for development workflow & CI scripts etc.
If it's generated/downloaded or derived, put it in a sub directory and add it to .gitignore and name it like .roc_out or put it in a .cache folder to try hide it from code editors etc. And as a reminder to not edit directly, and to just delete & rebuild. And to not pollute the directory.
Sometimes you'll want immutable hashed/timestamped output sibling sub directories, or just delete and replace.
Luke Boswell said:
I dont think there is an accepted convention... I have ben trying to document everything I have learnt into a book (so I'm not repeating myself a thousand times working with Agents) here
https://lukewilliamboswell.github.io/roc-automation/
You're welcome to use this, or provide feedback. :smile:
Will check that out thanks.
Scott Campbell said:
...
.cache/vendor/
.cache/vendor/roc-glue/commitid/ZigGlue.roc
.cache/some_temp_workspace/.bundle_out/bundle_a/hash.tar.gz
.bundle_out/bundle_b/hash.tar.gz.roc_out/app_a/main
host/
hosts/host_a_zig/
hosts/host_b_rust/.host_out/host_a/main.zig
platform/
platforms/platform_a/
platforms/platform_b/
platforms/platform_b/modules/
platforms/platform_b/.targets_out/x64musl/
That's a useful approach that works with Roc's platform support.
Last updated: Nov 26 2026 at 20:35 UTC