Unified Gmail triage app with Next.js (App Router) + Bun.
- UI and API live at repo root (
app/+lib/) - API fetches unread Gmail emails and classifies/summarizes with OpenRouter
- Python backend has been removed
- Bun
- Node.js 20+
credentials.jsonat repo root (Google OAuth client)token.jsonat repo root (Google token; refreshed automatically).envat repo root with OpenRouter config
MODEL=your-openrouter-model
OPENROUTER_API_KEY=your-key
OPENROUTER_API_URL=https://openrouter.ai/api/v1/chat/completionsbun install
bun run devGET /healthPOST /api/classify/unreadPOST /api/classify/emails
Example:
curl -X POST http://localhost:3000/api/classify/unread \
-H 'Content-Type: application/json' \
-d '{"max_results":5,"use_structured_output":true}'- Keep
credentials.json,token.json, and.envuncommitted. - Gmail scope is readonly (
https://www.googleapis.com/auth/gmail.readonly). - If OAuth scopes change, recreate
token.json.