How martingaolianzhan/mindmail works
Mind Mail is a web email client centered on connecting an email account, synchronizing messages, and managing them in the mail interface. The documented feature set also includes message composition, AI assistance, and search. Sampled code confirms the Aurinko callback and initial-sync path, database-backed search, and the client’s search request; other UI and router internals are represented at the enclosing paths shown in the tree, so their specific wiring is not assumed.
Main entry points: db.ts Application database · callback/route.ts Account callback · initial-sync/route.ts Initial sync · mail.tsx Mail workspace
Components 27
Mail experience
- Mail page
src/app/mail/page.tsx - Mail workspace
src/app/mail/mail.tsx - Thread list
src/app/mail/components/thread-list.tsx - Thread view
src/app/mail/components/thread-display.tsx - Email view
src/app/mail/components/email-display.tsx - Compose and reply
src/app/mail/components/compose-button.tsx - Email editor
src/app/mail/components/email-editor/email-editor.tsx - AI assistant
src/app/mail/components/ai-compose/ai-actions.ts - Email search
src/app/mail/components/email-search/search-display.tsx - Search input
src/app/mail/components/email-search/search-bar.tsx - Account controls
src/app/mail/components/account-switcher.tsx
Accounts and sync
- Account callback
src/app/api/aurinko/callback/route.ts - Aurinko client
src/lib/aurinko.ts - Initial sync
src/app/api/initial-sync/route.ts - Account sync
src/lib/account.ts - Email persistence
src/lib/sync-to-db.ts - User webhook
src/app/api/clerk/webhook/route.ts
API and data
- tRPC endpoint
src/app/api/trpc/[trpc]/route.ts - API router
src/server/api/root.ts - Account API
src/server/api/routers/account.ts - Search service
src/lib/search.ts - Application database
src/server/db.ts
External services
- Aurinko
- Clerk
- Google Gemini
- Neon PostgreSQL
Other components
- User
Connections 30
- User → Mail page: opens
- Mail page → Mail workspace: renders
- Mail workspace → Thread list: shows threads
- Mail workspace → Thread view: shows thread
- Thread view → Email view: renders messages
- User → Compose and reply: composes
- Compose and reply → Email editor: opens editor
- Email editor → AI assistant: requests assistance
- AI assistant → Google Gemini: generates text
- User → Search input: enters query
- Search input → Email search: updates query
- Email search → Account API: calls mutation
- Account API → Search service: searches emails
- Search service → Application database: reads emails
- User → Account controls: manages account
- Account controls → Account callback: connects account
- Aurinko → Account callback: returns authorization
- Account callback → Aurinko client: exchanges token
- Account callback → Application database: upserts account
- Account callback → Initial sync: triggers sync
- Initial sync → Application database: loads account
- Initial sync → Account sync: fetches messages
- Account sync → Aurinko: syncs messages
- Initial sync → Email persistence: persists messages
- Email persistence → Application database: upserts emails
- Clerk → User webhook: sends user event
- User webhook → Application database: upserts user
- User → tRPC endpoint: requests API
- tRPC endpoint → API router: dispatches
- Application database → Neon PostgreSQL: stores data