dominodatalab/domino-ai-plugin / skills/domino-app-init
domino-app-init
VerifiedScaffold a new Domino-ready web application (Vite + React, Streamlit, Dash, Flask, Gradio or FastAPI) with the settings Domino's reverse proxy needs, the mandatory 0.0.0.0:8888 binding, DOMINO_RUN_HOST_PATH prefixes, server-side model endpoint calls, and an app.sh entry point. Use when the user wants to start, initialize, create or scaffold a new app to publish on Domino, or asks for a starter app.sh or starter app for a web framework on Domino.
Initialize a Domino App
Applies to Domino 6.3 and Domino Cloud.
Create a web application that works behind Domino's reverse proxy on the first publish.
Every App must be idempotent: it restarts at any time and can run as several replicas at once, so app.sh only starts the server (migrate and seed in a Job), each write is an upsert or carries an idempotency key under a unique constraint, so a retry stores it once, and state lives in a Dataset or database (details).
Inputs
Collect these before writing files. Skip any the user has already given.
- Framework:
vite-react(default),streamlit,dash,flask,gradioorfastapi. - Project name: app folder name and
package.jsonname (React only). - Model endpoint integration: whether the app calls a Domino endpoint. If yes, the call goes through backend code and the user sets
MODEL_API_URLandMODEL_API_TOKENas Domino Project variables, never in the repository. The URL comes from the user; the token is the user's or one you create and store (FRAMEWORKS.md).
If the target directory already contains an app, stop and ask before overwriting anything.
Steps
-
Copy the matching template from this skill's
assets/folder into the project:Framework Files to copy vite-reactFrom assets/vite-react/:vite.config.js,app.sh,server.js,scripts/build-dist.sh,scripts/stamp.sh,.env.example,.dominoignore(runnpm create vite@9.3.4first if there is no Vite project yet;server.jsneeds no packages)streamlitassets/streamlit/app.sh, andassets/streamlit/app.py.templatesaved asapp.pydashassets/dash/app.sh, andassets/dash/app.py.templatesaved asapp.pyflask,gradio,fastapiNo template; write the files from the snippets below -
Make
app.shandscripts/*.shexecutable (chmod +x) and commit the mode (git update-index --chmod=+x app.sh). -
Keep these invariants in every generated file:
- Bind
0.0.0.0on port8888. Domino requires both; an App on any other address or port fails to start. - Where the framework needs its base path, read
DOMINO_RUN_HOST_PATH(Dashrequests_pathname_prefix, Gradioroot_path). Never build the prefix from project owner, name and run ID. - Use relative URLs for assets and API calls. For Vite set
base: './', useHashRouter, and make this the first line of<head>inindex.html(the App URL also answers without its trailing slash):<script>if (!location.pathname.endsWith('/')) location.replace(location.pathname + '/' + location.search + location.hash)</script>. - Identify the viewer from the
Authorizationtoken, notdomino-usernamealone (viewer.pyin FRAMEWORKS.md). - Secrets stay on the server: no token in a
VITE_variable, no token in the repo. - Vite:
app.shnever installs or builds; it serves a dated buildscripts/build-dist.shmade (why).
- Bind
-
Add
.env,.env.local,node_modules/,build/anddist/to.gitignore; keep.env.example. In a DFS Project addnode_modules/andbuild/to the.dominoignoreat the Project root (Domino reads only that one). -
Check that the framework is in the Compute Environment. The App runs in the project's environment, without what you
pip installin a Workspace (streamlit: not found, exit 127). Runpython -c "import streamlit"(ordash,flask,gradio,fastapi). Vite: the App needsnode18+, the build Node 20.19+ with npm (REACT-VITE-GUIDE.md). If missing: an environment with the package (best),requirements.txtat the project root, orpip installinapp.shfor a prototype (trade-offs). -
Finish with the post-initialization checklist.
Reference snippets
Dash: app.py (Dash 3 removed run_server)
import os
from dash import Dash, html
app = Dash(__name__, routes_pathname_prefix="/",
requests_pathname_prefix=os.environ.get("DOMINO_RUN_HOST_PATH"))
app.layout = html.Div([html.H1("Domino Dash App")])
if __name__ == "__main__":
app.run(host="0.0.0.0", port=8888, debug=False)
Flask: app.py and app.sh
from flask import Flask, request
from viewer import viewer_name # viewer.py from domino-apps/FRAMEWORKS.md
app = Flask(__name__)
@app.route("/")
def index():
return f"Hello {viewer_name(request.headers) or 'viewer'}"
if __name__ == "__main__":
app.run(host="0.0.0.0", port=8888, debug=False)
#!/bin/bash
set -e
cd "$(dirname "$0")"
python app.py
Gradio: app.py (same app.sh as Flask)
import os
import gradio as gr
demo = gr.Interface(fn=lambda text: text, inputs="text", outputs="text")
if __name__ == "__main__":
demo.launch(server_name="0.0.0.0", server_port=8888,
root_path=os.environ.get("DOMINO_RUN_HOST_PATH", ""))
FastAPI: app.py and app.sh
from fastapi import FastAPI
app = FastAPI()
@app.get("/")
def index():
return {"message": "Domino FastAPI App"}
#!/bin/bash
set -e
cd "$(dirname "$0")"
uvicorn app:app --host 0.0.0.0 --port 8888
Model endpoint call (any Python framework)
import os, requests
token = os.environ["MODEL_API_TOKEN"]
resp = requests.post(os.environ["MODEL_API_URL"], auth=(token, token), # synchronous endpoint
json={"data": {"feature1": 1.0}}, timeout=60)
Asynchronous endpoints take Authorization: Bearer instead.
Post-initialization checklist
Tell the user to:
- Set
MODEL_API_URLandMODEL_API_TOKEN(if used) in the project's environment variables (see Inputs for where each comes from). - Make sure the framework is in the App's environment (step 5), not only the Workspace.
- Build, then sync, before publishing. Vite:
bash scripts/build-dist.sh(DIST_DIR=distin a DFS Project) after every code change. An App runs the project's committed files, not the Workspace's working copy. DFS project: File Changes > Sync to Domino (or the bundled MCP server's upload tool), then checkapp.shandapp.pyunder Code. Git-based:git add,git commit,git push, then Sync All Changes to save a Vite build in/mnt/artifacts. Over the API, pincontent.dfsCommitIdto the uploaded commit (API-APPS.md). - Optional: check that it starts, on another port (8888 is the IDE's): FRAMEWORKS.md. Keep 8888 in
app.sh. - Open App Preview in the workspace, select
app.sh, and test: it runs the latest committed code in the real App runtime with the proxy prefix. - Publish App with the build label (Vite) in the Version Notes, then Deploy the version from the App details page and set sharing.
More: domino-apps (deploy, CI/CD, frameworks), domino-debug-proxy (404s, blank pages, routing), domino-ui-bootstrap (design system).
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack." | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |