Skip to content

Design import and export for bookmark libraries #16

Description

@DevOlabode

Current behavior

There is no way to get bookmarks into or out of Curate other than one at a time through the popup form or the /api/v1/bookmarks API. No export endpoint, no import endpoint, no file handling anywhere in controllers/api/ or extension/.

This is a design issue - do not start implementation without agreement on scope

Define, before writing code:

  • Export format: plain JSON matching the Bookmark/Collection shape (models/bookmark.js, models/collection.js) is the obvious default - decide whether to also support the Netscape bookmarks HTML format browsers already use, since that's what makes cross-tool import/export actually useful.
  • Import validation: reuse joiSchema.js (bookmarkSchema, collectionSchema) rather than inventing a parallel validation path; decide what happens to rows that fail validation (skip and report, or reject the whole import).
  • Duplicate handling: same URL already bookmarked by this user - skip, merge, or create a duplicate? Same question for collection names.
  • Error behavior: partial success reporting (e.g. "212 imported, 3 skipped, reasons") vs. all-or-nothing.
  • Security considerations: this is user-uploaded file content going into mongoose documents - validate size and shape before parsing, don't trust a client-declared MIME type, and be deliberate about how much of an imported HTML file (if that format is supported) gets rendered anywhere.
  • Large library handling: what happens with a few thousand bookmarks in one import - synchronous request, or does it need to be chunked/backgrounded?

Relevant files

  • models/bookmark.js, models/collection.js
  • joiSchema.js
  • controllers/api/bookmarks.js, controllers/api/collections.js, routes/api/
  • extension/popup/ (wherever the trigger for import/export would live)
  • docs/roadmap.md ("Considering" section already lists this)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    backendExpress API / serverenhancementNew feature or requestextensionBrowser extension (popup, options, background)needs discussionDesign/approach must be agreed before implementation

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions