Skip to main content

Admin: Workflow Templates

Admin

Manage the 50-template research library — publish, unpublish, seed, and monitor ResearchWorkflow templates in the marketplace.

Admin Overview#

The Workflow Templates admin surface lets administrators manage the research template marketplace. This includes publishing and unpublishing templates, monitoring usage and ratings, seeding the 50 pre-built templates into the database, and reviewing the metadata fields that drive discovery and filtering.

Template Management

View, publish, unpublish, and delete marketplace templates from the admin interface.

Seed 50 Templates

Run the seed script or API endpoint to populate the marketplace with all 50 pre-built research templates.

Rating Oversight

Monitor template ratings and purchase counts to identify underperforming or abused templates.

Template Management Page#

The admin template management page at /admin/workflow-templates shows all ResearchWorkflow records where isTemplate: true. It has two tabs: Published and Unpublished.

Publish Template

Move an approved template to the Published state, making it visible in the marketplace at /marketplace/workflows.

Unpublish Template

Remove a template from marketplace visibility without deleting it. Useful for quality issues or content review.

Edit Metadata

Update templateCategory, templateTags, publishedPrice, publishedDescription, and templatePreview for any template.

Delete Template

Permanently remove a template and all associated ratings. This action cannot be undone.

For each template in the list, the admin table shows:

ColumnField SourceNotes
NameResearchWorkflow.nameTemplate display name
CategoryResearchWorkflow.templateCategoryOne of 7 categories; used for filtering
PriceResearchWorkflow.publishedPriceShown as "$0" for free templates
TagsResearchWorkflow.templateTagsSearchable tag array
RatingResearchWorkflow.averageRatingComputed average from WorkflowTemplateRating records
UsesResearchWorkflow.purchaseCountNumber of times this template was launched
StatusResearchWorkflow.publishedStatusPUBLISHED or DRAFT
CreatedResearchWorkflow.createdAtTemplate creation date

Seeding the 50 Templates#

The 50 pre-built research templates are defined in scripts/seed-research-workflow-templates.ts and are called automatically as part of the main Prisma seed script. To populate the marketplace with all 50 templates on a fresh deployment:

1

Run the Prisma seed

Execute `npx prisma db seed` from the project root. This calls the main seed.ts which includes the research workflow templates seed.
2

Verify templates in admin

Navigate to /admin/workflow-templates. You should see 50+ templates in the Published tab (they are seeded as isPublished: true).
3

Verify marketplace

Navigate to /marketplace/workflows. Templates should appear grouped by category and searchable.

To run only the template seed (without re-running the full seed):

CategoryCountPrice Range
Competitive Intelligence10$79–$199
Market Research10$129–$249
Investment & Financial8$149–$299
Technology & Innovation8$129–$199
Marketing & Brand6$99–$149
HR & Talent5$99–$179
Strategic Planning5$149–$199
Total52$79–$299

Template Metadata Fields#

The following fields on ResearchWorkflow drive template discovery, filtering, and quality signals in the marketplace:

FieldTypePurposeUsed By
templateCategoryString?Category for sidebar filtering (one of 7 values)Marketplace sidebar, in-wizard browser, API filter
templateTagsString[]Searchable tags (e.g., "b2b", "saas", "competitor-analysis")Search, tag cloud, API filter
templatePreviewJson?WorkflowTemplatePreview object: outputSections, estimatedOutputPages, sampleInsight, agentSequence, estimatedRunTimeMinutesPreview modal in marketplace and wizard browser
purchaseCountInt (default 0)Number of times launched via run-from-wizard APIPopular sort, social proof display
averageRatingFloat?Computed from WorkflowTemplateRating records; recalculated on each new ratingTop Rated sort, star display

Valid values for templateCategory:

ValueDisplay Label
competitiveCompetitive Intelligence
marketMarket Research
investmentInvestment & Financial
technologyTechnology & Innovation
marketingMarketing & Brand
hrHR & Talent
strategyStrategic Planning

The templatePreview JSON field stores a WorkflowTemplatePreview object:

