In my projects, I typically make a data module, for my Entities or end points. These are the ones that follow the type t convention along with utils for fetching data.
Using a blog just as an example, I’d probably have a Comment.res module:
type t = {
author: string,
content: string
}
let fetchById = (commentId) => // ...
let fetchForPost = (postId) => // ...
The conflict comes when getting to the UI, naturally I’d also want to create a Comment.res file for the react component. But the name clashes.
Does anybody else struggle with this? Do you have a convention you like to avoid it?
Then you can do stuff like Models.Comment.fetchById() or <Components.Comment/>
You can utilize rewatch and monorepo.
Rewatch let’s you split your code into different packages with their own rescript.json file, while still running a single compile step.