# Tip #34 — User-Comments on recipes **Date:** 2026-07-15 **Category:** social **Source:** MC-Survival Wiki Daily Tip (backfilled from state.json) **Note:** *Title was truncated in the original state.json log. Body matches the 'Search-Synonyms alias table' variant of the same idea.* ## User-Comments on recipes A comments feature is a Comment { id, userId, recipeId, body, parentId? } Prisma model with threaded replies, markdown rendering with sanitization, and moderator soft-delete. It solves the dead-wiki problem: a read-only wiki is a one-time-visit resource, and the lowest-effort social loop that turns visitors into a community is the comment thread. The signal is engagement analytics — wikis without comments have a return-visit rate that decays sharply, while wikis with active threads pull users back multiple times per week. Sanitization with DOMPurify or rehype-sanitize is non-negotiable, since markdown from anonymous users is a known XSS vector. ## Implementation tips 1. New Prisma model: Comment { id, userId, recipeId, body, parentId?, createdAt } — threaded via parentId. 2. Markdown rendering with sanitization (DOMPurify or rehype-sanitize) — never trust user input raw. 3. Admin can soft-delete with a 'removed by moderator' placeholder so the thread keeps structure.