How to Publish a Shiny Application to Posit Connect
This guide used RStudio Version 2023.05.0
This guide walks you through creating a new Shiny application and then publishing your application to Posit Connect.
Prerequisites
Before you begin, you must:
Install RStudio
Have the public URL of the Connect server
Have a valid Connect account that has been promoted to at least the publisher role
For more information about requesting permission to publish your content, please see the Publishing section of the User Guide.
As you walk through this guide, there might be additional steps that are required due to your unique environment. For example, you might need to install or update packages, restart R, etc. In many cases, Connect prompts you to complete the action that is required to continue with this guide. If you get stuck, please refer to the Related Documentation section or the Connect Admin Guide.
Step 1. Create a new Shiny application
RStudio has a sample Shiny application that is available out of the box. For this guide, we are going to utilize the sample Shiny web app. Everyone has access to it, and it allows us to focus on the task of publishing a Shiny application to Connect instead of building an application from scratch. To begin:
Open RStudio.
From the menu bar, select File > New File > Shiny Web App…. The New Shiny Web Application window displays.
Give your application a name, then click Create. The script for your Shiny application displays in the editor.
Now, we should confirm that the application was successfully created. At the top of the editor, click Run App.
If the creation of the new Shiny application was successful, a new window displays the sample Shiny application named Old Faithful Geyser Data.
Step 2. Publish your Shiny application to Connect
Before you execute this step, verify that you have connected your RStudio account. The procedure is available in the Connect your Posit Account how to guide.
At the top of the editor, click Publish.
In the Publish to Server window, confirm that your account is shown in the Publish To Account section, then click Publish.
- You can monitor the status of the deployment in the RStudio Deploy pane.
- If for any reason you would like to stop the deployment, click the Stop button located in the Deploy pane.
- Your newly deployed R Markdown document automatically opens in a new browser tab if the Launch browser check box is selected (it is selected by default).
- If it doesn’t automatically display, your application might have been blocked as a popup in your browser.
Step 3. View the Shiny application on Connect
Navigate back to the Connect server that you published your content to. If applicable, log back into Connect.
To view the Content that you own, click your username, and then click Profile.
Your Shiny application, and any other published content, displays. To view your Shiny application, simply click the title of your application.
Your Shiny application displays in the Connect browser window.