Chapter 2 Getting Started is a platform as a service (PaaS) for hosting Shiny web applications (apps). This guide will describe how to create a account and deploy your first application to the cloud.

Before you get started with, you will need:

  • An R development environment, such as the RStudio IDE
  • The rsconnect R package from CRAN, or the latest version from GitHub

2.1 Installation

To install rsconnect on your local R process, you can run the following command:


After the installation completes, you can load the library in your session with the following command:


If you would like to use the latest version of the rsconnect package, you can install it with the following commands:


2.2 Creating a account

Go to and click “Log In”. The site will give you several options for signing in. If you have a Google account or a GitHub account, you can use either one of those methods to authenticate. Alternatively you can create a username/password combination.

The first time you sign in, prompts you to set up your account. uses the account name as the domain name for all of your apps. Account names must be between four and 63 characters and can only contain letters, numbers, and dashes (-). Account names may not begin with a number or a dash, and they cannot end with a dash (see RFC 952). Some account names may be reserved.

2.3 Deploying applications

2.3.1 Configure rsconnect

Once you have set up your account in, you can configure the rsconnect package to use that account. automatically generates a token and secret for you, which the rsconnect package can use to access your account. Retrieve your token from the dashboard by selecting the Tokens option in the menu at the top right of the shinyapps dashboard (under your avatar).

There are two ways to configure the rsconnect package to connect to your application.

Method 1

Click the Show button on the Token page. A window will pop up that shows the full command to configure your account using the appropriate parameters for the rsconnect::setAccountInfo function. Copy this command to your clipboard, and then paste it into the R console in the RStudio IDE and hit Enter.

Method 2

In the R console, run the setAccountInfo function from the rsconnect package, passing in the token and secret from the Profile -> Tokens page.

rsconnect::setAccountInfo(name="<ACCOUNT>", token="<TOKEN>", secret="<SECRET>")

Once you have configured your rsconnect installation, you can use it to upload applications to If you are using the RStudio IDE, you can manage your account by going to Tools -> Global Options -> Publishing.

In the second part of this guide, we will build a demo application, upload it to, and create a password for the application.

2.3.2 Deploying a sample application

If you are using the RStudio IDE, you can create a quick sample Shiny application by clicking on the File -> New File -> Shiny Web App.

or you can copy the code below into your ui.R file

## ui.R



  # Application title
  titlePanel("Old Faithful Geyser Data"),

  # Sidebar with a slider input for number of bins
                  "Number of bins:",
                  min = 1,
                  max = 50,
                  value = 30)

    # Show a plot of the generated distribution

and server.R file

## server.R


shinyServer(function(input, output) {

  output$distPlot <- renderPlot({

    # generate bins based on input$bins from ui.R
    x    <- faithful[, 2]
    bins <- seq(min(x), max(x), length.out = input$bins + 1)

    # draw the histogram with the specified number of bins
    hist(x, breaks = bins, col = 'darkgray', border = 'white')



Verify that your application works by running it locally. Set your working directory to your app directory, and then run:


If you’re using the RStudio IDE, you can also run your application by clicking the Run App button in the editor toolbar. Deploying your first application

To deploy your application, you can either deploy the app from the IDE itself by clicking on the Publish button in the top right corner of the interface:

or you can use the deployApp command from the rsconnect package.


Once the deployment finishes, your browser should open automatically to your newly deployed application.

Congratulations, you have deployed your first application!

Feel free to make changes to your code and run deployApp() again. rsconnect can deploy an app much more quickly after the first deployment.

2.4 Using your R packages in the cloud

In order to run your applications on, the service needs to replicate the environment from your local machine. is built using Ubuntu Linux as the base operating system, and is likely to be different from most users’ systems.

The shiny package supports the use of any package in R that you can install. Although supports the vast majority of packages in the R ecosystem, there are two important exceptions:

  • R packages that do not run on Ubuntu Linux
  • R packages that require access to the display (such as Tcl/Tk)

When you deploy your application, the rsconnect package detects the packages that your application uses by looking for explicit library() calls within your application. Be aware that you should not have an explicit install.packages() call within your ui.R or server.R files.

During deployment, the rsconnect package sends the R version, the list of packages and their dependencies, and your application to then builds and installs the packages into the R library for your application. The first time you deploy your application, it may take some time to build these packages (depending on how many packages are used). However, you will not have to wait for these packages to build during future deployments (unless you upgrade or downgrade a package, or you upgrade to a newer version of R).

Package sources

Currently, the service supports deploying packages installed from CRAN, GitHub (both public and private repos), and BioConductor.

Support for R-Forge and other repos is on our backlog; please drop us a line on the Users list if the lack of support is a blocker for you. Important note on GitHub packages

Only packages installed from GitHub with devtools::install_github, in version 1.4 (or later) of devtools, are supported. Packages installed with an earlier version of devtools must be reinstalled with the later version before you can deploy your application. If you get an error such as “PackageSourceError” when you attempt to deploy, check that you have installed all the packages from Github with devtools 1.4 or later.

2.4.1 Managing R versions

There are typically three releases of R per year. In order to support the new version of R, needs to compile R for each version. Typically, new versions of R are supported within three days of release.

2.4.2 System packages

R packages will often rely on operating system packages to be installed on the server. If your application happens to use an R package that requires a system library that is not installed by default, please let us know by filing an issue, or a pull request, at shinyapps-package-dependencies