Product changelog
How we built this,
step by step.
Every feature, every decision, every mistake — documented openly.
The first spark
Proof of concept. One API route, one model call, five emails printed to a console. Ugly, but it classified emails correctly.
- Next.js 15 project scaffolded with App Router
- Google OAuth via Better Auth
- First call to local LLM (Ollama + llama3.2) to classify an email
- Confirmed the core idea actually worked
Real-time Gmail pipeline
Moved from polling to push. Emails now arrive within seconds of landing in your inbox.
- Gmail Pub/Sub webhook integration
- Upstash QStash for reliable background job processing
- Redis dedup keys to prevent double-processing
- Gmail history.list delta processing — only new messages fetched
- DRAFT / SENT / SPAM label guards to stop infinite loops
AI classification engine
The brain of EmailHQ. Every email is now understood, not just received.
- 7-category classification: Priority, Follow Up, Planned, Finance, Personal, Notification, Marketing
- Zod schema validation on AI output — bad model responses never crash the pipeline
- Gmail label sync — categories written back as real Gmail labels with colour coding
- Renamed 'Important' → 'Priority' and 'Scheduled' → 'Planned' to avoid Gmail system label conflicts (409 errors)
- Multi-label support: up to 2 labels per email (action + context)
Auto-draft generation
EmailHQ doesn't just read your email — it starts writing the reply for you.
- generateDraftReply() powered by local LLM
- Drafts saved to Gmail Drafts API with correct thread headers
- Thread deduplication guard — one draft per thread, no duplicates
- Draft approval flow: review in-app, send directly from Gmail draft via drafts.send()
- Draft status tracking: pending_approval → sent
Privacy-first architecture
A deliberate, hard architectural decision: no email content ever touches the database.
- Dropped subject, snippet, sender, recipient columns from the emails table
- Dropped draft content column from the drafts table
- Added fetchEmailMetadataById() — live Gmail fetch for display
- Added fetchGmailDraftContent() — live Gmail Drafts fetch for display
- Redis thin cache: 20 emails, 5-minute TTL, invalidated on ingest
- All AI processing happens in-memory and is immediately discarded
Vault & invoice extraction
Finance emails get special treatment. Invoices are parsed and structured, attachments archived.
- Cloudflare R2 attachment storage with presigned URL access
- AI-powered invoice extraction: vendor, amount, currency, due date
- Vault dashboard: list and detail view for all attachments
- Google Drive integration for file-based draft creation
- Draft from file: select a Drive doc, add instructions, get an email draft
Calendar-aware drafting
The AI now knows your schedule. Drafts reference your actual availability — not generic placeholders.
- Google Calendar integration with OAuth token refresh
- getCalendarContextForDraft() — shared context builder for all draft paths
- Smart category filter: only fetches calendar for relevant categories (scheduled, important, follow_up)
- 4-second timeout guard — calendar API latency never blocks drafting
- Parallel fetch: Gmail metadata + calendar context fetched simultaneously
- 7-day window for scheduling emails, today-only for reply emails
Dashboard & AI assistant
A full dashboard UI with tabs, cards, and an AI chat panel that understands your inbox.
- Overview dashboard: email cards, Drive files tab, Calendar tab with 7-day view
- Fixed calendar infinite-loading bug (unstable SWR key from new Date() on every render)
- AI assistant panel: draft emails, check calendar, list recent emails, create events
- Categories page with full label documentation
- Drive page with list/grid toggle
- Gmail label rename on categories page reflecting actual label names
Public launch & open source
EmailHQ goes public. The full codebase is open sourced under MIT.
- Landing page with dark/light theme, GSAP animations, 3D hero scene
- Privacy Policy and Terms of Service pages
- README rewritten to document the full architecture
- Open sourced on GitHub
- Production deployment on Vercel + Neon + Upstash
Smarter AI & better UX
Improving the quality of AI output and the day-to-day experience of using the product.
- Upgrade to a more capable model for better draft quality
- Multi-email thread context — AI reads the full thread before drafting
- Inline email reader so you never leave the dashboard
- Notification system for high-priority emails
- Keyboard shortcuts throughout the dashboard
Team & collaboration
EmailHQ for teams. Share inboxes, delegate drafts, collaborate on responses.
- Workspace model: invite teammates, shared inbox view
- Draft assignment: route drafts to the right person
- Comment threads on drafts before sending
- Audit log: full history of what the AI touched
- Role-based access control
Mobile app & integrations
Your AI inbox wherever you are, connected to the tools you already use.
- Native iOS and Android apps
- Slack integration: get notified about Priority emails in your channels
- Notion integration: auto-log action items from emails
- Zapier / Make connector for custom automations
- Outlook / Microsoft 365 support
Have a feature idea?
EmailHQ is open source. Open an issue or start a discussion on GitHub.
View on GitHub