Organizing custom bindings in a project

For those with medium to large projects + a good number of npm dependencies, how do you like to organize external bindings?

I’ve thought of a few different ways, wondering if there’s a community standard or if anyone has any strong opinions on it:

1. A bunch of top level modules in a bindings directory

└── bindings/
    ├── Chalk.res
    ├── Chokidar.res
    └── FastGlob.res

2. Inside a single module, something like Deps.res or Npm.res

This feels similar to how deno wants you to handle dependencies

module Chalk = {

module Chokidar = {

module FastGlob = {
module Chalk = Npm.Chalk
module Chokidar = Npm.Chokidar

// (...)

3. Abstracted inline into more domain specific modules

// Logger.res

@module("chalk") external red: // ...

let error = msg => Console.log(red("ERR"))
// FileSystem.res

@module("chokidar") external watch: (..)
@module("fastglob") external find: (..)

4. Separate into different packages in a monorepo

Pro is that they can be published for the community, but this seems like a lot of work & setup for little payoff

1 Like

We mostly have an external/ dir for core libraries but may do some in line from time to time. I have provided a few as their own repo when I find time.


Mostly 3rd and 1st options.

Same, mostly 1 and 3, but we also have some of 4. Those are local forks of some bigger libraries that we want to be able to edit quickly (only in bigger projects, encapsuled in a yarn workspace).