Skip to content

Feature Request: Embedding Bun within other native applications (like a Rust program) #12017

@alshdavid

Description

@alshdavid

What is the problem this feature would solve?

Many native projects would like to be able to embed a JavaScript runtime that can leverage the Nodejs ecosystem and Nodejs standard library.

  • AWS Lambda
  • Supabase
  • Bundlers (Parcel, Rspack, etc)
  • Mongo
  • Applications that want to use JavaScript for plugins (like Lapce)
  • etc

What is the feature you are proposing to solve the problem?

Offer a dynamic C library (or a Rust crate) that allows Bun to be embedded within another native application

What alternatives have you considered?

  • Nodejs Embedding API
    • Very difficult to use, many projects try to use this and drop it
  • Deno
    • Embedding Deno is reasonably easy to get started with however using the Nodejs standard library is not easy.
    • Deno requires you to fork the Deno CLI to extract support for the Nodejs API.
      • UPDATE: Deno has release deno_lib which is a crate that exposes the deno cli as a library
    • due to differences between Deno and Nodejs, certain features (like workspaces support) do not work as expected.
    • Deno does not support workers with injected snapshot libs

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions