Add SupaMail OSS IMAP-to-Supabase core#1
Draft
fedster99 wants to merge 10 commits into
Draft
Conversation
Owner
Author
|
Review follow-up from the local I addressed the pre-landing review findings locally. These changes are not visible in this PR until they are pushed onto the PR branch. Fixed locally:
Verification passed locally:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
immediate,lazy, andpriority_then_backfill.Review hardening
API_TOKENfor the API service and keeps only/healthpublic.anon/authenticatedtable access when those Supabase roles exist, and revokes public execution on password helper functions.currently_syncingleases using heartbeat age so crashed workers do not brick an account.LISTpass.imap-to-supabaseruntime naming drift.Deployment shape
--ha=falseso the cheapest first deploy stays to one Machine.Known follow-ups
Why
This turns the Signal IMAP sync engine into a separate OSS/self-hosted project instead of landing a large invasive extraction PR inside Signal.
SupaMail exists for teams and builders whose inboxes are not neatly covered by Gmail/Outlook-first tooling. The goal is simple: connect any IMAP mailbox, mirror email into Supabase reliably, and make it easy to build AI agents, internal tools, CRM workflows, search, alerts, and automations on top of owned database tables.
How it works
SupaMail treats IMAP as the provider and Supabase/Postgres as the durable mailbox mirror. The worker serializes account operations with Postgres advisory locks, tracks folder cursors and UIDVALIDITY, fetches metadata and full bodies according to policy, and runs reconciliation so missing messages do not silently become permanent gaps.
The default operational shape is Supabase + Fly.io: Supabase hosts Postgres, Fly runs the always-on worker without a public IP, and the optional API can run as a separate Fly app.
Validation
pnpm typecheckpnpm testpnpm buildDATABASE_URL=postgresql://postgres:postgres@localhost:54322/postgres IMAP_ENCRYPTION_KEY=... pnpm dry-run:localscripts/local-dry-run.tsNotes