Important
This package is currently in the prototype/experimental stage. It is not yet available on CRAN and may have bugs or limitations.
This R package allows you to convert Shiny web applications into standalone desktop applications for using Electron. This means your users can run your Shiny apps without having R installed on their machines.
You can install the development version of shinyelectron from GitHub with:
# From CRAN (not available yet)
# install.packages("shinyelectron")
# From GitHub
# install.packages("remotes")
remotes::install_github("coatless-rpkg/shinyelectron")
Important
We are currently working on making the installation process as smooth as possible. Please bear with us as we work through identifying the necessary dependencies for each platform.
- R (>= 4.0.0)
- Node.js (>= 14.0.0)
- npm (>= 6.0.0)
For building platform-specific installers:
- Windows: Windows 11+ and Visual Studio Build Tools
- macOS: macOS 10.13+ and Xcode CLI
- Linux: Appropriate development tools for your distribution
The export()
function allows you to convert a Shiny application into a
standalone Electron application.
library(shinyelectron)
# Export a Shiny application to an Electron application
shinyelectron::export(
appdir = "path/to/your/shinyapp",
destdir = "path/to/export/destination"
)
For example, to convert the “Hello World” Shiny app from the {shiny}
package into a standalone Electron app:
# Copy "Hello World" from `{shiny}`
system.file("examples", "01_hello", package="shiny") |>
fs::dir_copy("myapp", overwrite = TRUE)
shinyelectron::export("myapp", "hello-world-app")
You can customize the export process using the following options:
shinyelectron::export(
appdir = "path/to/your/shinyapp",
destdir = "path/to/export/destination",
app_name = "My Amazing App",
platform = c("win", "mac"), # Build for Windows and Mac only
include_r = TRUE, # Bundle minimal R environment
r_version = "4.4.3", # Bundle R 4.4.3
overwrite = TRUE, # Overwrite existing files in destdir
verbose = TRUE, # Display detailed progress information
open_after = TRUE # Open the generated project after export
)
- The package creates an Electron application structure in the destination directory
- It copies your Shiny application files into this structure
- It configures the Electron app to start an R process and run your Shiny app
- It optionally bundles a minimal R environment
- It builds platform-specific installers using electron-builder
This project builds upon several notable efforts to integrate R Shiny applications with the Electron framework.
- electricShine: A
package that streamlines the creation of distributable Shiny Electron
apps through its
electrify
function, which automates building and packaging processes for Windows. - Photon: An RStudio add-in that
leverages Electron to build standalone Shiny apps for macOS and
Windows by cloning an R specific
electron-quick-start
repository and including portable R versions. - RInno: Creates standalone R applications with Electron on Windows.
- DesktopDeployR: An alternative framework for deploying self-contained R-based applications that provides a portable R environment and private package library.
- User! 2018 Talk: A presentation by @ksasso at the 2018 UseR! conference that demonstrates how to convert Shiny apps into standalone desktop applications using Electron. ksassouser2018talk
- Developer Tutorials: Valuable step-by-step guides from contributors like @lawalter and @dirkschumacher that demonstrate practical integration techniques and solutions.shiny-electron-walter-tutorial
- Zarathu Corporation Templates: Specialized templates for macOS ARM (M1/M2/..) and Windows platforms that have significantly contributed to cross-platform deployment solutions described in R-Bloggers: Creating Standalone Apps from Shiny with Electron post.
MIT
Contributions are welcome! Please feel free to submit a Pull Request.
electricShine
(R Package)RInno
(R package)Photon
(RStudio Addin)COVAIL
Electron Quick Start (GitHub)DesktopDeployR
(GitHub)- Electron ShinyApp Deployment UseR! 2018 (GitHub, @ksasso)
- How to Make an R Shiny Electron App (GitHub, @lawalter)
- R shiny and electron (GitHub, @dirkschumacher)
- Creating Standalone Apps from Shiny with Electron in macOS 2023 (GitHub, macOS ARM (M1/M2/…))
- Creating Standalone Apps from Shiny with Electron in Windows 2023 (GitHub, @jhk0530)
- Creating Standalone Apps from Shiny with Electron 2023 (R-bloggers, @jhk0530)
- Shiny meets Electron: Turn your Shiny app into a standalone desktop app in no time @ UseR! 2018 (Presentation Source)
- Electron Documentation