Skip to content

Invoice Template Marketplace #410

Description

@Kingsman-99

Description

Creators repeatedly build similar invoice structures from scratch without a way to discover or reuse templates that others have made public. This issue creates an invoice template marketplace at /templates/marketplace where users can publish their saved templates with a title, description, and category tag, browse and preview templates published by others, and clone a marketplace template into their own template library. The marketplace must be moderated: templates go through a brief review status before appearing publicly.

Technical Context

Add app/templates/marketplace/page.tsx as a paginated gallery using server-side rendering for SEO. Implement app/api/templates/marketplace/route.ts for GET (paginated, filterable by category) and POST (submit for review). Extend the templates data model with { isPublic, reviewStatus: 'pending'|'approved'|'rejected', publishedAt, cloneCount }. Build components/templates/MarketplaceCard.tsx displaying preview thumbnail (render invoice structure as a condensed card), creator alias, clone count, and category badge. The clone action calls POST /api/templates/[id]/clone which deep-copies the template into the requesting user's library. Add an admin-only review queue at app/admin/templates/review/page.tsx gated by a role check. Use next/image with a placeholder skeleton for card thumbnails.

Acceptance Criteria

  • Submitting a template for publication creates a pending review record and shows the creator a confirmation with review status tracking
  • The marketplace gallery renders templates with approved status only; pending and rejected templates are never visible to other users
  • Cloning a marketplace template creates an exact copy in the user's template library with a (cloned) suffix and increments the source template's cloneCount
  • Category filtering narrows the gallery in under 200 ms (server-side query, not client-side)
  • The admin review page lists pending templates with approve/reject actions that update review status and notify the submitter via the activity feed (issue 4)
  • All CI checks (npm test, npm run build, ESLint/TypeScript) pass and the branch has no merge conflicts

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions