Note
Topmo is a Gmail agent that signs into any Google account via production OAuth, learns the owner's voice from their sent history, drafts replies, labels and files newsletters and receipts automatically, and proactively surfaces threads the user sent days ago with no reply, so follow-ups never fall through the cracks.
- π Features
- π§ AI Capabilities & MeshAPI Pipeline
- π οΈ Tech Stack & Under the Hood
- ποΈ Database Stats & Schema
- π» Installation & Setup
- π· Screenshots
- π» Contributing
- πββοΈ Issues
- π€ Author
- π License
| Video Demo Watch the quick walkthrough on YouTube. |
Topmoβs core intelligence relies completely on MeshAPI, a unified LLM gateway. The entire agentic pipeline is built to leverage MeshAPI for inference, strict structured JSON outputs, embeddings, and background batch processing.
Why MeshAPI is Critical:
- Pinned Aliases for Latency: We pin specific models via MeshAPI aliases to ensure predictable latencies per endpoint.
- Strict Structured Outputs: Topmo relies heavily on structured output format tightly integrated with our internal validation schemas. This guarantees every AI output (like classification tags or voice profile deltas) returns perfectly typed JSON.
- Unified Gateway: Whether generating tts or complex chat completions, MeshAPI provides a single, scalable unified endpoint handling all underlying AI providers seamlessly.
The AI Pipeline Features:
- Intelligent Classification: Evaluates every incoming email to automatically classify it into categories like
REPLY_NEEDED,FYI,NEWSLETTER,RECEIPT, orSPAM, ensuring you only focus on what matters. - Voice Profiling: Performs a deep extraction on a sample of your past sent emails to build a unique Voice Profile, learning your formality, average length, emoji use, and sign-offs. It can also be customized from a description or custom samples.
- Draft Generation: Acts as an intelligent ghostwriter to compose high-quality, ready-to-send email replies that precisely match your voice profile and contextual thread history.
- Explicit Rules: Natively handles and executes complex user inbox rules, applying explicit logical decisions on when to skip, label, or force a reply.
- Framework: SvelteKit 2 + Svelte 5
- Package Manager: Bun
- Database: Turso (libSQL) serverless SQLite
- ORM: Drizzle ORM
- Styling: Tailwind CSS v4
- Validation: Zod v4
- Google SDK:
googleapis+google-auth-library(OAuth + Gmail API) - LLM Gateway: MeshAPI
- Email Parsing:
mailparser(Plaintext extraction & quote stripping) - Encryption: Built-in cryptographic algorithms for AES-256-GCM (For Refresh Tokens)
- Repository Pattern: All database access flows through strict repository functions requiring a user ID to guarantee multi-tenant safety. Raw calls are blocked by ESLint.
- Prompt-Injection Guards: Raw email content is wrapped in a guard function and parsed to strip quotes and signatures, minimizing injection risks.
- Encrypted Token Storage: Google OAuth Refresh Tokens are encrypted at rest using AES-256-GCM with versioned keys for safe storage and easy rotation.
Topmo's background tasks are triggered by a cron job hitting the /api/cron/tick endpoint. This can be configured via Vercel Cron (every 5 minutes), run locally via the dev:tick script, or driven by the included GitHub Actions workflow (.github/workflows/cron.yml) which runs every 30 minutes.
The cron orchestrator:
- Queries the Turso database for users whose
lastProcessedAtis older than the interval limit. - Decrypts their stored Google refresh tokens dynamically.
- Fetches unread emails via the Gmail API and parses the content securely.
- Pings MeshAPI to run the AI classification and extraction pipeline.
- Orchestrates auto-drafts and follow-up DB updatesβall while heavily parallelizing tasks to strictly adhere to Vercel's Serverless function timeout constraints.
Topmo uses Turso (libSQL) with Drizzle ORM. It requires zero-ops connections and seamlessly runs serverless or as a local SQLite file (topmo.db).
Core Tables:
users: Stores emails, encrypted OAuth tokens, generated voice profiles (JSON), processing timestamps, and daily token budgets.emails: Records parsed email metadata, classifications, and actions taken (avoids duplicate processing).drafts: Contains AI-generated replies tied to a specific email/user, tracking its status (pending/sent/discarded) and voice edit deltas.actions: Audit log of all actions taken and LLM tokens used.follow_ups: Tracks sent emails and triggers an alert if the threshold days pass without a reply.voice_deltas: Captures manual edits you make to AI drafts to incrementally adjust your voice profile.
You can self-host Topmo easily for personal use.
Copy .env.example to .env and configure it step-by-step:
cp .env.example .env- MeshAPI Keys: Sign up at MeshAPI and set
MESH_API_KEY. - Turso (Prod): Set
TURSO_DATABASE_URLandTURSO_AUTH_TOKEN. Leave empty for local development (defaults to a local SQLite file). - Google OAuth: Set up an OAuth 2.0 Client in Google Cloud Console. Make sure to enable the Gmail module in Google APIs and Services.
- Set
GOOGLE_CLIENT_IDandGOOGLE_CLIENT_SECRET. - Set
GOOGLE_OAUTH_REDIRECTtohttp://localhost:5173/auth/callback(or your production URL).
- Set
- Secrets Generation: Generate secure random strings for the application:
openssl rand -base64 32 # Paste into TOKEN_ENCRYPTION_KEY openssl rand -hex 32 # Paste into SESSION_SECRET openssl rand -hex 32 # Paste into CRON_SECRET
# 1. Install dependencies via Bun
bun install
# 2. Generate migrations and push schema to local SQLite db
bun run db:generate
bun run db:push
# 3. Start development server
bun run devHere's a working and expected screenshot of Topmo
Inbox & Command Center (/inbox) |
Rules & Configurations (/rules) |
Account Settings (/settings) |
|---|---|---|
![]() |
![]() |
![]() |
Database Status (/db) |
Landing Page (/) |
Admin Dashboard (/admin) |
![]() |
![]() |
![]() |
| Landing Page Full Preview |
|---|
![]() |
Tip
We welcome contributions to improve Topmo! If you have suggestions, bug fixes, or new feature ideas, follow these steps:
-
Fork the Repository
Click the Fork button at the top-right of the repo page. -
Clone Your Fork
Clone the repo locally:git clone https://github.com/ArnavK-09/topmo.git
-
Create a Branch
Create a new branch for your changes:git checkout -b your-feature-branch
-
Make Changes
Implement your changes (bug fixes, features, etc.). -
Commit and Push
Commit your changes and push the branch:git commit -m "feat(scope): description" git push origin your-feature-branch -
Open a Pull Request
Open a PR with a detailed description of your changes. -
Collaborate and Merge
The maintainers will review your PR, request changes if needed, and merge it once approved.
Found a bug or need help? Please create an issue on the GitHub repository with a detailed description.
![]() |
Topmo is licensed under the MIT License. See the LICENSE file for more details.
π If you find this project helpful, please give it a star on GitHub! π




















