Four ways to publish your Shiny application to Posit Connect Cloud
We set out to make Posit Connect Cloud a fast and secure way for anyone to share their work with the world. That means a student publishing an app for school to share only with their teacher. It means an analytics consulting firm delivering business-critical AI apps securely to an external client. And it means a large enterprise publishing public-facing apps at scale.
We also want the platform to meet you where you work. That means publishing from any IDE, any terminal, or any code that is ready to deploy from GitHub. However you generate your R and Python work, and whoever your audience is, Connect Cloud is your home for secure cloud deployments of your data science work.
In this blog, we’ll walk through the most common ways to publish to Connect Cloud. For all four demos, we used the examples-shiny-r sample app. Any Shiny app will work the same way and all you’ll need is a free Connect Cloud account.
The four publishing options
Posit Assistant is now available in both RStudio and Positron, so you can always ask it for help along the way. But the walkthroughs below will give you a view into how simple it is to publish to Connect Cloud on your own.
1. Publish from Positron with Posit Publisher
Posit Publisher is the publishing extension built into Positron (it’s also available for VS Code). It gives you a visual checklist of everything going into your deployment before you ship it. No dependency file is required as the extension detects the packages your app needs from your code.
- Open your project in Positron and click the Posit Publisher icon in the Activity Bar.
- Add a credential: in the Credentials section, click the plus button, select Posit Connect Cloud, and authorize in the browser. You only need to do this once.
- Confirm the entrypoint file (e.g.,
app.R) and give the deployment a title. - Review the file selection and confirm the files your app needs are checked.
- Click Deploy Your Project. When the success toast appears, click View Content to open your app on Connect Cloud.
2. Publish from GitHub
If your app lives in a GitHub repo, you can publish directly to Connect Cloud. This is also the path that unlocks automatic republishing: enable it, and every push to your tracked branch redeploys the app.
GitHub publishing needs a manifest.json in the repo so Connect Cloud knows which packages and R version to build with. Generate it once from your R session in your project directory:
rsconnect::writeManifest()Note: If you are deploying Shiny for Python you’ll need a requirements.txt file.
Commit the file and push your changes, then:
- In Connect Cloud, click Publish on your home page.
- Select Shiny as the framework.
- Select your repository and branch.
- Confirm the primary file (e.g.,
app.R) and click Publish. The app builds and deploys. If you update your packages later, rerunwriteManifest()and push the new manifest so Connect Cloud builds with the versions you expect.
3. Publish with the rsconnect package
The rsconnect package enables you to programmatically deploy to Connect Cloud from any R session, including the console in Positron or RStudio. In this demo we ran it from Positron’s console.
Install the package and link your Connect Cloud account:
install.packages("rsconnect")
# Opens a browser window to authenticate (first time only)
rsconnect::connectCloudUser()
# Confirm the account is linked
rsconnect::accounts()
Then deploy:
rsconnect::deployApp(
appDir = ".", # or the folder containing app.R
appTitle = "examples-shiny-r",
launch.browser = TRUE # opens the content page on success
)
No dependency file is required. rsconnect scans your code and captures package versions from your active library automatically. For single documents rather than apps, use rsconnect::deployDoc("report.qmd") instead.
4. Publish from RStudio with push-button publishing
If you work in RStudio, publishing is built into the IDE. Under the hood it’s the same deployApp() call as method 3, wrapped in an easy-to-use, two-click flow.
- With
app.Ropen, click the blue publish icon in the editor toolbar. If this is your first time deploying, follow the steps to sync with Connect Cloud and authorize in the browser. - Confirm the files to include and the title, then click Publish.
Not just Shiny. Not just R.
Everything above works beyond Shiny and beyond R. Connect Cloud also hosts Streamlit, Dash, and Bokeh apps, along with R Markdown and Quarto documents. And Quarto now has its own command-line path: run quarto publish from your project directory and select Posit Connect Cloud as the destination.
Whatever you build, there’s a publishing path that fits. Create a free, SOC 2-audited Connect Cloud account today to deploy and share what matters most.
Chris deMontmollin