LogoCyanPrint

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

ModeBuild RequiredCode UpdatesUse Case
NormalYes (Docker build)Rebuild requiredTesting final result
DevNoHot-reloadActive development
Normal Mode: code ──► docker build ──► container ──► output
Dev Mode: code ──────────────────────────────────► output

Setup

1. Add Dev Configuration

Add a dev section to your cyan.yaml:

cyan.yaml
username: myuser
name: my-template
description: My template
# ... other fields ...
dev:
blob_path: ./cyan
template_url: http://localhost:5550

See Dev Configuration Reference for complete field documentation.

2. Start Template Server

Run your template locally with hot-reload:

cd cyan
bun install
bun run --watch index.ts
cd cyan
pip install -r requirements.txt
python index.py

For hot-reload, use a file watcher:

pip install watchdog
watchmedo auto-restart -d . -p "*.py" -- python index.py
cd cyan
dotnet watch run

3. Run Try with Dev Flag

cyanprint try template . ./output --dev

Development Workflow

Typical Dev Cycle

  1. Start the template server locally
  2. Run cyanprint try template . ./output --dev
  3. Answer the template prompts
  4. Review generated output
  5. Edit template code
  6. Repeat from step 2

Example Session

# Terminal 1: Start template server
cd cyan && bun run --watch index.ts
# Terminal 2: Run try command
cyanprint try template . ./output --dev
# ... answer prompts ...
ls ./output
# Make changes to index.ts
# Server auto-restarts
# Run again
rm -rf ./output
cyanprint 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