Introducing shinystate

Launching Shiny collaboration to new heights


Eric Nantz

Statistician / Developer / Podcaster

Eli Lilly & Company

@rpodcast

@rpodcast

eric-nantz

High-stakes Collaboration

Complex Applications

  • Capture state of application and restore at later point
  • Not quite everything I needed …

URL Method

myapp.com/?_inputs_&_n=200&text=abc&....

Server-side Method

Store as files in hosting server


Enter {shinystate}

Supercharge Shiny’s Bookmarkable-state capability with key enhancements

  • Granular control over storage location
  • Capability to add optional metadata
  • Object-oriented methods with {R6}

Enable shinystate

library(shiny)
library(bslib)
library(shinystate)

storage <- StorageClass$new()

ui <- function(request) {
  page_sidebar(
    use_shinystate(),
    # additional UI code
  )
}

server <- function(input, output, session) {
  storage$register_metadata()
  # additonal server logic
}

shinyApp(ui, server, enableBookmarking = "server")

Saving Bookmarkable State πŸ’Ύ

storage$snapshot(
  metadata = list(
    save_name = "exploring",
    timestamp = Sys.time()
  )
)
url save_name timestamp
?state_id=7c61d102e8b68a61 exploring 2025-09-16 13:14:07
?state_id=92af5e9aeae226c7 refine 2025-09-16 13:26:05
?state_id=2b0a78b6da5f2f65 finalize 2025-09-16 13:41:12
  • url: Mapping to unique ID of session
  • Optional: list of metadata values

Restoring Bookmarkable State πŸ“‚

session_df <- storage$get_sessions()
url <- session_df |>
  dplyr::filter(save_name == "exploring") |>
  dplyr::pull(url)

storage$restore(url)

Storage with {pins}

  • Control where you store bookmarkable state files
  • Leverages custom format capability
board <- pins::board_s3("awesome-bucket")
storage <- StorageClass$new(board_sessions = board)

Power-up: Sharing Sessions

Dr. Light

Dr. Wily

Additional Benefits πŸ€”

  • Custom processing of session state artifacts
  • Traceability within and across user sessions
  • Inputs to automated reporting

Current and Future Work

βœ… Example applications from basic usage to Shiny modules

βœ… Package website with interactive apps powered by WebAssembly!

⏳ CRAN submission (in queue)

πŸ›  Compatability with {golem} and {rhino}

Relief in Sight

Thank You!