1.3 KiB
Tip #16 — Bulk-Import recipes from CSV
Date: 2026-06-27
Category: editor
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.
Bulk-Import recipes from CSV
Bulk CSV import is a single server function that streams rows from an uploaded file, validates each recipe, and lets the admin dry-run before writing anything to the database. It solves the cold-start problem of seeding 500+ recipes by hand, which is the single biggest blocker between 'empty wiki' and 'useful wiki'. The signal is that the project is still in early content phase — we know the data shape, but the row count required to be useful is too high for a click-by-click editor. A dry-run mode is non-negotiable: admins need to see '487 ok, 13 errors' before they commit, otherwise a bad column mapping will silently destroy data.
Implementation tips
- Single new server function importRecipesFromCSV(file) that streams rows, validates each, returns {ok, errors[]}.
- Dry-run mode first: 'would import 487, 13 have errors' — no DB writes until user confirms.
- Use a small CSV parser (papaparse is already common in the JS world, lightweight).