Introduction

Published

2026-10-16

Using R package development practices when building Shiny applications saves time and makes collaboration easier. Packages give your code clear structure and make it simple for others to install, use, and understand your work. This book teaches you how to combine Shiny and R package development into a cohesive workflow.

Why this book?

R Packages, 2ed is the authoritative guide to package development, but it doesn’t cover Shiny.

Mastering Shiny teaches application design and reactivity, but package development remains optional and brief. If you’ve read one and wanted the other, you’ve hit a gap this book fills.

This book combines both approaches through worked examples of a complete Shiny app-package: structure, testing, documentation, deployment. Most developers have existing Shiny applications they want to turn into packages, so we’ll organize chapters around that journey rather than building from scratch.

Other resources

The Shiny community has published other excellent resources.

Engineering Production-Grade Shiny Apps introduces the golem framework for standardized app development.

Outstanding User Interfaces with Shiny addresses UI customization with HTML, CSS, and JavaScript. We’ll cover these frameworks in the later chapters if they fit your needs.

Why packages for Shiny?

Do future you a favor.

Standardizing your projects saves setup time and ramp-up across applications. Using an R package structure gives you access to IDE tools (RStudio and Positron) for testing, documentation, and installation. A package is a boundary: it forces clarity about what’s internal and what you expose to users.

Assume someone else will read your code.

R packages provide a standard interface for sharing code. When others (or future you) encounter your Shiny app, a package makes it obvious where to find what, how to install it, and how to run it. No guessing about file paths or setup steps.

How to read this book

The chapters roughly follow the steps of package development, applied to an existing Shiny application. Each topic can work on its own, but together they form a complete workflow.

The first two sections cover the stable fundamentals: the “whole game” of building an app-package, Shiny structure, package basics, and development tools. These topics won’t change anytime soon.

The remaining sections are opinionated approaches to debugging, testing, and deployment. Many practices come from R Packages, 2ed and the Shiny community, but there are always multiple ways forward.

Tip

If you find yourself getting frustrated, try the 15-minute rule: force yourself to attempt something for 15 minutes, then ask for help. The act of struggling teaches you more than a quick answer, and explaining your attempt to someone else often surfaces the solution.

Development environments

The chapters demonstrate RStudio and Positron (Posit’s new IDE for multiple languages). Most workflows are the same in both—I’ll use icons to flag differences.

RStudio is the established IDE for R package development. Its Build pane and tight integration with devtools streamline testing, documenting, and installing packages.

Positron is Posit’s new IDE, designed to be sleek and performant across multiple languages while keeping powerful tools for debugging and visualization. It’s under active development, so some features may still be arriving.

Package development outside an IDE (VS Code, command line, etc.) works the same way. You’ll call the same functions (roxygen2::roxygenize(), devtools::load_all(), devtools::install()), just without the point-and-click shortcuts.

Acknowledgments

This book came from conversations with Shiny developers new to packages, package authors learning Shiny, and new R users building robust applications. I’m grateful to:


  1. Eric’s LinkedIn↩︎