Serverless Shiny in Quarto Documents

Max Kuhn


A project for deploying Shiny applications that will run completely in the browser (R and python)

R and Python are compiled to WebAssembly (aka wasm)

  • R and packages are made into a binary format that can be embedded in the website.
  • JavaScript is the interface that the browser uses.

I’ll talk about adding shiny to Quarto documents (a book, in my case)

(Quarto extension, R package)

yml options

Your shiny app goes in a single code chunk of type shinylive-r and use the standalone option:

#| label: fig-shiny-spline
#| standalone: true

You also have to add a Quarto filter in your _quarto.yml file:

  - shinylive

Package declarations

To declare packages, use library() calls or a DESCRIPTION file

The renv package is used to figure this out.

(GH issue: Add feature/instructions for additional R packages)

If you live in JavaScript’s house,
you have to live by JavaScript’s rules

Data access

You don’t get automatic access to your local data (currently)

download.file() is an option but it must be done using specific request types.

It’s a work in progress. (GH issue: Add local folder support)

As always, be careful…

  • All the source code goes to the client

  • All of the data goes to the client

  • Don’t include credentials

  • Don’t include sensitive data


Thanks for the invitation to speak today!

Thanks to George Stagg, Joe Cheng, Winston Chang, Gordon Shotwell, and everyone else who made webR and shinylive happen.