Building Project Templates - A Practical Guide
This guide walks you through the practical aspects of building project templates in Kodexa. For detailed reference documentation on the complete structure and all available properties, see Project Template Structure Reference.Table of Contents
- Quick Start
- Design Principles
- Building Your First Template
- Common Patterns
- Advanced Techniques
- Testing and Deployment
- Troubleshooting
Quick Start
What is a Project Template?
A project template is a blueprint that defines the complete structure of a Kodexa project. When a user creates a project from a template, Kodexa instantiates all the components defined in the template: stores, assistants, taxonomies, workspaces, and more.Minimum Viable Template
The simplest project template:Template Structure Overview
Design Principles
1. Start with the User Journey
Before writing YAML, map out the user’s workflow:- Store: Raw documents (upload destination)
- Assistant: PDF parser (automatic processing)
- Workspace: Review interface
- Document Statuses: New → Processing → Review → Approved
- Data Form: Manual corrections
2. Use Variable Substitution for Uniqueness
Always use${project.id} in slugs to ensure uniqueness:
| Variable | Example | Use Case |
|---|---|---|
${project.id} | abc-123-def-456 | Unique identifiers |
${project.name} | Invoice Processing | Display names |
${project.slug} | invoice-processing | Human-readable IDs |
${orgSlug} | acme-corp | Organization context |
3. Separate Concerns by Store Purpose
4. Build Incrementally
Start minimal and add complexity as needed:- Phase 1: Single store + basic workspace
- Phase 2: Add assistant for automation
- Phase 3: Add taxonomy for classification
- Phase 4: Add data forms for manual entry
- Phase 5: Add status workflows
Building Your First Template
Scenario: Invoice Processing System
Let’s build a complete invoice processing template step by step.Step 1: Define Base Metadata
Step 2: Create Stores
Step 3: Define Document Workflow
Step 4: Create Assistant for Processing
Step 5: Add Data Form for Manual Entry
Step 6: Create Taxonomy for Classification
Step 7: Configure Workspace
Step 8: Add User Options
Complete Template
Here’s the full template assembled:Common Patterns
Pattern 1: Multi-Stage Processing Pipeline
Chain multiple assistants for sequential processing:Pattern 2: Conditional Processing with Subscriptions
Use subscription expressions to control when assistants trigger:Pattern 3: Reference Existing Components
Reuse taxonomies and other components across templates:Pattern 4: Sample Data for Testing
Include sample files in stores:Pattern 5: Pre-configured Workspaces
Create role-specific workspaces:Pattern 6: Knowledge-Driven Processing
Use knowledge sets for rule-based automation:Advanced Techniques
Dynamic Store References
Build store references dynamically:Scheduled Processing
Run assistants on a schedule:Complex Form Validation
Add sophisticated validation to data forms:Conditional Panel Visibility
Show/hide workspace panels based on project configuration:Multi-Level Taxonomies
Create deep hierarchical taxonomies:Testing and Deployment
Pre-Deployment Checklist
Before deploying your template:-
YAML Syntax: Validate YAML is well-formed
-
Variable Substitution: Check all
${...}variables are valid${project.id},${project.name},${project.slug},${orgSlug}
-
References: Verify all component references exist
- Assistant definitions:
orgSlug/assistant-name:version - Store refs:
orgSlug/store-slug:version - Taxonomy refs:
orgSlug/taxonomy-slug:version
- Assistant definitions:
- Slugs: Ensure slugs are URL-safe (alphanumeric, hyphens, underscores only)
-
Required Fields: All required properties are set
- Stores:
slug,name,storeType,storePurpose - Assistants:
name,slug,assistantDefinitionRef
- Stores:
-
Colors: Status colors are valid hex codes (
#RRGGBB) - Workspace Panels: At least one panel is enabled
- Subscription Expressions: Syntax is valid
Testing Strategy
1. Dry Run Validation
2. Create Test Project
3. Test Each Component
Test stores:- Open workspace in UI
- Verify all panels appear correctly
- Test navigation between components
4. Test Variable Substitution
Create a project and verify variables resolved correctly:5. Test Workflows
- Upload document to intake store
- Verify assistant triggers
- Check document moves through statuses
- Test data form submission
- Verify taxonomy classification works
Deployment Best Practices
Version Numbering
Use semantic versioning:- Major: Breaking changes (incompatible with previous version)
- Minor: New features (backward compatible)
- Patch: Bug fixes (backward compatible)
Deployment Command
Rolling Updates
When updating templates:- Test in staging: Deploy to test org first
- Version increment: Bump version number
- Document changes: Update changelog/release notes
- Deploy to production: Deploy to production org
- Monitor: Check new projects create successfully
Rollback Strategy
Keep previous versions available:Troubleshooting
Common Issues and Solutions
Issue: “Variable substitution not working”
Problem: Variables like${project.id} appearing literally in created projects.
Cause: Variables only resolve during project creation, not in the template itself.
Solution:
- Variables are correct if they appear in the template YAML
- Check created project to see resolved values
- Use quotes around variable strings:
"${project.id}-store"
Issue: “Assistant not triggering”
Problem: Assistant doesn’t process documents added to store. Debug steps:-
Wrong sourceRef: Verify store reference is correct
-
Subscription filter: Check subscription expression
- Remove temporarily to test without filter
-
Store access: Verify assistant has store in
storeslist
Issue: “Components not appearing in workspace”
Problem: Created stores/forms don’t show in workspace. Cause: Panels must be explicitly enabled. Solution:Issue: “Reference not found”
Problem:Component reference 'kodexa/my-assistant:1.0.0' not found
Debug:
- Deploy the referenced component first
- Use correct version number
- Check organization slug is correct
Issue: “Invalid subscription expression”
Problem:Subscription expression syntax error
Valid expression examples:
Issue: “Slug validation error”
Problem:Invalid slug format
Requirements:
- Only alphanumeric, hyphens, underscores
- No spaces or special characters
- Must start with letter or number
Issue: “Options not appearing in UI”
Problem: Defined options don’t show when creating project. Solution: Check the nestedoptions structure:
Issue: “Files not uploading to store”
Problem: Files defined infiles list don’t appear in created store.
Debug:
- URL not accessible (401, 404)
- File too large
- Invalid filename
Getting Help
Documentation Resources
- Project Template Structure Reference - Complete property reference
- Project Templates Overview - Conceptual overview
- Assistant Configuration - Assistant setup
- Working with Stores - Store configuration
API Reference
Support Channels
- Documentation: developer.kodexa.ai
- Support Email: support@kodexa.com
- Community: Kodexa Community Forums
Summary
Key Takeaways
- Start Simple: Begin with minimal viable template, add complexity incrementally
- Use Variables: Always use
${project.id}for uniqueness - Test Thoroughly: Validate, create test project, verify each component
- Document Well: Provide helpful descriptions and workspace overviews
- Version Carefully: Use semantic versioning, maintain backward compatibility
Next Steps
- Review Reference: Read the complete structure reference
- Explore Examples: Check existing templates in your organization
- Build Your Template: Start with the quick start example and customize
- Test and Deploy: Follow the testing checklist before production deployment
- Iterate: Gather user feedback and improve your template over time
