{"id":13707986,"url":"https://github.com/zarathucorp/shiny-electron-template-windows","last_synced_at":"2025-12-24T15:44:47.329Z","repository":{"id":195354174,"uuid":"692756531","full_name":"zarathucorp/shiny-electron-template-windows","owner":"zarathucorp","description":"Template repository for build Standalone R Shiny application with Electron","archived":false,"fork":false,"pushed_at":"2024-04-16T04:33:47.000Z","size":70,"stargazers_count":13,"open_issues_count":1,"forks_count":12,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-11-13T17:45:26.525Z","etag":null,"topics":["electron","r","shiny","windows"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zarathucorp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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}},"created_at":"2023-09-17T13:47:28.000Z","updated_at":"2024-11-11T23:25:49.000Z","dependencies_parsed_at":"2024-01-25T23:14:25.393Z","dependency_job_id":"fbdc02cf-af6a-48be-95d2-ee233beb184d","html_url":"https://github.com/zarathucorp/shiny-electron-template-windows","commit_stats":{"total_commits":21,"total_committers":2,"mean_commits":10.5,"dds":0.04761904761904767,"last_synced_commit":"2e7f9839f5c3d212238ec388db0005c0243c7df9"},"previous_names":["zarathucorp/shiny-electron-template-windows-2023"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zarathucorp%2Fshiny-electron-template-windows","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zarathucorp%2Fshiny-electron-template-windows/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zarathucorp%2Fshiny-electron-template-windows/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zarathucorp%2Fshiny-electron-template-windows/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zarathucorp","download_url":"https://codeload.github.com/zarathucorp/shiny-electron-template-windows/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252639960,"owners_count":21780846,"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":["electron","r","shiny","windows"],"created_at":"2024-08-02T22:01:52.045Z","updated_at":"2025-12-24T15:44:47.274Z","avatar_url":"https://github.com/zarathucorp.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# shiny-electron-template-windows\n\n## How to Make an R Shiny Electron App\n\n\u003e [!NOTE] \n\u003e\n\u003e A setup guide by L. Abigail Walter \u003cbr\u003e\n\u003e Instructions adapted from \u003ca href=\"https://www.travishinkelman.com/post/deploy-shiny-electron/\"\u003eTravis Hinkelman\u003c/a\u003e \u003cbr\u003e\n\u003e R Shiny Electron template created by \u003ca href=\"https://github.com/dirkschumacher/r-shiny-electron\"\u003eDirk Shumacher\u003c/a\u003e \u003cbr\u003e\n\u003e Template \u0026 Instruction updated by \u003ca href=\"https://github.com/jhk0530\" target = \"_blank\"\u003eJinhwan Kim\u003c/a\u003e \u003cbr\u003e\n\u003e \n\u003e For more info, see previous \u003ca href = \"https://github.com/lawalter/r-shiny-electron-app\" target = \"_blank\"\u003erepository\u003c/a\u003e \u003cbr\u003e\n\n\u003e [!TIP]\n\u003e For macOS, see \u003ca href ='https://github.com/zarathucorp/shiny-electron-template-m1' target = \"_blank\"\u003ethis repository\u003c/a\u003e\n\n## Guide article in R-bloggers (based on 2023.03, may not work in 2024-)\n\n\u003ca href='https://www.r-bloggers.com/2023/03/creating-standalone-apps-from-shiny-with-electron-2023-macos-m1/' target ='_blank'\u003eCreating Standalone Apps from Shiny with Electron [2023, macOS M1]\u003c/a\u003e\n\n## Versions info \n![NodeJS](https://img.shields.io/badge/node.js-22.11.0-6DA55F?style=for-the-badge\u0026logo=node.js\u0026logoColor=white)\n![NPM](https://img.shields.io/badge/NPM-10.9.0-%23CB3837.svg?style=for-the-badge\u0026logo=npm\u0026logoColor=white)\n![RStudio](https://img.shields.io/badge/RStudio-2024.09.1-4285F4?style=for-the-badge\u0026logo=rstudio\u0026logoColor=white)\n![R](https://img.shields.io/badge/r-4.4.2-%23276DC3.svg?style=for-the-badge\u0026logo=r\u0026logoColor=white)\n![Electron.js](https://img.shields.io/badge/Electron-7.2.0-191970?style=for-the-badge\u0026logo=Electron\u0026logoColor=white) \n![windowOS](https://img.shields.io/badge/windows-11-AAA?style=for-the-badge\u0026logo=microsoft)\n\n---\n\n## Getting started\n\n### A. Environment setup\n\n\u003e [!NOTE]\n\u003e All of the following steps can be run exclusively in the RStudio **Terminal** (right to **console**).\n\u003e\n\u003e so **Terminal** means Rstudio's terminal using \u003ckbd\u003eAlt\u003c/kbd\u003e + \u003ckbd\u003eShift\u003c/kbd\u003e + \u003ckbd\u003em\u003c/kbd\u003e\n\u003e\n\u003e Also, I recommend to run **Rstudio as Administrator**.\n\n1. Install **R**, **Rstudio**.\n2. Install **Node.js**: from \u003ca href = \"https://nodejs.org/en/\" target = \"_blank\"\u003e offical page \u003c/a\u003e\n3. Install **Electron Forge** using `npm` (`npm` is installed with `Node.js`)\n4. In the **Terminal**, run `sudo npm i -g @electron-forge/cli`, (`sudo` requires password) \nIf you have trouble try `npm install --save-dev @electron-forge/cli`\n\n5. Install **Innoextract** from \u003ca href='https://constexpr.org/innoextract/' target ='_blank'\u003ethis link\u003c/a\u003e (Windows Only) and move it to program files and add Environment variable PATH (See [this](https://stackoverflow.com/questions/53193489/path-variable-in-environmental-variable-accepts-only-one-path))\n\n\u003e [!NOTE]\n\u003e Check your versions of `node` and `npm` in **Terminal** with `node -v`, `npm -v`.\n\n6. Give **Star** ⭐, **Fork** this repository to your own account. Then **clone** it to your local PC\n\n### B. Electron project\n\n7.  Open an R project with cloned repository's `.Rproj` file.\n8.  In your project directory (may `Github/shiny-electron-template-windows`), install **Electron** locally by running `npx create-electron-app \u003cAPPNAME\u003e`.\n\n\u003e [!WARNING]\n\u003e You can not use `app` as `\u003cAPPNAME\u003e` \u003cbr\u003e\n\u003e Assume using `myapp` in this tutorial\n\n\u003cdiv style='text-align:center';\u003e\n    \u003cimg src='https://github.com/user-attachments/assets/d69ffb27-8fff-4be2-9fff-45d0156a0d05' width='80%'\u003e\n\u003c/div\u003e\n\n9.  In your `myapp` folder, **delete** `src` directory\n10.  Copy (or move) below files to your `myapp` folder:\n\n-   `get-r-win.sh`: This installs a \"local\" R, that will be used by the electron app.\n-   `add-cran-binary-pkgs.R`: For install R packages into your project locally\n-   `start-shiny.R`: Let electron call your shiny app\n\n-   Folder **shiny** from this template, containing:\n    -  `shiny/app.R`: ⚠️**THIS IS YOUR SHINY APP'S CODE, replace this with your app's code and other files like /www**    \n\n-   Folder **src** from this template, containing:         \n    -   src/helpers.js     \n    -   src/index.css     \n    -   src/index.js     \n    -   src/loading.css     \n    -   src/loading.html     \n    - `src/main.js`: configure shiny electron app (like `width`, `height`)\n\n11. Change your directory to new app folder `cd myapp` with **Terminal**\n\n### C. Setup R \n\n12. Install local R with `sh ./get-r-win.sh`\n    -   First, check the version of R on your machine. In the R **Console**, run `version`.\n\n\u003e [!WARNING]\n\u003e **Your PC's R version** and **electron's R version** must same, so if template's version is not same, you have to change as proper url\n\nYou may see URL (`cloud.r-project.org/bin/windows/base/`) which shows latest version of R.\nand if you move your mouse to `Download R-4.4.2 for ...` you can see URL of it on the left bottom and you can use it to `.sh` file\n\n\u003cdiv style='text-align:center';\u003e\n    \u003cimg src='https://github.com/user-attachments/assets/aa331568-3973-4056-86f4-bef2634d94ca' width='80%'\u003e\n\u003c/div\u003e\n\n13. Build `app.R` as your application's code.\n\n\u003e [!NOTE]\n\u003e not only `app.R` also other required files for shiny application (like `/www`)\n\n14. If you don't have the `automagic` package installed, run `install.packages(\"automagic\")` in the **console**.\n\n15. In the Rstudio **terminal**, run `Rscript add-cran-binary-pkgs.R` to get packages for R.\n\n\u003cdiv style='text-align:center';\u003e\n    \u003cimg src='https://github.com/user-attachments/assets/ebc85832-1a12-4b7a-82e5-3d811874e4e5' width='80%'\u003e\n\u003c/div\u003e\n\n\u003e [!NOTE]\n\u003e If your shiny application uses not-CRAN packages (like `github` / `bioconductor`), See **Add not-CRAN packages** below.\n\u003e \n\n### D. Setup electron\n\n16. Change `package.json` as \u003ca target = \"_blank\" href='%5Bfix%5D%20package-json'\u003e`[fix] packages-json`\u003c/a\u003e's content. And modify **author** information. (not merge)\n\n\u003e [!NOTE]\n\u003e Node package's version confirmed in 2024.11\n\n17. Change `forge.config.js` as \u003ca target = \"_blank\" href = '/%5Bfix%5D%20forge-config-js'\u003e`[fix] forge.config.js`\u003c/a\u003e's content. (not merge)\n\n18. Run `npm install` in **Terminal** to add new dependencies you listed in `package.json` to the **node_modules** folder.\n\n\u003cdiv style='text-align:center';\u003e\n    \u003cimg src='https://github.com/user-attachments/assets/aea4a364-74f6-46c8-9f5d-2e18352031ed' width='80%'\u003e\n\u003c/div\u003e\n\n### E. Build shiny.exe\n\n\u003e [!NOTE]\n\u003e You need to run step after this, **whenever** you want to update shiny application.\n\n19. Test your shiny application work by `electron-forge start` in **Terminal**.\n\n\u003cdiv style='text-align:center';\u003e\n    \u003cimg src='https://github.com/user-attachments/assets/309045d4-867b-4d7f-87ff-bbe92b1b7a4a' width='80%'\u003e\n\u003c/div\u003e\n\n20. If the app runs successfully, congratulations! Create the `.exe`(as ZIP) on the `electron-forge make` in **Terminal**. Your app can be found in the **/out** folder. (Strongly recommend to **open with Administrator**)\n\n------------------------------------------------------------------------\n\n## Additionals\n\n- Raise an issue, please.\n\n### Error with require() of ES Module\n\nIt doesn't affect to run shiny.\n\n### Add not-CRAN packages\n\n- manually copy library from your **Local's R library** to **r-win/library**, You can check Local's R library with `.libPaths()` in **R console**.\n\n### Infinite loading in Electron-forge start / make\n\n- First, change app.R code as basic [example](https://github.com/rstudio/shiny/blob/main/inst/examples/01_hello/app.R).\n- If this works well, your app.R code has problem. In my case, I updated R package in shiny application but not in library of R-win directory. \n- So update them with recent version, and try again will work.  \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzarathucorp%2Fshiny-electron-template-windows","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzarathucorp%2Fshiny-electron-template-windows","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzarathucorp%2Fshiny-electron-template-windows/lists"}