Sharing JS code between apps and workflows through a private github repository

Hello, I've got a number of workflows and an app that all use similar piece of javascript code to convert some input data to a desired format. Currently each workflow has a copy of that code placed in a workflow function, while the app has the code defined in 'App settings > Preloaded JS'.

Ideally, I'd like to keep the code in one place and just reference it in each workflow and the app. I know the app can take the code from a cdn and workflow can include a npm library, but I'd rather keep the code not publicly available.

Is there a way to include the code from a private github repository so it's available for workflows and the app at the same time? Alternatively, what would be the retool way of reducing code duplication in this case? Could I perhaps add a javascript function to Query Library?

Thank you!

Welcome to the community, @2tom! Thanks for reaching out. :slightly_smiling_face:

I can definitely appreciate the desire to establish a single source of truth for the use case that you've described. Unfortunately, the ability to import private packages is only available on self-hosted instances and, even then, is solely scoped to workflows. I don't think there's an equivalent for apps.

I'd point you towards the Query Library, but there's currently no support for JS code blocks. This is definitely on the roadmap, though, and will be a good option in the future! In the meantime, have you considered configuring an AWS Lambda function? Or, now that I think about it, a dedicated ETL workflow?

Let me know if you have any additional questions, @2tom! Hopefully the above was a little helpful.

Thank you for your help, Darren! Delegating some of the processing tasks to AWS Lambda seems to be the best solution for our case.

1 Like