A sample Shiny app written in R that runs natively on Databricks Apps — deployed via DABs (Databricks Asset Bundles).
Databricks Apps instances are shipped with Python and uv, but unfortunately doesn't have a preinstalled R runtime.
This project shows how to use a lightweight Python launcher that bootstraps an R environment at startup using micromamba, then hands off execution to a Shiny app.
Databricks App Instance
=========================
uv run scripts/launcher.py
|-- 1. Downloads micromamba
|-- 2. Creates conda env from environment.yml
|-- 3. Installs R + packages
'-- 4. Starts Shiny app via Rscript
app/app.R --> serves on $DATABRICKS_APP_PORT
The Shiny app queries Databricks SQL using the forwarded user token (HTTP_X_FORWARDED_ACCESS_TOKEN), so each user sees data scoped to their own permissions.
├── app/
│ └── app.R # Shiny app (UI + server)
├── scripts/
│ └── launcher.py # Python bootstrap script
├── environment.yml # Conda env: R + packages
└── databricks.yml # DABs bundle definition
- Databricks CLI installed and authenticated
- A Databricks SQL Warehouse ID
- Access to a Databricks workspace
1. Validate the bundle
databricks bundle validate2. Deploy to your workspace
databricks bundle deploy -var="sql_warehouse_id=<YOUR_WAREHOUSE_ID>"3. Launch the app
databricks bundle run shiny-app-rThat's it — the app will be live on your workspace's Apps URL. 🎉
The bundle is defined in databricks.yml. Key settings:
| Setting | Value |
|---|---|
| App name | shiny-app-r |
| Start command | uv run scripts/launcher.py |
| User API scopes | sql |
| Variable | sql_warehouse_id — passed as SQL_WAREHOUSE_ID env var |
R dependencies live in environment.yml and are installed at container startup via micromamba.
Databricks Apps handle auth automatically. The app reads the user's token from the X-Forwarded-Access-Token header injected by the Apps proxy — no secrets management needed.
- Replace
app/app.Rwith your Shiny application - Add any new R packages to
environment.yml - Update the SQL query or data source as needed
- Re-deploy with
databricks bundle deploy
