Skip to content

R package to setup a standalone shiny application built with electron

License

Unknown, MIT licenses found

Licenses found

Unknown
LICENSE
MIT
LICENSE.md
Notifications You must be signed in to change notification settings

coatless-rpkg/shinyelectron

Repository files navigation

Important

This package is currently in the prototype/experimental stage. It is not yet available on CRAN and may have bugs or limitations.

shinyelectron

R-CMD-check Prototype Experimental

Export Shiny Applications as Desktop Applications using Electron

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.

Installation

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")

Prerequisites

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

Usage

Basic Usage

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")

Advanced Options

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
)

How It Works

  1. The package creates an Electron application structure in the destination directory
  2. It copies your Shiny application files into this structure
  3. It configures the Electron app to start an R process and run your Shiny app
  4. It optionally bundles a minimal R environment
  5. It builds platform-specific installers using electron-builder

Acknowledgements

This project builds upon several notable efforts to integrate R Shiny applications with the Electron framework.

Prior packaging attempts:

  • 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.

Talks, Tutorials, and Templates:

License

MIT

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

References

About

R package to setup a standalone shiny application built with electron

Resources

License

Unknown, MIT licenses found

Licenses found

Unknown
LICENSE
MIT
LICENSE.md

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages