brain/wiki/flows-execution/templates.md
Templates are a library of reusable flow (and table) blueprints users can browse, import, and build on. Before saving, flows inside a template are validated and their piece names extracted into a searchable pieces array.
FlowVersionTemplate[]), tables, tags, categories (indexed text[]), pieces (indexed text[]).OFFICIAL (AP-curated, platformId=null), CUSTOM (platform-owned, needs manageTemplatesEnabled), SHARED (ad-hoc share URL, not listable).PUBLISHED (visible) or ARCHIVED (hidden).template.service.ts (CRUD + list), template-validator.ts, community-templates.service.ts, EE platform-template.service.ts./v1/templates: GET /categories, GET /:id, GET / (public list, official + custom merged), POST /, POST /:id, DELETE /:id (platform-owner only).https://cloud.activepieces.com/api/v1/templates via communityTemplates.pieces, ArrayContains for categories, ILIKE for search. Only PUBLISHED templates returned.FlowVersionTemplate is a flow version stripped of runtime-only fields (id, flowId, state) for embedding.manageTemplatesEnabled plan flag (off by default in CE). When disabled, custom listing is skipped silently — returns empty array, no error.template.platformId === principal.platform.id).migrateFlowVersionTemplateList) runs as a preValidation hook on create/update to handle schema evolution in stored flows.pieces and categories are denormalized + indexed for fast filtering.CE/EE proxy official templates from cloud; custom needs manageTemplatesEnabled. Cloud stores official in DB directly; custom needs manageTemplatesEnabled.
Entry point: templateController, registered in template.module.ts under the /v1/templates prefix.
packages/server/api/src/app/template/ — controller, module, service, entity, validator, and the community-templates cloud proxypackages/server/api/src/app/ee/template/platform-template.service.ts — EE only, creates and updates CUSTOM templates for a platformpackages/core/shared/src/lib/management/template/ — shared types and request schemas (Template, TemplateType, TemplateStatus, FlowVersionTemplate, TableTemplate, TemplateTag, the Create/Update/List request bodies)packages/web/src/features/templates/api/ — frontend API clientpackages/web/src/features/templates/components/ — browse dialog, use-template import dialog, share dialog, explore cardpackages/web/src/features/templates/hooks/ — templates data hookspackages/web/src/app/routes/templates/ — public-facing template gallery pagePaths verified 2026-07-17.