Overview
This example demonstrates Conductor’s component system for building maintainable, reusable HTML templates with versioning, caching, and seamless updates. Key Features:- Reusable components with
template://protocol - Semantic versioning (v1.0.0, v2.0.0)
- Automatic edge caching (1 hour default)
- Atomic deployments with Edgit
- Per-version cache isolation
Project Structure
Step 1: Create Components
Header Component
Metric Card Component
Alert Component
Footer Component
Step 2: Deploy Components
Using Edgit CLI
Manual KV Storage
Step 3: Configure KV Binding
Step 4: Create Dashboard Ensemble
Step 5: Execute the Ensemble
Component Caching
Automatic Caching
All components are cached automatically:Custom Cache Configuration
For programmatic control:Updating Components
Version Updates (Zero Downtime)
Latest Pointer Updates
Performance Analysis
Without Components (Inline Templates)
- ❌ Large ensemble files
- ❌ Duplicated code
- ❌ Hard to maintain
- ❌ No versioning
- ❌ No caching
With Components
- ✅ Small ensemble files (2KB vs 15KB)
- ✅ Reusable components
- ✅ Easy maintenance
- ✅ Semantic versioning
- ✅ Edge caching (1-hour TTL)
- ✅ Atomic deployments
- ✅ Zero-downtime updates
- First load: 5ms × 4 components = 20ms
- Cached load: 0.1ms × 4 components = 0.4ms
- 50x faster after caching!
Best Practices
1. Version Pin in Production
2. Inline Component CSS
3. Semantic Versioning
4. Cache Strategy
5. Component Organization
Troubleshooting
Component Not Found
- Verify component is deployed to KV
- Check COMPONENTS binding in wrangler.toml
- Confirm version exists:
wrangler kv key list --namespace-id=...
Component Not Updating
Cause: Cache still serving old version Solutions:Slow First Load
Expected: First load fetches from KV (~5-10ms per component) Optimization:Next Steps
- Caching Guide - Advanced cache strategies
- HTML Member - Full HTML member reference
- Edgit Integration - Component versioning
- Performance Guide - Optimization techniques