FieldTypeExample
outputSectionsstring[]["Executive Summary", "Competitor Profiles", "Gap Analysis"]
estimatedOutputPagesnumber12
sampleInsightstring"This template identifies the top 5 competitors, benchmarks pricing and features, and surfaces 3 strategic opportunities."
agentSequencestring[]["Source Collection", "Multi-Source Synthesis", "Verification", "Format"]
estimatedRunTimeMinutesnumber5

Rating System#

Users can submit one rating (1–5 stars, optional text) per template after a completed workflow run. Ratings are stored in the WorkflowTemplateRating model and the template's averageRating is recalculated on every new submission.

ScenarioAdmin Action
Template rated falsely / spam reviewsDelete individual ratings via Prisma Studio or direct DB query on workflow_template_ratings table
Template consistently rated < 3 starsUnpublish from admin page; investigate quality issues; re-publish after improvement
averageRating not updatingCheck /api/marketplace/workflows/[id]/rate route; verify averageRating recalculation logic
purchaseCount seems offpurchaseCount increments on each call to POST /api/research/workflows/run-from-wizard — check for duplicate requests or errors in that route

Database Models#

The Workflow Templates feature uses these database models:

ModelTablePurposeGrowth Pattern
ResearchWorkflow (extended)research_workflowsTemplate records with templateCategory, templateTags, templatePreview, purchaseCount, averageRatingOne record per template; admin-curated or user-submitted
ResearchWorkflowRun (extended)research_workflow_runsStores wizardSessionId and wizardInput JSON for runs triggered from wizardGrows with each workflow launch
WorkflowTemplateRatingworkflow_template_ratingsUser ratings (1–5) with optional reviews; unique per user+templateGrows with marketplace activity

The WorkflowTemplateRating model has the following schema:

FieldTypeNotes
idString (cuid)Primary key
templateIdStringFK → research_workflows.id (cascade delete)
userIdStringFK → User.id (cascade delete)
ratingInt1–5 inclusive
reviewString?Optional text review
createdAtDateTimeSubmission timestamp

API Endpoints#

Admin-relevant API endpoints for the Workflow Templates feature:

MethodRoutePurposeAuth
GET/api/admin/workflow-templatesList all templates with status filterAdmin only
PATCH/api/admin/workflow-templates/[id]Update template (publish/unpublish/edit metadata)Admin only
DELETE/api/admin/workflow-templates/[id]Permanently delete templateAdmin only
POST/api/research/workflows/run-from-wizardLaunch template with wizard context; increments purchaseCountAuthenticated user
POST/api/marketplace/workflows/[id]/rateUpsert rating; recalculates averageRatingAuthenticated user
GET/api/research/workflows/runs/[runId]/statusPoll run status for progress trackerAuthenticated user
GET/api/marketplace/workflowsList published templates with category/tag/sort filtersPublic

The marketplace workflows API accepts these query parameters for template discovery:

ParameterValuesNotes
categorycompetitive, market, investment, technology, marketing, hr, strategyFilters by templateCategory
sortpopular, top-rated, newest, price-asc, price-descpopular → ORDER BY purchaseCount DESC; top-rated → ORDER BY averageRating DESC
searchany stringFull-text search on name and publishedDescription
minPrice / maxPricenumberFilter by publishedPrice range
page / limitnumberPagination (default limit: 12)

Monitoring#

Key metrics to watch for the Workflow Templates feature:

MetricWhere to CheckHealthy SignalAction If Abnormal
Template count in marketplaceAdmin /admin/workflow-templates Published tab50+ templates visibleRun seed script if count < 50
purchaseCount per templateAdmin templates tableGrowing over time; competitive templates leadInvestigate if count stuck at 0 after launch
averageRating distributionAdmin templates tableMajority of templates ≥ 4.0 starsUnpublish templates rated < 3.0 consistently
run-from-wizard API error rateServer logs< 1% error rateCheck orchestrator.ts and ResearchWorkflowRun creation
WorkflowTemplateRating growthworkflow_template_ratings table row countGrowing proportionally with purchaseCountIf near 0, check rate API and post-run UX
Seed idempotencyTemplate count after re-runCount unchangedCheck upsert logic in seed script if duplicates appear

Success Metric

Target: ≥ 15% of Step 5 wizard users choose 'Run as Workflow' within 60 days of launch.

Template Adoption

Target: ≥ 40% of 'Run as Workflow' sessions use a marketplace template (not a blank workflow).