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
- Does imapflow (Node.js npm package with native modules) run in Deno edge functions?
- Alternative: Extend the existing imap edge function (currently auto-detection only) to also handle folder listing via Hono?
- Alternative: Edge function proxies request to emails-fetcher microservice?
- 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.
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
Research questions
Files to consider
Decision options
Deliverable
A clear recommendation with rationale, either a migration plan or a documented decision to keep in Express.