How barathbalasubramanian/email-summarizer works
Email Summarizer is a Gmail-connected web app: users authorize Google, browse and filter inbox messages, then inspect AI-generated summaries, key points, action items, sentiment, and category. The dashboard coordinates email loading and pagination; UI components present the resulting list, statistics, and selected-message detail. The sampled code supports the main OAuth, Gmail-fetch, and summary paths. Some dashboard and summary API links are confirmed by the source index rather than full excerpts; other README-promised capabilities are represented at the landing-page feature level.
Main entry points: gmail.ts Gmail integration · dashboard/page.tsx Dashboard controller · app/page.tsx Connect landing page · route.ts OAuth callback
Components 18
Entry and Auth
- Connect landing page
app/page.tsx - OAuth URL route
app/api/auth/google/route.ts - Google OAuth
- OAuth callback
app/api/auth/callback/route.ts - Token cookie
- Privacy and smart insights
app/page.tsx
Email Workflow
- Dashboard controller
app/dashboard/page.tsx - Inbox API
app/api/emails/route.ts - Gmail integration
lib/gmail.ts - Gmail API
AI Insights
- Summary API
app/api/emails/[id]/summary/route.ts - Summary generation
lib/ai-summarizer.ts - OpenAI service
Dashboard UI
- Email list
components/email-list.tsx - Dashboard header
components/dashboard-header.tsx - Dashboard statistics
components/dashboard-stats.tsx - Email preview
components/email-preview.tsx
Other components
- Email user
Connections 22
- Email user → Connect landing page: opens app
app/page.tsx - Connect landing page → OAuth URL route: requests auth URL
app/page.tsx - OAuth URL route → Gmail integration: gets auth URL
app/api/auth/google/route.ts - Gmail integration → Google OAuth: creates authorization URL
lib/gmail.ts - Email user → Google OAuth: authorizes account
- Google OAuth → OAuth callback: redirects with code
app/api/auth/callback/route.ts - OAuth callback → Gmail integration: exchanges code
app/api/auth/callback/route.ts - Gmail integration → Google OAuth: exchanges code
lib/gmail.ts - OAuth callback → Token cookie: stores tokens
app/api/auth/callback/route.ts - Dashboard controller → Inbox API: fetches inbox pages
app/dashboard/page.tsx - Inbox API → Token cookie: reads tokens
app/api/emails/route.ts - Inbox API → Gmail integration: fetches emails
app/api/emails/route.ts - Gmail integration → Gmail API: lists and reads messages
lib/gmail.ts - Dashboard controller → Email list: renders and handles selection
app/dashboard/page.tsx - Dashboard controller → Email preview: renders selected email
app/dashboard/page.tsx - Dashboard controller → Dashboard header: renders
app/dashboard/page.tsx - Dashboard controller → Dashboard statistics: renders
app/dashboard/page.tsx - Email preview → Summary API: requests summary
components/email-preview.tsx - Summary API → Gmail integration: loads email
app/api/emails/[id]/summary/route.ts - Summary API → Summary generation: generates summary
app/api/emails/[id]/summary/route.ts - Summary generation → OpenAI service: requests analysis
lib/ai-summarizer.ts - Connect landing page → Privacy and smart insights: presents capabilities
app/page.tsx