{"id":23527103,"url":"https://github.com/yaroslav/bundlebun","last_synced_at":"2026-03-08T13:02:19.892Z","repository":{"id":268285861,"uuid":"903862954","full_name":"yaroslav/bundlebun","owner":"yaroslav","description":"bundlebun bundles Bun, a fast JavaScript runtime, package manager, and builder, with your Ruby and Rails applications","archived":false,"fork":false,"pushed_at":"2026-01-15T19:44:56.000Z","size":372,"stargazers_count":59,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2026-01-17T05:57:49.303Z","etag":null,"topics":["build-tool","bun","frontops","javascript","javascript-runtime","monolith","ruby","ruby-on-rails"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/yaroslav.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-12-15T18:43:24.000Z","updated_at":"2026-01-16T10:50:30.000Z","dependencies_parsed_at":"2024-12-15T20:17:43.873Z","dependency_job_id":"71a63a68-632d-48a0-b410-f25ff7c746b9","html_url":"https://github.com/yaroslav/bundlebun","commit_stats":null,"previous_names":["yaroslav/bundlebun"],"tags_count":18,"template":false,"template_full_name":null,"purl":"pkg:github/yaroslav/bundlebun","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yaroslav%2Fbundlebun","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yaroslav%2Fbundlebun/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yaroslav%2Fbundlebun/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yaroslav%2Fbundlebun/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yaroslav","download_url":"https://codeload.github.com/yaroslav/bundlebun/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yaroslav%2Fbundlebun/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28814539,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-27T12:25:15.069Z","status":"ssl_error","status_checked_at":"2026-01-27T12:25:05.297Z","response_time":168,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["build-tool","bun","frontops","javascript","javascript-runtime","monolith","ruby","ruby-on-rails"],"created_at":"2024-12-25T20:11:59.937Z","updated_at":"2026-03-08T13:02:19.881Z","avatar_url":"https://github.com/yaroslav.png","language":"Ruby","readme":"# bundlebun\n\n**bundlebun** bundles [Bun](https://bun.sh)—the all-in-one JavaScript runtime, package manager, and build tool—directly into your Ruby gem bundle. No Docker, no `curl | sh`, no Homebrew required.\n\n\u003cdiv align=\"center\"\u003e\n  \u003cimg src=\"https://raw.githubusercontent.com/yaroslav/bundlebun/refs/heads/main/assets/mr-bundlebun-512.png\" width=\"256\" height=\"256\" alt=\"Mr. Bundlebun\" title=\"Mr. Bundlebun\"\u003e\n\u003c/div\u003e\n\n* **Zero setup.** `bundle add bundlebun \u0026\u0026 rake bun:install` and you're done.\n* **Team-friendly.** Everyone runs the same Bun version, pinned in `Gemfile.lock`.\n* **Auto-updating.** New Bun release? bundlebun ships it automatically. Or freeze your preferred version.\n* **Integrates automatically.** Works out of the box with vite-ruby, cssbundling-rails, jsbundling-rails, and ExecJS.\n\n```sh\nbundle add bundlebun\nrake bun:install\nbin/bun --version\n```\n\n[![GitHub Release](https://img.shields.io/github/v/release/yaroslav/bundlebun)](https://github.com/yaroslav/bundlebun/releases)\n[![Docs](https://img.shields.io/badge/yard-docs-blue.svg)](https://rubydoc.info/gems/bundlebun)\n\n---\n\n## Table of Contents\n\n- [Rationale](#rationale)\n- [Install](#install)\n- [Usage](#usage)\n- [Integrations](#integrations)\n- [Versioning](#versioning)\n- [Uninstall](#uninstall)\n- [Acknowledgements](#acknowledgements)\n- [Contributing](#contributing)\n- [License](#license)\n\n## Rationale\n\n**Modern frontend setup is needlessly complex** and may involve a lot of maintenance. Developers need _at the very least_ a JavaScript runtime (typically, Node.js), a package manager (could be npm, yarn, or pnpm), and a build tool (Vite, Webpack, esbuild, Parcel—dozens of them).\n\n- One way forward is to dockerize development environments, creating unnecessary headaches for the development team—both frontend and backend engineers (especially if the team is not that large and the project is not that complex).\n- Another approach is to declare front-ops bankruptcy and pursue the \"no-build\" route.\n\n**What if we could simplify this?** **Bun** is a **JavaScript runtime**, optimized for speed and developer experience. Bun is _also_ a fast JavaScript **package manager**. Bun is _also_ a **build tool**. Bun is also distributed as a single executable file.\n\nHowever, Bun still requires [some installation](https://bun.sh/docs/installation), and we need to make sure everyone on the team is using the same version.\n\nSo, how about we just pack it into a Ruby gem as a binary and allow developers to stay updated? Then, we'll be ready every time a new Bun version is out—or the user can freeze their desired version within their Ruby project. There are no setups, large READMEs with instructions, and no enforcing the Docker workflow.\n\n**Enter bundlebun**. With a fast JavaScript runtime and a package manager included, you can even skip the build tool and use Bun itself.\n\n## Install\n\nbundlebun gem releases include a binary distribution of Bun for each supported Bun platform (macOS, Linux, Windows) and architecture. bundlebun is tested for Unix-like environments and Windows.\n\nAdd bundlebun to your `Gemfile`, placing it _after_ your existing frontend-related gems:\n\n```ruby\n# Frontend-related gems go here\n# gem \"vite_rails\"\n\ngem \"bundlebun\"\n```\n\nThen run:\n\n```sh\nbundle add bundlebun\nrake bun:install\n```\n\n`rake bun:install` creates a `bin/bun` binstub and auto-detects which integrations to enable. It will also offer to migrate `package.json` scripts and `Procfile` entries to use `bin/bun`.\n\n_If you're seeing a message like `Could not find gems matching 'bundlebun' valid for all resolution platforms (aarch64-linux, aarch64-linux-gnu \u003c...\u003e )`, [check this article](https://github.com/yaroslav/bundlebun/wiki/Could-not-find-gems-matching-'bundlebun'-valid-for-all-resolution-platforms)._\n\n_Windows:_ `bin\\bun.cmd` is created instead. If you joined a project with only the Unix binstub, run `rake bun:install` again.\n\n## Usage\n\n### Binstub\n\nThe easiest way to run Bun is via the `bin/bun` binstub:\n\n```sh\nbin/bun install\nbin/bun add postcss\nbin/bun run build\n```\n\n### PATH\n\nbundlebun prepends the bundled Bun directory to your application's `PATH`. Tools that detect a `bun` executable (like vite-ruby) find it automatically—no extra configuration needed.\n\n### Rake\n\nAlternatively, you can use a Rake task. The syntax is far from perfect—that's a limitation of Rake—but it's an option if you cannot install the binstub. Note the quotes around the parameters:\n\n```sh\nrake bun[command]  # Run bundled Bun with parameters\n```\n\n```sh\n\u003e rake \"bun[outdated]\"\nbun outdated v1.1.38 (bf2f153f)\n...\n```\n\n### Ruby API\n\n```ruby\nBundlebun.('install')               # exec: replaces the current Ruby process with Bun\nBundlebun.call(['add', 'postcss'])  # same thing, array form\n```\n\n**Note:** `Bundlebun.call` (and the `()` shortcut) replaces the current process—it never returns. Use `Bundlebun.system` to run Bun and continue executing Ruby:\n\n```ruby\nif Bundlebun.system('install')\n  puts 'Dependencies installed!'\nend\n\nsuccess = Bundlebun.system('test')\n# =\u003e true if Bun exited successfully, false or nil otherwise\n```\n\nSee the [API documentation](https://rubydoc.info/gems/bundlebun) for full details on `Bundlebun::Runner`.\n\n### Instrumentation\n\nWhen ActiveSupport is available, bundlebun emits events you can subscribe to:\n\n```ruby\nActiveSupport::Notifications.subscribe('system.bundlebun') do |event|\n  Rails.logger.info \"Bun: #{event.payload[:command]} (#{event.duration.round(1)}ms)\"\nend\n```\n\nEvents: `system.bundlebun` (for `Bundlebun.system`) and `exec.bundlebun` (for `Bundlebun.call`). Payload: `{ command: args }`.\n\n## Integrations\n\nbundlebun auto-detects and loads integrations when you run `rake bun:install`—as long as `gem \"bundlebun\"` is placed _after_ the relevant gems in your `Gemfile`.\n\n### vite-ruby / vite-rails\n\n[vite-ruby](https://github.com/ElMassimo/vite_ruby) and [vite-rails](https://vite-ruby.netlify.app/) are gems that make Ruby and Rails integration with [Vite](https://vite.dev/), a great JavaScript build tool and platform, seamless and easy.\n\nThe bundlebun integration is installed automatically with `rake bun:install`, or you can run it explicitly:\n\n```sh\nrake bun:install:vite\n```\n\nThat will make sure you have a `bin/bun` binstub. Next, it installs a custom `bin/bun-vite` binstub to use in build scripts, and creates or updates `vite.json` to use that binstub for building. See the [Vite Ruby configuration manual](https://vite-ruby.netlify.app/config/index.html) for details on `vite.json`.\n\nTo enable the integration manually:\n\n```ruby\nBundlebun::Integrations::ViteRuby.bun!\n```\n\n### cssbundling-rails / jsbundling-rails\n\n[cssbundling-rails](https://github.com/rails/cssbundling-rails) and [jsbundling-rails](https://github.com/rails/jsbundling-rails) are Rails gems that support the traditional CSS and JS building pipeline for Ruby on Rails.\n\nBe sure to check both gems for documentation on bootstrapping your frontend build pipeline instead of duplicating approaches here. cssbundling-rails, for instance, includes an excellent sample build configuration for Bun.\n\n```sh\n# Bootstrap cssbundling-rails\nbundle add cssbundling-rails\nbin/rails css:install:[tailwind|bootstrap|bulma|postcss|sass]\n\n# Bootstrap jsbundling-rails\nbundle add jsbundling-rails\nbin/rails javascript:install:bun\n\n# Ensure bundlebun integration\nrake bun:install:bundling-rails\n```\n\n### ExecJS\n\n[ExecJS](https://github.com/rails/execjs) runs JavaScript code straight from Ruby. It supports a number of runtimes it can launch—and get a result from. Bun runtime support already exists in ExecJS; bundlebun just ensures it uses the bundled version.\n\nWorks automatically when bundlebun loads after ExecJS in your `Gemfile`. To enable manually:\n\n```ruby\nBundlebun::Integrations::ExecJS.bun!\n```\n\n## Versioning\n\nbundlebun versions follow the `#{gem.version}.#{bun.version}` scheme. For example, `0.1.0.1.1.38` = gem version `0.1.0` + Bun `1.1.38`.\n\nNew gem versions are published automatically on each Bun release. Lock to a specific Bun version in your `Gemfile`, or leave it unspecified to always get the latest.\n\n## Uninstall\n\n```sh\nbundle remove bundlebun\n```\n\nThen clean up:\n\n- `bin/bun` (and `bin\\bun.cmd` on Windows)\n- `bin/bun-vite` if present\n- `tasks/bundlebun.rake` if present\n- Any `bin/bun` references in scripts and configs\n- Any `Bundlebun` references in your code\n\n## Acknowledgements\n\nBun binaries are sourced directly from [oven-sh/bun releases](https://github.com/oven-sh/bun/releases). [Bun](https://bun.sh) was created by Jarred Sumner ([@jarred-sumner](https://github.com/jarred-sumner)) and distributed under MIT.\n\nBig thanks to Jason Meller ([@terracatta](https://github.com/terracatta)) for his work on Bun's Ruby on Rails ecosystem integration—jsbundling-rails, cssbundling-rails, turbo-rails, stimulus-rails, and ExecJS support—in [this Pull Request](https://github.com/rails/rails/pull/49241).\n\n## Contributing\n\nMake sure you have up-to-date Ruby. Run `bin/setup` to install gems, install [lefthook](https://github.com/evilmartians/lefthook), and run `rake bundlebun:download` to fetch a local Bun build for tests.\n\nRun `rake rspec` to check tests. Open an issue or a PR.\n\n## License\n\nThe gem is available as open source under the terms of the MIT License. See [LICENSE.txt](LICENSE.txt).\n","funding_links":[],"categories":["Ruby"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyaroslav%2Fbundlebun","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyaroslav%2Fbundlebun","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyaroslav%2Fbundlebun/lists"}