Template system¶
DataRobot templates are pre-configured application scaffolds that help you quickly build and deploy custom applications to DataRobot. Each template includes:
- Application source code
- Configuration prompts
- Environment setup tools
- Task definitions
- ドキュメンテーション
ドキュメンテーション¶
Core concepts¶
-
Template structure: How templates are organized.
- Repository layout
- Metadata files
- Multi-component templates
- ベストプラクティス
-
Interactive configuration: The configuration wizard.
- Prompt system architecture
- Input types (text, selection, multi-select)
- Conditional prompts
- Validation and error handling
-
Environment variables: Managing .env files.
- .env.template format
- Variable types (required, optional, secret)
- セキュリティのベストプラクティス
- Advanced features
クイックスタート¶
Using a template¶
# List available templates
dr templates list
# Interactive setup (recommended)
dr templates setup
# Manual setup
dr templates clone my-template
cd my-template
dr dotenv setup
dr run dev
Create a template¶
# 1. Create structure
mkdir my-template
cd my-template
# 2. Add metadata
mkdir .datarobot
cat > .datarobot/prompts.yaml <<EOF
prompts:
- key: "app_name"
env: "APP_NAME"
help: "Enter your application name"
EOF
# 3. Create environment template
cat > .env.template <<EOF
APP_NAME=
DATAROBOT_ENDPOINT=
EOF
# 4. Add tasks
cat > Taskfile.gen.yaml <<EOF
version: '3'
tasks:
dev:
desc: Start development server
cmds:
- "echo "Starting {{.APP_NAME}}"
EOF
# 5. Test it
dr templates setup
Template types¶
Single-page applications¶
Create simple applications with one component.
my-spa-template/
├── .datarobot/
│ └── prompts.yaml
├── src/
├── .env.template
└── Taskfile.gen.yaml
Full-stack applications¶
Create applications with multiple components.
my-fullstack-template/
├── .datarobot/
│ └── prompts.yaml
├── backend/
│ ├── .datarobot/
│ │ └── prompts.yaml
│ └── src/
├── frontend/
│ ├── .datarobot/
│ │ └── prompts.yaml
│ └── src/
└── .env.template
Microservices¶
Use multiple independent services:
my-microservices-template/
├── .datarobot/
├── service-a/
│ ├── .datarobot/
│ └── src/
├── service-b/
│ ├── .datarobot/
│ └── src/
└── docker-compose.yml
Common patterns¶
Database configuration¶
prompts:
- key: "use_database"
help: "Enable database?"
options:
- name: "Yes"
requires: "database_config"
- name: "No"
- key: "database_url"
section: "database_config"
env: "DATABASE_URL"
help: "Database connection string"
Feature flags¶
prompts:
- key: "enabled_features"
env: "ENABLED_FEATURES"
help: "Select features to enable"
multiple: true
options:
- name: "Analytics"
value: "analytics"
- name: "Monitoring"
value: "monitoring"
認証¶
prompts:
- key: "auth_provider"
env: "AUTH_PROVIDER"
help: "Select authentication provider"
options:
- name: "OAuth2"
value: "oauth2"
requires: "oauth_config"
- name: "SAML"
value: "saml"
requires: "saml_config"
ベストプラクティス¶
Clear documentation¶
Includes a README file with:
- A quickstart guide
- Available tasks
- 設定オプション
- Deployment instructions
Sensible defaults¶
Provide defaults in .env.template:
# Good defaults for local development
PORT=8080
DEBUG=true
LOG_LEVEL=info
Helpful prompts¶
Use descriptive help text:
prompts:
- key: "database_url"
help: "PostgreSQL connection string (format: postgresql://user:pass@host:5432/dbname)"
Organized structure¶
Keep related files together.
src/
├── api/ # API endpoints
├── models/ # Data models
├── services/ # Business logic
└── utils/ # Utilities
Security first¶
Follow the security guidelines below.
- Never commit
.envfiles. - Use strong secrets.
- Restrict file permissions.
- Mask sensitive values.
例¶
Browse the DataRobot template gallery to view example templates:
- python-streamlit: Streamlit dashboard
- react-frontend: React web application
- fastapi-backend: FastAPI REST API
- full-stack-app: complete web application