Dev Mode for Templates
Enable hot-reloading during template development
Dev Mode for Templates
Dev mode enables hot-reloading during template development. Instead of building Docker images on every change, the coordinator reads template files directly from your filesystem.
When to Use Dev Mode
- Rapid iteration - No rebuild needed between code changes
- Live debugging - See changes instantly
- Template development - Writing and testing new templates
How It Works
| Mode | Build Required | Code Updates | Use Case |
|---|---|---|---|
| Normal | Yes (Docker build) | Rebuild required | Testing final result |
| Dev | No | Hot-reload | Active development |
Normal Mode: code ──► docker build ──► container ──► outputDev Mode: code ──────────────────────────────────► output
Setup
1. Add Dev Configuration
Add a dev section to your cyan.yaml:
cyan.yaml
username: myusername: my-templatedescription: My template# ... other fields ...dev:blob_path: ./cyantemplate_url: http://localhost:5550
See Dev Configuration Reference for complete field documentation.
2. Start Template Server
Run your template locally with hot-reload:
cd cyanbun installbun run --watch index.ts
cd cyanpip install -r requirements.txtpython index.py
For hot-reload, use a file watcher:
pip install watchdogwatchmedo auto-restart -d . -p "*.py" -- python index.py
cd cyandotnet watch run
3. Run Try with Dev Flag
cyanprint try template . ./output --dev
Development Workflow
Typical Dev Cycle
- Start the template server locally
- Run
cyanprint try template . ./output --dev - Answer the template prompts
- Review generated output
- Edit template code
- Repeat from step 2
Example Session
# Terminal 1: Start template servercd cyan && bun run --watch index.ts# Terminal 2: Run try commandcyanprint try template . ./output --dev# ... answer prompts ...ls ./output# Make changes to index.ts# Server auto-restarts# Run againrm -rf ./outputcyanprint try template . ./output --dev
Comparison: Normal vs Dev Mode
Normal Mode
cyanprint try template . ./output
- Builds Docker images
- Full isolation
- Slower iteration
- Tests production-like behavior
Dev Mode
cyanprint try template . ./output --dev
- No Docker build
- Direct filesystem access
- Fast iteration
- Requires local template server
Dev mode skips the Docker build step. Always test in normal mode before publishing to ensure your template works correctly in production.
Troubleshooting
Template Server Not Running
Error: Failed to connect to template at http://localhost:5550
Solution: Start your template server before running the try command.
Blob Path Not Found
Error: Blob path does not exist: ./cyan
Solution: Ensure dev.blob_path in cyan.yaml points to the correct directory.
Next Steps
- Dev Configuration - Full dev config reference
- Test Locally - Normal mode testing
- Push to Registry - Publish your template
- Template Reference - Full cyan.yaml specification