Author: Amaan Haider
AI-powered webmail with Gmail + an assistant that controls the UI.
MailMate is a webmail app that uses the Gmail API. The built-in AI assistant doesn't just answer questions—it opens compose, fills fields, filters the inbox, opens emails, drafts replies, forwards as-is, and sends when you ask.
Requirements: REQUIREMENTS.md.
| Area | What you get |
|---|---|
| Inbox, Sent, read email, Compose & send (Gmail API), attachments | |
| Categories | Gmail-style tabs: All, Primary, Social, Promotions, Updates, Forums |
| Filters | Keyword, unread only, date range (UI + assistant); uses Gmail search |
| Pagination | Previous / Next with "Showing X–Y" |
| AI assistant | Open compose · Fill to/subject/body · Filter inbox · Switch category · Open email/sent by position · Reply · Forward (raw, format preserved) · Mark as read · Send · Understand/enhance draft · Rich preview cards |
| Human-in-the-loop | Confirmation before send and forward |
| Sync | Inbox refreshes on tab focus and every 30s (no manual refresh) |
| UI | Dark theme, resizable assistant panel |
Follow these steps in order. You need two things: a Cerebras API key and Google OAuth credentials.
If you don't have Node.js:
- Go to nodejs.org
- Download the LTS version
- Run the installer
- Open a terminal and type
node -v— you should see a version (e.g.v20.x.x)
- Go to cloud.cerebras.ai
- Sign up or log in
- Find API Keys in the dashboard
- Click Create new key
- Copy the key (starts with
csk-) and save it — you'll paste it into.envlater
- Go to console.cloud.google.com
- Click the project dropdown at the top → New Project
- Name it (e.g. "MailMate") → Create
- Left sidebar → APIs & Services → Library
- Search Gmail API → click it → Enable
- APIs & Services → Credentials → + Create Credentials → OAuth client ID
- If asked to configure consent screen: choose External → fill App name and your email → add your email as Test user → Save
- Back to Create OAuth client ID:
- Application type: Web application
- Name: e.g. "MailMate"
- Authorized JavaScript origins → Add URI →
http://localhost:5173 - Authorized redirect URIs → Add URI →
http://localhost:5001/api/auth/google/callback - Create
- Copy the Client ID and Client Secret — you'll need them for
.env
cd server
npm install
cd ../client
npm install-
Copy the example env file:
cd server cp .env.example .env -
Open
server/.envin a text editor and fill in:Variable Where to get it CEREBRAS_API_KEYStep 1 GOOGLE_CLIENT_IDStep 2c GOOGLE_CLIENT_SECRETStep 2c GOOGLE_REDIRECT_URIKeep as-is FRONTEND_URLKeep as-is SESSION_SECRETAny string (e.g. my-secret) -
Save the file
Terminal 1 — Server:
cd server
npm run devWait for "Server running on port 5001".
Terminal 2 — Client:
cd client
npm run devWait for "Local: http://localhost:5173".
- Open http://localhost:5173 in your browser
- Click Sign in with Google and approve
- Go to Inbox and open the assistant (sidebar)
- Try: "Show unread from this week" · "Open the first email" · "Reply saying I'll send an update tomorrow" · "Send"
- Redirect URI mismatch — Ensure
http://localhost:5001/api/auth/google/callbackis exactly in Google Console (no trailing slash). - CEREBRAS_API_KEY not set — Save
.envinserver/and restart the server. - Cannot GET /api/... — Make sure server runs on 5001 and client on 5173.
| Folder | Role |
|---|---|
client/ |
React + Vite UI, CopilotKit assistant tools |
server/ |
Express, Gmail API (OAuth), CopilotKit runtime (Cerebras) |