recipe-manager/TODO.md

5.0 KiB

TODO — Recipe Manager

Last Updated: 2026-03-25
Current Milestone: v1.0 — Recipe Import


MVP (v0.1) Status

MVP is functionally complete (core app + docs + tests).

Completed

  • Backend API (recipes + tags)
  • Frontend UI (list/detail/form/cook mode)
  • Search + tag management + error handling
  • Dockerfiles + docker-compose
  • API docs + user guide + README setup
  • ADR-001 (sql.js decision)

Deferred / Manual Host Validation

  • Manual Docker host test (docker compose up) on host machine with Docker installed

🎯 Active Tasks — v1.0 Recipe Import

Phase 1: URL Import Foundation

  • Add backend import endpoint: POST /api/import/url
  • Implement Schema.org Recipe JSON-LD parser service
  • Normalize parsed recipe into internal Recipe draft format
  • Add import endpoint tests (valid recipe page, non-recipe page, malformed JSON-LD)

Phase 2: Import UI

  • Add “Import from URL” UI page/form in frontend
  • Show parsed preview (title, ingredients, steps, source URL)
  • Allow edit-before-save flow, then save to existing create recipe API
  • Add frontend error states (invalid URL, parse failure, timeout)

Phase 3: Fallback Parsing + Hardening

  • Add heuristic fallback parser when Schema.org missing
  • Add timeout/retry + user-friendly import failure messages
  • Add logging/telemetry for import success/failure reasons

Phase 4: Browser Extension (after URL import stable)

  • Scaffold browser extension project (Manifest v3)
  • Add “Send to Recipe Manager” action to call import API
  • Add extension settings for Recipe Manager base URL

🚀 High Priority Improvements (Post-code-review)

Phase 1: Configuration & Reliability

  • Add environment-based configuration (dotenv, env vars for PORT, DB_PATH, CORS_ORIGIN)
  • Wrap RecipeRepository.create in database transaction (BEGIN/COMMIT)
  • Wrap RecipeRepository.update in database transaction
  • Optimize duplicate detection in import (use Set for O(1) lookup)
  • Add health check endpoint (/api/health)
  • Add dirty flag to avoid unnecessary periodic database saves
  • Enable foreign key constraints (PRAGMA foreign_keys = ON)

Phase 2: Security

  • Add API key authentication middleware (shared secret for write endpoints)
  • Add rate limiting to import endpoints (express-rate-limit)
  • Update CORS to be configurable (wildcard only in development)
  • Fix image URL handling: ensure relative paths converted to /images/ absolute
  • (Optional) Restrict harness routes to localhost or add auth

Phase 3: Testing

  • Add tests for PUT /api/recipes/:id
  • Add tests for DELETE /api/recipes/:id
  • Add tests for tag CRUD (GET/POST/PUT/DELETE)
  • Add tests for tag assignment/removal to recipes
  • Add unit tests for CopyMeThatHtmlParser (edge cases, malformed HTML)
  • Add unit tests for CopyMeThatTxtParser
  • Add unit tests for CopyMeThatImportService (duplicate detection, error handling)
  • Add integration tests for file upload endpoint (POST /api/import/local)
  • Fix TypeScript build errors (node16 resolution, monkey-patch types)

Phase 4: Code Quality & Observability

  • Extract asyncHandler middleware to reduce route boilerplate
  • Add request logging (morgan)
  • Replace console.log with proper logger (debug module)
  • Add pagination links to recipe list response
  • Add full-text search (FTS5) for title/description/ingredients/tags (defer if time)

Completed in this session (2026-03-29)

  • Implemented all Phase 1 & 2 tasks (config, auth, rate limiting, health check, transactions, dirty flag, FK constraints, image URL fix)
  • Added comprehensive tests for recipes (PUT/DELETE) and tags (update/delete/assignment)
  • Fixed critical bug in tag assignment routes (parameter order)
  • Enabled foreign key constraints for data integrity
  • Fixed TypeScript build errors:
    • monkey-patch return type for db.run
    • added .js extensions to all cross-module imports (node16 resolution)
    • added explicit types for callbacks in test files
  • All backend tests passing (46 tests) and npm run build succeeds

📋 Backlog (Post-v1)

v1.1

  • Recipe scaling (adjust servings)
  • Print styles
  • Advanced search filters
  • Random recipe suggestion

v2.0 (AI Features)

  • AI ingredient substitutions
  • Meal planning
  • Shopping list generation
  • Fintrove cost tracking integration

🚧 Blocked / Needs Decision

  • CopyMeThat export path: confirm whether Anne/Elizabeth can export directly, or we rely on URL import + browser extension.
  • Tag filtering in recipe list: currently UI-only, backend filter by tag_id pending.

Notes for Agents

  • Work from top to bottom in the Active Tasks — v1.0 section.
  • Pick the first unchecked task only.
  • One task = one commit.
  • If blocked: mark task with reason and continue next unblocked task only with explicit note.

This is the authoritative task queue for harness iterations.