Preface

Published

2026-08-06

Shiny App-Packages attempts to combine and distill Shiny and R package development practices from multiple resources.

Why this book?

Did you read R Packages, 2ed and find it difficult to apply package development practices to your Shiny application?

R Packages, 2ed is the premier resource for learning the best practices when creating functions, writing documentation, managing package namespaces, and many other fundamental aspects of package development. However, R Packages, 2ed primarily focuses on creating conventional R packages, so it doesn’t cover Shiny programming (designing user interfaces, server-side computations, modules, etc.). Moreover, testing and debugging a Shiny application differs from the traditional methods used in R packages.

Did you read Mastering Shiny and want to learn more about package development?

Mastering Shiny is an excellent introduction to the world of Shiny and provides a foundation of best practices for developing applications. R packages are introduced near the end of Mastering Shiny, and this chapter is a great place to start.1 However, to fully understand and appreciate the benefits of developing your Shiny app as an R package, it’s helpful to have an example app-package that includes the full suite of the package development tools (loading, documenting, testing, installing, etc.).2

Other Shiny Resources

Throughout the course of writing this book, the Shiny community has grown and other resources have been published for developing and customizing Shiny applications. Two popular resources are Engineering Production-Grade Shiny Apps and Outstanding User Interfaces with Shiny.

Engineering Production-Grade Shiny Apps introduces the golem package, which is an ‘opinionated framework for building production-grade Shiny applications’. golem offers a robust and standardized way to build, maintain, and deploy production-grade Shiny apps. Whether due to the learning curve, number of features, dependencies, or a particular set of deployment constraints, golem might not be the right fit for your application.3

Outstanding User Interfaces with Shinyaddresses a specific gap between the beginner and advanced level’ focusing on customizing your Shiny application with HTML, CSS and JavaScript. It introduces charpente, which streamlines the creation of Shiny development by quickly creating an R package, importing external web dependencies for JavaScript and CSS, initializing input/output bindings, and providing custom handler boilerplates. charpente also offers a high-level interface to htmltools (the workhorse that converts R code to web-friendly HTML).

We’ll cover both of these texts more in the frameworks section.

Development Environments

The two integrated development environments (IDEs) I will be demonstrating are RStudio and Positron.

RStudio is a popular integrated development environment (IDE) that streamlines many R package development tasks. I’d previously connected this IDE to the definitions above for R package and Shiny app-packages. Specifically, the package development tools provided in the Build pane and the devtools package.

Positron is Posit’s new integrated development environment (IDE) designed to improve productivity and performance across multiple programming languages. Building on RStudio’s success, Positron offers a sleek, user-friendly interface while keeping powerful tools for debugging, profiling, and interactive visualizations.

Most of the book will focus on developing Shiny app-packages in RStudio, because Positron is under active development. When I’m including information specific to particular IDE, I will use icons to differentiate Positron from RStudio ( vs. ).

Other tools

Developing R packages in RStudio or Positron is not required. There are alternative IDEs and tools, and many developers employ these setups (VS Code, PyCharm, Jupyter Lab, Colab, etc). Package development outside RStudio would look almost identical to development in the IDE:

  1. Create the package structure (R/ folder for .R scripts, man/ folder for documentation, data/ folder for datasets, etc.)

  2. Create DESCRIPTION and NAMESPACE files, etc.

  3. Ensure the package can be installed and loaded into an R session.

The development workflow functions we’ll cover work just about anywhere you can execute R code (i.e., roxygen2::roxygenize(), devtools::load_all(), devtools::install(), etc.).

Acknowledgments

This book is the result of multiple discussions with 1) Shiny developers who were new to writing R packages, 2) R package authors who were learning Shiny development and testing, and 3) new R users who wanted to build a robust and scalable application. Shiny App-Packages wouldn’t have been possible without the contributors below (and I am deeply grateful for all of their help!).


  1. Testing Shiny apps requires additional packages and tools to ensure an application’s reliability and performance.↩︎

  2. The ‘Converting an existing app’ chapter provides an example of converting a Shiny app into an R Package. However, many of the helpful package development tools aren’t available (i.e., roxygen2 tags, NAMESPACE imports/exports, tests, vignettes, etc.).↩︎

  3. golem apps are built as packages. Still, EPGSA assumes the reader is ‘comfortable with building an R package.’ (if you’re familiar with package development, EPGSA is an excellent resource).↩︎

  4. Eric’s LinkedIn↩︎