%%{init: {'theme': 'base', 'themeVariables': { 'fontFamily': 'monospace', "fontSize":"14px", "darkMode":true}}}}%%
flowchart TD
subgraph Local["<strong>Local Development</strong>"]
code["App-package code<br/>(R/, inst/, app.R)"]
test["Test locally with<br/>launch_app()"]
end
subgraph Config["<strong>Configuration</strong>"]
creds["rsconnect credentials<br/>(API key, server URL)"]
end
subgraph Deploy["<strong>Deployment</strong>"]
bundle["Bundle files &<br/>capture dependencies"]
upload["Upload to<br/>Connect Cloud"]
end
subgraph Cloud["<strong>Connect Cloud</strong>"]
build["Build container image<br/>(install packages)"]
start["Start application<br/>instance"]
end
subgraph Monitor["<strong>Production</strong>"]
running["App running &<br/>accessible"]
dashboard["Monitor via<br/>dashboard"]
end
code --> test
test --> check{"Ready to<br/>deploy?"}
check -->|"Yes"| creds
check -->|"No"| code
creds --> bundle
bundle --> upload
upload --> build
build --> success{"Build<br/>successful?"}
success -->|"No"| logs["View build logs<br/>& troubleshoot"]
logs --> code
success -->|"Yes"| start
start --> running
running --> dashboard
style code fill:#7fd9c7,color:#fff,stroke:#4CBB9D,stroke-width:1px,rx:5,ry:5
style test fill:#7fd9c7,color:#fff,stroke:#4CBB9D,stroke-width:1px,rx:5,ry:5
style creds fill:#7fd9c7,color:#fff,stroke:#4CBB9D,stroke-width:1px,rx:5,ry:5
style bundle fill:#7fd9c7,color:#fff,stroke:#4CBB9D,stroke-width:1px,rx:5,ry:5
style upload fill:#7fd9c7,color:#fff,stroke:#4CBB9D,stroke-width:1px,rx:5,ry:5
style build fill:#7fd9c7,color:#fff,stroke:#4CBB9D,stroke-width:1px,rx:5,ry:5
style start fill:#7fd9c7,color:#fff,stroke:#4CBB9D,stroke-width:1px,rx:5,ry:5
style running fill:#90EE90,color:#000,stroke:#4CBB9D,stroke-width:2px,rx:5,ry:5
style dashboard fill:#7fd9c7,color:#fff,stroke:#4CBB9D,stroke-width:1px,rx:5,ry:5
style check fill:#fff,color:#000,stroke:#333,stroke-width:1px
style success fill:#fff,color:#000,stroke:#333,stroke-width:1px
style logs fill:#FFB6C6,color:#000,stroke:#CC0000,stroke-width:1px,rx:5,ry:5
19 Posit Connect Cloud
This chapter covers deploying your app-package to Posit Connect Cloud, a managed hosting platform for Shiny applications and other content. Unlike shinyapps.io, Connect Cloud integrates directly with your Posit Team workspace, giving you a centralized place to manage all your deployed applications alongside your collaboratorsβ work. We deployed the production version of our application in Section 9.4.2, but here Iβll walk through the Connect Cloud deployment workflow and show you what to expect during and after deployment.
19.1 Deployment workflow
The diagram below shows the complete deployment flow from your local development environment to a running application in Connect Cloud:
19.2 Configuring rsconnect
To deploy to Posit Connect Cloud, youβll need the rsconnect package. Install and load it:
install.packages("rsconnect")
library(rsconnect)Connect Cloud uses API authentication, which means youβll configure rsconnect with your server URL and API key (not a username and password). You can generate an API key from your Connect Cloud account settings.
Set your Connect Cloud credentials using rsconnect::connectUser():
rsconnect::connectUser(
account = "https://connect.posit.cloud",
token = "your_api_key",
server = "posit-connect-cloud"
)Once configured, rsconnect will remember your credentials for future deployments.
19.2.1 Deploying from RStudio 
RStudio connects to Connect Cloud through the Publish button. After configuring your account, load and document your app-package, then launch app.R:
devtools::load_all()
devtools::document()
source("app.R")Click the Publish icon in the Viewer pane, select your deployment account, choose which files to include, and enter an app name. RStudio will bundle your files and send them to Connect Cloud.
19.2.2 Deploying from Positron 
You can also deploy from Positron
using the rsconnect::deployApp() function. This approach gives you full control over deployment parameters:
rsconnect::deployApp(
appDir = getwd(),
appName = "movie-reviews",
server = "posit-connect-cloud",
account = "your_account")The deployment output is printed directly to the Console, and the process works identically to RStudioβs Publish buttonβboth use rsconnect under the hood.
19.3 Deployment logs
When you deploy to Connect Cloud, youβll see output showing each step of the process: bundling files, capturing dependencies, uploading the bundle, and building the container environment. Hereβs what a successful deployment looks like:
ββ Preparing for deployment ββββββββββββββββββββββββββββββββββββββββββββββββββββ βΉ Deploying to Posit Connect Cloud βΉ Creating application on server... βΉ Created deployment with id 98765432 βΉ Bundling 68 files: .Rbuildignore, app.R, DESCRIPTION, NAMESPACE, README.md, renv.lock, inst/extdata/movies.fst, inst/prod/app/app.R, R/launch_app.R, R/mod_var_input.R, R/mod_scatter_display.R, R/scatter_plot.R, data/movies.rda, man/*.Rd, tests/testthat/*.R, and others... βΉ Capturing R dependencies βΉ Found 87 dependencies βΉ Created 2,941,205b bundle βΉ Uploading bundle... β Uploaded bundle ββ Deploying to server βββββββββββββββββββββββββββββββββββββββββββββββββββββββββ βΉ Waiting for deployment to start... βΉ Building image... βΉ Installing system dependencies... βΉ Installing R packages... βΉ Starting deployment... β Deployment succeeded! βΉ Your application is available at: https://your-workspace.connect.posit.cloud/content/abc123/
The bundling step captures all your R dependencies through renv.lock (if youβre using renv) or by scanning your code for package imports. Connect Cloud then builds a container image with those dependencies installed, ensuring your app runs the same way regardless of updates to external packages.
You can monitor your applicationβs status and view more detailed logs through the Connect Cloud dashboard.
19.4 Monitoring and managing your application
After your application is deployed, visit the Connect Cloud dashboard to monitor its status. You can view:
- Application logs: Review startup messages and runtime output to debug issues.
- Usage metrics: See how many users are accessing your app and when.
- Resource usage: Monitor CPU and memory consumption.
- Deployment history: Track previous versions and rollback if needed.
You can also update your application by redeploying from RStudio or PositronβConnect Cloud will bundle the new code and replace the running instance with the updated version.
19.5 The rsconnect folder
When you deploy with rsconnect, a rsconnect/ folder is automatically created to store deployment metadata and configuration. This folder records which account and server each app was deployed to:
rsconnect/
βββ connect.posit.cloud
βββ your_account
βββ movie-reviews.dcf
3 directories, 1 file
The .dcf file contains metadata about your deployment (app ID, account, version), but it should not be committed to Git. It contains machine-specific settings and can cause conflicts when multiple team members deploy the same app.
Add rsconnect/ to .gitignore to prevent accidental commits:
.Rproj.user
.Rhistory
.RData
.Ruserdata
.DS_Store
sap.Rcheck/
sap*.tar.gz
sap*.tgz
rsconnect/
/.quarto/
inst/doc
*_.new.pngIf rsconnect/ was already committed, remove it from Git history:
git rm -r --cached rsconnect/
git commit -m "Remove rsconnect folder from repository"
git push origin mainThis will remove it from the Git history while keeping it locally. If we need to share deployment details with our team, we can document the deployment process in the README.Rmd or create a deploy.Rmd vignette.
Recap
Deploying your app-package to Posit Connect Cloud is straightforward: configure rsconnect with your account credentials, then push your app from RStudio or Positron. Connect Cloud handles dependency management and container setup automatically.