{"id":13567048,"url":"https://github.com/r-wasm/webr","last_synced_at":"2025-10-24T07:05:51.294Z","repository":{"id":37501587,"uuid":"449773639","full_name":"r-wasm/webr","owner":"r-wasm","description":"The statistical language R compiled to WebAssembly via Emscripten, for use in web browsers and Node.","archived":false,"fork":false,"pushed_at":"2025-05-07T12:10:46.000Z","size":56481,"stargazers_count":932,"open_issues_count":79,"forks_count":75,"subscribers_count":25,"default_branch":"main","last_synced_at":"2025-05-07T12:42:54.793Z","etag":null,"topics":["emscripten","r","wasm","webassembly"],"latest_commit_sha":null,"homepage":"https://docs.r-wasm.org/webr/latest/","language":"TypeScript","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/r-wasm.png","metadata":{"files":{"readme":"README.md","changelog":"NEWS.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":"CITATION.cff","codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2022-01-19T16:40:07.000Z","updated_at":"2025-05-07T12:10:50.000Z","dependencies_parsed_at":"2023-12-21T15:40:43.380Z","dependency_job_id":"152f1847-b4b7-431a-9ac8-e7d8bc400c4e","html_url":"https://github.com/r-wasm/webr","commit_stats":null,"previous_names":["georgestagg/webr"],"tags_count":22,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/r-wasm%2Fwebr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/r-wasm%2Fwebr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/r-wasm%2Fwebr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/r-wasm%2Fwebr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/r-wasm","download_url":"https://codeload.github.com/r-wasm/webr/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254076850,"owners_count":22010611,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["emscripten","r","wasm","webassembly"],"created_at":"2024-08-01T13:02:22.417Z","updated_at":"2025-10-24T07:05:51.276Z","avatar_url":"https://github.com/r-wasm.png","language":"TypeScript","readme":"[![Build, test and deploy webR](https://github.com/r-wasm/webr/actions/workflows/deploy.yml/badge.svg)](https://github.com/r-wasm/webr/actions/workflows/deploy.yml) [![codecov](https://codecov.io/gh/r-wasm/webr/branch/main/graph/badge.svg)](https://codecov.io/gh/r-wasm/webr)\n\n# WebR - R in the Browser\nThis project aims to compile the statistical language R (https://www.r-project.org/) into WebAssembly for use with a browser, via Emscripten (https://emscripten.org/). The repo includes patches to R's source code so that it can work in the browser environment provided by Emscripten and also includes a web-based IDE through the use of [xterm.js](https://xtermjs.org/) and [CodeMirror](https://codemirror.net/).\n\n## Demo\nA demo of the webR IDE can be found at https://webr.sh. Please be patient as the Wasm runtime downloads and executes. R will display a banner message when it is ready to use.\n\n## Documentation\nDocumentation showing how to use webR in your own projects can be found at\nhttps://docs.r-wasm.org/webr/latest/\n\n## Downloading webR\nThe webR JavaScript package is available for download through [npm](https://www.npmjs.com/package/webr) and on [CDN](https://docs.r-wasm.org/webr/latest/downloading.html#download-from-cdn).\n\nComplete release packages, including R WebAssembly binaries, are available to download for self hosting in the [GitHub Releases section](https://github.com/r-wasm/webr/releases).\n\nDocker images containing a pre-built webR development environment can be found in the [GitHub Packages section](https://github.com/r-wasm/webr/pkgs/container/webr).\n\n## Building webR from source\nR's source code and supporting libraries are written in both C/C++ and Fortran. Source files can be compiled with either a [custom development version of LLVM flang](https://github.com/lionel-/f18-llvm-project/commits/fix-webr) (the default) or with `gfortran` and Dragonegg (using the `--with-dragonegg` configure option).\n\nIf you are compiling webR using the default toolchain, ensure that you first install the following required prerequisites in your build environment:\n * [Emscripten SDK](https://emscripten.org/docs/getting_started/downloads.html) (\u003e=3.1.35)\n * cmake\n * gperf\n * liblzma\n * libpcre2\n * node (\u003e=17.0.0)\n * quilt\n * wget\n\n### Build instructions\n\nClone the repo into a new directory, `cd` into the directory, then run `./configure \u0026\u0026 make`. You can configure `make` variables in a `~/.webr-config.mk` file.\n\nA `dist` directory is created which when finished contains the R Wasm files and an `index.html` file ready to serve the included webR IDE.\n\n#### WebAssembly libraries\n\nWebR relies on additional libraries compiled for Wasm for both Cairo graphics support and for building R packages that depend on certain system libraries. By default, only a minimal set of libraries are built for use with webR.\n\nIf you'd prefer to build all of the available system libraries for Wasm, `cd` into the `libs` directory and run `make all` to build the additional libraries, then finally `cd ..` and run `make clean-webr \u0026\u0026 make` to rebuild webR. R will automatically detect the additional Wasm libraries and integrate Cairo graphics support as part of the build.\n\n### Building with Docker\n\nIncluded in the source repository is a `Dockerfile` which can be used to setup everything that's required for the webR build environment, including LLVM flang and all supported WebAssembly system libraries.\n\nPre-built docker images can be found in the [GitHub Packages section](https://github.com/r-wasm/webr/pkgs/container/webr). To build the docker image and webR from source, `cd` into the webR source directory then run `docker build .`\n\nThe resulting docker image contains a version of R configured to be built for WebAssembly, and so the image can also be used to build custom R packages for webR.\n\n### Building with Nix\n\nIf you are using Nix, you can start a development environment by running `nix develop`. Then you can build as usual, with `./configure \u0026\u0026 make`.\n\nNote that this requires that your Nix installation has support for flakes enabled. The easiest way to do this is to install using the [Nix installer from Determinate Systems](https://zero-to-nix.com/start/install).\n\n### Node and Emscripten versioning\n\nWebR requires compiler and runtime support for [WebAssembly.Exception](https://developer.mozilla.org/en-US/docs/WebAssembly/JavaScript_interface/Exception), used internally for R error handling. This requires a version of Emscripten \u003e= 3.1.35 and Node \u003e= 17.0.0, which may be newer than the versions provided by your system package manager. An easy way to install and manage multiple versions of Node and Emscripten is by using [nvm](https://github.com/nvm-sh/nvm) and [emsdk](https://github.com/emscripten-core/emsdk).\n\nThe version of Node currently bundled by `emsdk` is 16.0.0. When building webR with this version of Node the process will fail with configure logs containing the error\n\n```\nWebAssembly.Tag is not a constructor\n```\n\nIf this occurs, a newer version of Node should be installed and the following environment variable set before building webR, instructing Emscripten to use the newer version of Node:\n\n```\nexport EM_NODE_JS=$(HOME)/.nvm/versions/node/v20.1.0/bin/node\n```\n\nIf you are unsure of the correct path to Node the command `which node` should print the path in full.\n\n### Building on macOS Ventura 13.0+\n\nAt the time of writing the version of R used as the base for webR does not build cleanly using the macOS Ventura development SDK. If you are not using the included `Dockerfile` to build webR, the following extra setup must be done before starting the build process,\n\n * Install the GNU version of the patch program: e.g. `brew install gpatch`\n\n### Using Dragonegg (Optional)\n\nIf you intend to build webR using Dragonegg to handle Fortran sources, older versions of the `gcc`/`gfortran` toolchain are required than what is provided by modern operating system repositories. The docker file `tools/dragonegg/Dockerfile` can be used to setup the required C/C++/Fortran toolchain and development environment for compiling webR with Dragonegg.\n","funding_links":[],"categories":["Official Resources","TypeScript","Deploy"],"sub_categories":["Core","Static Server Deploy"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fr-wasm%2Fwebr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fr-wasm%2Fwebr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fr-wasm%2Fwebr/lists"}