From rpw-building
Build and deploy Databricks Apps using the bash-over-REST starter template. Use when scaffolding, configuring, deploying, or iterating on Databricks Apps with Lakebase connectivity.
npx claudepluginhub randypitcherii/rpw-agent-marketplace --plugin rpw-buildingThis skill uses the workspace's default tool permissions.
Build full-stack Databricks Apps using the bash-over-REST starter template. The core pattern enables fast local iteration via `uvicorn --reload` so you never wait for multi-minute redeploys during development.
Searches, retrieves, and installs Agent Skills from prompts.chat registry using MCP tools like search_skills and get_skill. Activates for finding skills, browsing catalogs, or extending Claude.
Searches prompts.chat for AI prompt templates by keyword or category, retrieves by ID with variable handling, and improves prompts via AI. Use for discovering or enhancing prompts.
Guides MCP server integration in Claude Code plugins via .mcp.json or plugin.json configs for stdio, SSE, HTTP types, enabling external services as tools.
Build full-stack Databricks Apps using the bash-over-REST starter template. The core pattern enables fast local iteration via uvicorn --reload so you never wait for multi-minute redeploys during development.
Always start by copying the starter template into the target project directory:
# Clone the shareables repo (shallow, sparse) and copy the template
git clone --depth 1 --filter=blob:none --sparse https://github.com/randypitcherii/shareables.git /tmp/shareables-clone
cd /tmp/shareables-clone && git sparse-checkout set databricks/randy_apps_starter
cp -r databricks/randy_apps_starter/* databricks/randy_apps_starter/.* <TARGET_PROJECT_DIR>/
rm -rf /tmp/shareables-clone
Source: https://github.com/randypitcherii/shareables/tree/main/databricks/randy_apps_starter
This is mandatory. Do NOT scaffold from scratch. Do NOT write app.py, app.yaml, databricks.yml, or Makefile from memory. Copy the exact template files first, then customize. The template contains battle-tested patterns (CWD tracking, session state, streaming) that are easy to get wrong.
The starter template implements a REST API that wraps shell commands, enabling interactive terminal sessions over HTTP. This is the core architectural pattern — understand it before building anything.
make dev runs uvicorn with --reload. Code changes trigger automatic restart — no Databricks deploy needed/api/* to the local backend| Endpoint | Method | Purpose |
|---|---|---|
/api/v1/shell/run | POST | Execute bash commands, capture stdout/stderr/exit code |
/api/v1/shell/stream | POST | Streaming shell output for long-running commands |
/api/v1/shell/complete | POST | Shell tab completion |
/api/v1/healthcheck | GET | Runtime freshness check |
/api/v1/db/health | GET | Lakebase connectivity check |
/api/v1/auth/context | GET | Forwarded user and OBO token status |
Each shell request wraps the command with a CWD marker (__RCP_CWD_<uuid>__=) appended after execution. The marker is stripped from output and used to persist the working directory across requests. Session state is stored in SQLite (/tmp/randy_apps_starter_session_state.sqlite3).
# Clone the starter template
git clone https://github.com/randypitcherii/shareables.git
cd shareables/databricks/randy_apps_starter
# Start local dev server (hot-reload enabled)
make dev
# App available at http://127.0.0.1:8000
make dev Doesuv sync to install dependenciesuvicorn app:app --reload --host 127.0.0.1 --port 8000The --reload flag is the key — every code change triggers an automatic restart. Iteration is sub-second.
make test # Run pytest
make verify # Run tests + validate DAB bundles
The template uses databricks.yml for deployment configuration with dev/prod targets.
# Deploy to dev (uses branch-specific Lakebase branch)
make deploy-dev
# Deploy to prod
make deploy-prod
databricks bundle deploy -t <target> — pushes source to workspacedatabricks apps deploy <app-name> --source-code-path <path> — deploys the app| Setting | Dev | Prod |
|---|---|---|
| Root path | /Workspace/Users/<you>/.bundle/<name>/dev | /Workspace/Shared/.bundle/<name>/prod |
| Lakebase branch | dev-<git-branch-slug> | main |
| App name | Dynamic (branch-based) | Fixed |
The container runtime configuration:
command:
- bash
- -lc
- >
uv sync --frozen &&
uv run uvicorn app:app
--host 0.0.0.0
--port ${DATABRICKS_APP_PORT:-8000}
--workers ${UVICORN_WORKERS:-2}
--timeout-keep-alive ${UVICORN_TIMEOUT_KEEP_ALIVE:-5}
--timeout-graceful-shutdown ${UVICORN_TIMEOUT_GRACEFUL_SHUTDOWN:-10}
--limit-concurrency ${UVICORN_LIMIT_CONCURRENCY:-16}
--limit-max-requests ${UVICORN_LIMIT_MAX_REQUESTS:-2000}
env:
- name: DATABRICKS_OBO_ENABLED
value: "true"
- name: UVICORN_WORKERS
value: "2"
- name: SESSION_STATE_DB_PATH
value: "/tmp/randy_apps_starter_session_state.sqlite3"
Key details:
uv sync --frozen && uv run uvicorn — no requirements.txt neededDATABRICKS_APP_PORT is auto-injected by the platform (defaults to 8000 locally)When deployed to Databricks, these are automatically available:
| Variable | Value |
|---|---|
PGHOST | Auto-set by platform |
PGPORT | 5432 |
PGDATABASE | postgres |
PGSSLMODE | require |
DATABRICKS_CLIENT_ID | Service principal client ID |
DATABRICKS_CLIENT_SECRET | Service principal secret |
DATABRICKS_HOST | Workspace URL |
To authenticate the service principal with Lakebase Postgres:
user = DATABRICKS_CLIENT_ID
password = OAuth JWT from /oidc/v1/token
(Basic auth with client_id:client_secret, grant_type=client_credentials, scope=all-apis)
The service principal cannot write to the public schema. You must CREATE SCHEMA first, then use that schema for all tables.
| Target | Purpose |
|---|---|
make dev | Start local dev server with hot-reload |
make test | Run pytest |
make verify | Run tests + validate DAB bundles |
make deploy-dev | Deploy to dev target |
make deploy-prod | Deploy to prod target |
| Mistake | Why It's Wrong | Correct Approach |
|---|---|---|
| Deploying after every change | Multi-minute redeploy cycle | Use make dev for local iteration |
| Using requirements.txt | Template uses uv natively | Use pyproject.toml + uv sync |
| Writing to public schema | Service principal lacks permission | CREATE SCHEMA <name> first |
| Hardcoding workspace URLs | Breaks across environments | Use DATABRICKS_HOST env var |
Skipping --frozen in app.yaml | Non-reproducible installs | Always use uv sync --frozen in production |
| Scaffolding from scratch | Misses bash-over-REST patterns | Clone the starter template |
make dev gives sub-second feedbackmake test runs the full suite without deployingNever skip straight to deployment. The bash-over-REST pattern exists specifically to keep the inner loop fast and reliable.