Shared functions for monorepo project

Hi.
I have monorepo project with four projects.
Each project has a separate netlify configuration with deploy.

I have common netlify function for each project.
Can i put this function into some common place outside these four projects and use within project?

Also I need to this function been available on http://aaapropject/.netlify/functions/common, http://bbbpropject/.netlify/functions/common.

Or should I create common place with logic and create separate function for each project and just call this logic within function?

Thanks for answers!

I use a monorepo and I’m building functions from a separate package, I’m pretty sure just how you describe. Took me a little fiddling to figure out, but it works well now.

The functions live in their own package, and the netlify sites that use them just pass the full path to the built functions package directory (in my case: packages/functions/dist). I just have to make sure that from the site that is consuming the functions I first build the functions, then netlify seems to be OK with it, as long as they know where to look for the built functions.

The repo is open source:

The functions package is packages/functions and the main netlify site that consumes the functions is in packages/evans if you want to poke around, the package.json might be helpful.

1 Like