Skip to content

sub-issue: Research & decide IMAP Boxes migration #2813

@malek10xdev

Description

@malek10xdev

Relates to #2750 — Phase 2 migration.

Goal

Determine whether POST /api/imap/boxes (fetch IMAP folder tree) can be moved to edge functions, or document the alternative.

Endpoint in question

Method Path Purpose
POST /boxes Fetch IMAP folder tree for a mining source

Research questions

  1. Does imapflow (Node.js npm package with native modules) run in Deno edge functions?
  2. Alternative: Extend the existing imap edge function (currently auto-detection only) to also handle folder listing via Hono?
  3. Alternative: Edge function proxies request to emails-fetcher microservice?
  4. Edge function timeouts (default 15s, max configurable) vs IMAP listing time (typically 2-10s)

Files to consider

  • backend/src/controllers/imap.controller.ts:33-139
  • backend/src/services/imap/ImapBoxesFetcher.ts
  • backend/src/services/imap/ImapConnectionProvider.ts
  • supabase/functions/imap/index.ts (existing auto-detection)
  • frontend/src/stores/leadminer.ts (frontend call site)

Decision options

  • Feasible: Migrate to imap edge function (add Hono), remove Express IMAP routes
  • Not feasible: Document decision, keep in Express with gateway pattern, or route through emails-fetcher

Deliverable

A clear recommendation with rationale, either a migration plan or a documented decision to keep in Express.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions