The useful question is not where the code fits in the file. It is what kind of complexity the code carries. Rules belong in the core, the world belongs at the boundary, and the API keeps the two talking.
grox.io/blog/29-building-in-layers
#ElixirLang