Skip to content

Start documentation section for Butterfly#460

Open
SoryRawyer wants to merge 2 commits intomasterfrom
initial-butterfly-documentation
Open

Start documentation section for Butterfly#460
SoryRawyer wants to merge 2 commits intomasterfrom
initial-butterfly-documentation

Conversation

@SoryRawyer
Copy link
Member

@SoryRawyer SoryRawyer commented Jun 2, 2025

As I learn more about OpenRefine's codebase, I figured I could contribute a little bit of what I've learned about Butterfly to the documentation. I've been trying to figure out an appropriate scope for an initial section on Butterfly (e.g. is it worthwhile to go into how request routing works?) but in the end decided to provide a small starting point and get feedback from others on where additional documentation might be helpful.

@netlify
Copy link

netlify bot commented Jun 2, 2025

Deploy Preview for openrefine-website ready!

Name Link
🔨 Latest commit 4b152ce
🔍 Latest deploy log https://app.netlify.com/projects/openrefine-website/deploys/683e0d152b60a6000838450c
😎 Deploy Preview https://deploy-preview-460--openrefine-website.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@SoryRawyer
Copy link
Member Author

@Abbe98, @sunilnatraj, since both of you have worked on extensions, would you mind reading over this new bit of Butterfly documentation? I'd be interested in hearing if you find it useful, and/or if anything else would be useful to include here.

@SoryRawyer SoryRawyer marked this pull request as ready for review August 27, 2025 20:43
Copy link
Member

@tfmorris tfmorris left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just discovered these six month old comments from a review that I never submitted. Sorry!

The comment about "non-obvious conceptual stuff" probably needs expansion/explanation, but I'm going to submit this without further edits so it doesn't get pushed down on the stack again.


Butterfly organizes back-end functionality using a collection of modules. The only module exposed by OpenRefine is the `core` module, which provides extension points for other modules to hook into.

Each module uses a JavaScript file named `controller.js` to connect different parts of the backend. Butterfly uses a JavaScript interpreter to run this and other provided JavaScript files to configure the back-end. Extensions rely on `controller.js`, and specifically an `init` method within that file, to leverage the aforementioned extension points.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably worth explaining how the Javascript/Java "glue" works here (or at least point to the extension docs).

More generally some of the non-obvious conceptual stuff should receive a significant portion of the attention.


Each module uses a JavaScript file named `controller.js` to connect different parts of the backend. Butterfly uses a JavaScript interpreter to run this and other provided JavaScript files to configure the back-end. Extensions rely on `controller.js`, and specifically an `init` method within that file, to leverage the aforementioned extension points.

While Butterfly does allow for modules to manage their own API endpoints, extension modules typically register their endpoints through the form of commands. HTTP requests for those commands are then dispatched by the `core` module.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True for HTTP commands, but there are many other extension registries for importers, exporters, GREL functions, etc.

Co-authored-by: Tom Morris <tfmorris@gmail.com>
@netlify
Copy link

netlify bot commented Jan 22, 2026

Deploy Preview for openrefine-website ready!

Name Link
🔨 Latest commit ff2fd38
🔍 Latest deploy log https://app.netlify.com/projects/openrefine-website/deploys/6972abf5867a2d000892c11b
😎 Deploy Preview https://deploy-preview-460--openrefine-website.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants