Sprinter Docs

Workspace Templates

Reusable industry-specific packs that pre-configure entity types, views, sample data, and navigation for a tenant.

Overview

Workspace templates are pre-built configurations that bootstrap a tenant with entity types, views, sample entities, and navigation in a single operation. They serve two purposes:

  1. Onboarding acceleration -- New tenants can start with a fully configured workspace instead of building from scratch
  2. Industry packs -- Domain-specific configurations (PE, manufacturing, consulting) provide best-practice data models

Key Concepts

Template Categories

Templates are organized into categories:

CategoryLabelDescription
pePrivate EquityPortfolio companies, deals, value creation
manufacturingManufacturingProduction lines, equipment, improvement projects
legalLegalReserved for future legal workflow templates
consultingConsultingEngagements, deliverables, findings
generalGeneralFlexible project/task/note workspaces

Template Scope

  • Global templates (tenant_id = NULL) -- Platform-provided, read-only, visible to all tenants
  • Tenant templates (tenant_id = <uuid>) -- Created by tenant admins, editable, visible only within the tenant

Template Contents

Each template contains JSON snapshots of:

  • Entity types -- Schema definitions including json_schema, config, icon, color
  • Views -- Block configurations and layouts linked to entity types
  • Sample entities -- Demo data pre-populated into the created entity types
  • Navigation -- Sidebar configuration overrides (reserved for future use)

How It Works

Applying a Template

When a user applies a template:

  1. Entity types are created sequentially. If a slug already exists, that type is skipped (duplicate-safe).
  2. Views are created and linked to the newly created entity types via a slug-to-ID mapping.
  3. Sample entities are optionally created. Only entities whose parent type was successfully created are included.
  4. The operation is additive -- existing data is never modified or deleted.

Architecture

Admin UI (templates-admin.tsx)
  -> REST API (/api/workspace-templates/*)
    -> Server Actions (features/templates/server/actions.ts)
      -> Supabase (workspace_templates table)
      -> Entity Type Actions (createEntityType)
      -> View Actions (createView)
      -> Entity Actions (createEntity)

API Reference

Server Actions

FunctionDescription
listTemplates()Returns global + tenant templates, ordered by featured status then name
getTemplate(id)Returns a single template by ID, or null
createTemplate(input)Creates a tenant-scoped template
updateTemplate(id, input)Updates a tenant-owned template (global templates are immutable)
deleteTemplate(id)Deletes a tenant-owned template
applyWorkspaceTemplate(id, options?)Applies a template to the current tenant

REST API

MethodPathAuthDescription
GET/api/workspace-templatesAdminList templates
POST/api/workspace-templatesAdminCreate template
PATCH/api/workspace-templates/[id]AdminUpdate template
DELETE/api/workspace-templates/[id]AdminDelete template
POST/api/workspace-templates/[id]/applyAdminApply template

Types

  • TemplateCategory -- Union of category string literals
  • TemplateEntityType -- Entity type snapshot embedded in a template
  • TemplateView -- View snapshot with block configs
  • TemplateSampleEntity -- Sample entity with typeSlug, title, content
  • WorkspaceTemplateRecord -- Full database row type
  • CreateWorkspaceTemplateInput -- Input for creating a template
  • ApplyTemplateResult -- Result counts from applying a template

Database

workspace_templates table

ColumnTypeDescription
iduuidPrimary key
tenant_iduuid (nullable)NULL for global templates, tenant UUID for tenant-scoped
nametextDisplay name
slugtextURL-safe identifier, unique per tenant scope
descriptiontextOptional description
icontextLucide icon name
categorytextTemplate category
entity_typesjsonbArray of entity type snapshots
viewsjsonbArray of view snapshots
sample_entitiesjsonbArray of sample entity snapshots
navigationjsonbNavigation config overrides
is_featuredbooleanWhether to show prominently
created_byuuidUser who created the template

RLS Policies

  • Global templates are readable by anyone
  • Tenant templates are readable/writable by tenant members
  • Service role has full access for seeding

For Agents

Agents do not currently have direct tool access to workspace templates. Template management is an admin-only operation performed through the UI or API.

Design Decisions

  1. Additive-only apply -- Templates never modify existing data. This prevents accidental overwrites and makes the operation safe to retry.
  2. Slug-based dedup -- Entity types are matched by slug during apply. If a slug already exists, it is skipped rather than throwing an error.
  3. Global templates are immutable -- Platform-provided templates cannot be modified by tenants. This ensures consistency across deployments.
  4. JSON snapshots over references -- Templates store full entity type definitions as JSON rather than referencing live entity types. This makes templates portable and version-independent.

On this page