0% found this document useful (0 votes)
60 views1 page

Golem

Golem is a framework for building robust Shiny apps as R packages. It provides functions to create, maintain, and deploy packaged Shiny apps. Key features include creating modules, adding external files like CSS and JavaScript, and using Golem utilities for common UI and server tasks. Golem treats the Shiny app as an R package, allowing developers to leverage existing package development best practices.

Uploaded by

Gerald
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
60 views1 page

Golem

Golem is a framework for building robust Shiny apps as R packages. It provides functions to create, maintain, and deploy packaged Shiny apps. Key features include creating modules, adding external files like CSS and JavaScript, and using Golem utilities for common UI and server tasks. Golem treats the Shiny app as an R package, allowing developers to leverage existing package development best practices.

Uploaded by

Gerald
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

golem :: A Framework for Building Robust Shiny Apps

Create, maintain & deploy a packaged Shiny Application

1. Create a golem 3. Day-to-day dev with golem 4. Exhibit your golem


With RStudio: Package for A. Look at your golem Locally
File New Project New Directory Shiny App remotes::install_local()
• Launch your app with dev/run_dev.R: Installs your golem locally like any other package.
using golem
options(golem.app.prod = FALSE) To Rstudio products
Sets the prod or dev mode. (see ?golem::app_dev ) golem::add_rstudioconnect_file()
golem::detach_all_attached() Creates an app.R file, ready to be deployed to RStudio Connect.
Detaches all loaded packages and cleans your environment. golem::add_shinyappsio_file()
Creates an app.R file, ready to be deployed to shinyapps.io.
golem::document_and_reload()
Documents and reloads your package. golem::add_shinyserver_file()
Creates an app.R file, ready to be deployed to Shiny Server.
appdemo::run_app()
Launches your application.
With Docker
golem::add_dockerfile()
Creates a Dockerfile that can launch your app.
B. Customise your golem with dev/02_dev.R golem::add_dockerfile_shinyproxy()
Creates a Dockerfile for ShinyProxy.
golem::add_dockerfile_heroku()
• Edit R/app_ui.R & R/app_server.R Creates a Dockerfile for Heroku.
Using the command line: 'R/app_ui.R' & 'R/app_server.R' hold the UI and server logic
of your app. You can edit them directly, or add elements
golem::create_golem( path = "~/appdemo")
Creates a golem at ‘~/appdemo’. created with golem (e.g, modules). Tips and tricks
• Add shiny modules golem::print_dev( "text" )
2. Set up your golem with dev/01_start.R golem::add_module( name = "example" )
Prints text in your console if golem::app_dev() is TRUE.
golem::make_dev( function )
Creates ‘R/mod_example.R’, with mod_example_ui and Makes function depend on golem::app_dev() being TRUE.
golem::fill_desc( pkg_name = "appdemo", … ) mod_example_server functions inside.
golem::browser_button()
Fills the package DESCRIPTION with the author Creates a backdoor to your app
information, the application title & description, links… • Add external files
(see ?golem::browser_button).
golem::set_golem_options() golem::add_js_file( "script" )
Creates ‘inst/app/www/script.js’. • How to make a run_dev script for a specific module:
Sets {golem} global options.
golem::add_js_handler( "script" )
golem::use_recommended_tests() Creates ‘inst/app/www/script.js’ with a skeleton for shiny
golem::detach_all_attached()
Creates a test template for your app. golem::document_and_reload()
custom handlers.
golem::use_recommended_deps() golem::add_css_file( "custom" ) ui <- mod_example_ui( "my_module" )
server <- function(input,output,session){
Adds {shiny}, {DT}, {attempt}, {glue}, {htmltools}, and Creates ‘inst/app/www/custom.css’. callModule( mod_example_server, "my_module", session )
{golem} as dependencies. }
• Use golem built-in JavaScript functions
golem::use_favicon( path = "path/to/favicon.ico" ) shinyApp(ui, server)
Changes the default favicon. golem::activate_js()
golem::use_utils_ui() Activates the built-in JavaScript functions. To be inserted in the UI. Keep in mind that a golem is a package. Everything you
Creates ‘R/golem_utils_ui.R’, with UI-related helper functions. golem::invoke_js("jsfunction", ns("ref_ui")) know about package development works with your
golem::use_utils_server() Invokes from the server any JS function: built-in golem JS packaged Shiny App created with {golem}!
Creates ‘R/golem_utils_server.R’, with server-related helper functions. functions or custom ones created with add_js_handler() (documentation, tests, CI & CD, ...)

ThinkR • [email protected] • + 33 (0)1 85 09 14 03 • thinkr.fr • Learn more at thinkr-open.github.io/golem/ • package version 0.1.0 • Updated: 2019-06

You might also like