deploy-shiny-app
About
This skill deploys Shiny applications to shinyapps.io, Posit Connect, or Docker containers. It handles configuration, manifest generation, Dockerfile creation, and deployment verification. Use it to publish apps for users, move from local development to hosted environments, or containerize apps for deployment pipelines.
Quick Install
Claude Code
Recommendednpx skills add pjt222/agent-almanac -a claude-code/plugin add https://github.com/pjt222/agent-almanacgit clone https://github.com/pjt222/agent-almanac.git ~/.claude/skills/deploy-shiny-appCopy and paste this command in Claude Code to install this skill
Documentation
Deploy Shiny App
Shiny app → shinyapps.io / Posit Connect / Docker.
Use When
- Publish Shiny → users
- Local → hosted env
- Containerize → K8s/Docker
- Auto deploy pipelines
In
- Required: App path
- Required: Target (shinyapps.io / Posit Connect / Docker)
- Optional: Account + token
- Optional: Instance size
- Optional: Custom domain/URL
Do
Step 1: Prep app
Self-contained + deployable:
# Check for missing dependencies
rsconnect::appDependencies("path/to/app")
# For golem apps, ensure DESCRIPTION lists all Imports
devtools::check()
# Verify the app runs cleanly
shiny::runApp("path/to/app")
Files:
app.R(orui.R+server.R)renv.lock(recommend reproducible).Rprofiledoes NOT callmcptools::mcp_session()in prod
→ App runs locally clean + all deps captured.
If err: appDependencies() missing pkgs → install + update renv.lock. Sys libs (gdal, curl) → note for Docker path.
Step 2a: shinyapps.io
# One-time account setup
rsconnect::setAccountInfo(
name = "your-account",
token = Sys.getenv("SHINYAPPS_TOKEN"),
secret = Sys.getenv("SHINYAPPS_SECRET")
)
# Deploy
rsconnect::deployApp(
appDir = "path/to/app",
appName = "my-app",
appTitle = "My Application",
account = "your-account",
forceUpdate = TRUE
)
Creds → .Renviron (never code):
# .Renviron
SHINYAPPS_TOKEN=your_token_here
SHINYAPPS_SECRET=your_secret_here
→ Deployed at https://your-account.shinyapps.io/my-app/.
If err: Auth fail → regen tokens at dashboard > Account > Tokens. Pkg install fail → CRAN only default, not GitHub.
Step 2b: Posit Connect
# Register server (one-time)
rsconnect::addServer(
url = "https://connect.example.com",
name = "production"
)
# Authenticate (one-time)
rsconnect::connectApiUser(
account = "your-username",
server = "production",
apiKey = Sys.getenv("CONNECT_API_KEY")
)
# Deploy
rsconnect::deployApp(
appDir = "path/to/app",
appName = "my-app",
server = "production",
account = "your-username"
)
→ Deployed on Connect instance.
If err: Server rejects → verify API key + URL. Pkg install fail → check Connect repo access (CRAN, internal).
Step 2c: Docker
Dockerfile:
FROM rocker/shiny-verse:4.4.0
# Install system dependencies
RUN apt-get update && apt-get install -y \
libcurl4-openssl-dev \
libssl-dev \
libxml2-dev \
&& rm -rf /var/lib/apt/lists/*
# Install R packages
RUN R -e "install.packages(c('shiny', 'bslib', 'DT', 'plotly'))"
# Copy app
COPY . /srv/shiny-server/myapp/
# Configure Shiny Server
COPY shiny-server.conf /etc/shiny-server/shiny-server.conf
# Expose port
EXPOSE 3838
# Run
CMD ["/usr/bin/shiny-server"]
shiny-server.conf:
run_as shiny;
server {
listen 3838;
location / {
site_dir /srv/shiny-server/myapp;
log_dir /var/log/shiny-server;
directory_index on;
}
}
Build + run:
docker build -t myapp:latest .
docker run -p 3838:3838 myapp:latest
→ http://localhost:3838.
If err: Build fail on pkg install → add sys libs to apt-get install. App no load → docker exec <container> cat /var/log/shiny-server/*.log.
Step 3: Verify
# Check the deployed URL responds
response <- httr::GET("https://your-app-url/")
httr::status_code(response) # Should be 200
# For Docker
response <- httr::GET("http://localhost:3838/")
httr::status_code(response)
Manual checklist:
- Loads clean
- Interactive els respond
- Data conns work in prod
- Auth works (if applicable)
→ HTTP 200 + all features work.
If err: Server logs per platform. Common: env vars not set in prod, DB conns using localhost, local-only file paths.
Step 4: Monitoring (optional)
shinyapps.io
Dashboard: https://www.shinyapps.io/admin/#/applications.
Posit Connect
# Check deployment status via API
connectapi::connect(
server = "https://connect.example.com",
api_key = Sys.getenv("CONNECT_API_KEY")
)
Docker
Health check:
HEALTHCHECK --interval=30s --timeout=10s --retries=3 \
CMD curl -f http://localhost:3838/ || exit 1
→ Monitoring configured.
If err: Health intermittent → increase timeout. Shiny slow initial load.
Check
- Deploys clean
- URL HTTP 200
- Interactive features work
- Env vars/secrets config'd (not hardcoded)
- Creds →
.Renviron/ CI secrets - renv.lock committed
Traps
- Hardcoded paths: →
system.file()or env vars - Dev-only deps: Don't deploy
.Rprofilew/mcptools::mcp_session()ordevtools. Conditional load or separate profiles. - Missing sys libs in Docker: sf, curl, xml2 need sys libs →
apt-get install - CRAN-only on shinyapps.io: GH pkgs need
remotes+ explicit install - Forgotten env vars: DB creds, API keys config'd in deploy env separate from code
→
scaffold-shiny-app— app structure before deploycreate-r-dockerfile— Docker config for Rsetup-docker-compose— multi-container w/ DBssetup-github-actions-ci— CI/CD auto deployoptimize-shiny-performance— perf tune pre-prod
GitHub Repository
Related Skills
content-collections
MetaThis skill provides a production-tested setup for Content Collections, a TypeScript-first tool that transforms Markdown/MDX files into type-safe data collections with Zod validation. Use it when building blogs, documentation sites, or content-heavy Vite + React applications to ensure type safety and automatic content validation. It covers everything from Vite plugin configuration and MDX compilation to deployment optimization and schema validation.
polymarket
MetaThis skill enables developers to build applications with the Polymarket prediction markets platform, including API integration for trading and market data. It also provides real-time data streaming via WebSocket to monitor live trades and market activity. Use it for implementing trading strategies or creating tools that process live market updates.
creating-opencode-plugins
MetaThis skill helps developers create OpenCode plugins that hook into 25+ event types like commands, files, and LSP operations. It provides the plugin structure, event API specifications, and implementation patterns for JavaScript/TypeScript modules. Use it when you need to intercept, monitor, or extend the OpenCode AI assistant's lifecycle with custom event-driven logic.
sglang
MetaSGLang is a high-performance LLM serving framework that specializes in fast, structured generation for JSON, regex, and agentic workflows using its RadixAttention prefix caching. It delivers significantly faster inference, especially for tasks with repeated prefixes, making it ideal for complex, structured outputs and multi-turn conversations. Choose SGLang over alternatives like vLLM when you need constrained decoding or are building applications with extensive prefix sharing.
