{"id":50314449,"url":"https://github.com/xlab/email","last_synced_at":"2026-05-28T23:01:58.477Z","repository":{"id":352211147,"uuid":"1213950953","full_name":"xlab/email","owner":"xlab","description":"Executive email system by xlab. Based on CloudFlare Email Service.","archived":false,"fork":false,"pushed_at":"2026-04-18T11:43:52.000Z","size":3625,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2026-04-18T13:25:40.091Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/xlab.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":"AUDIT.md","citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-04-18T00:07:01.000Z","updated_at":"2026-04-18T11:43:55.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/xlab/email","commit_stats":null,"previous_names":["xlab/email"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/xlab/email","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xlab%2Femail","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xlab%2Femail/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xlab%2Femail/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xlab%2Femail/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xlab","download_url":"https://codeload.github.com/xlab/email/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xlab%2Femail/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33629560,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-05-28T02:00:06.440Z","response_time":99,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-05-28T23:01:48.283Z","updated_at":"2026-05-28T23:01:58.457Z","avatar_url":"https://github.com/xlab.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n  \u003ch1\u003eAgentic Inbox\u003c/h1\u003e\n  \u003cp\u003e\u003cem\u003eA self-hosted email client with an AI agent, running entirely on Cloudflare Workers\u003c/em\u003e\u003c/p\u003e\n\u003c/div\u003e\n\nAgentic Inbox lets you send, receive, and manage emails through a modern web interface -- all powered by your own Cloudflare account. Incoming emails arrive via [Cloudflare Email Routing](https://developers.cloudflare.com/email-routing/), each mailbox is isolated in its own [Durable Object](https://developers.cloudflare.com/durable-objects/) with a SQLite database, and attachments are stored in [R2](https://developers.cloudflare.com/r2/).\n\nAn **AI-powered Email Agent** can read your inbox, search conversations, and draft replies -- built with the [Cloudflare Agents SDK](https://developers.cloudflare.com/agents/) and [Workers AI](https://developers.cloudflare.com/workers-ai/).\n\n![Agentic Inbox screenshot](./demo_app.png)\n\n\nRead the blog post to learn more about Cloudflare Email Service and how to use it with the Agents SDK, MCP, and from the Wrangler CLI: [Email for Agents](https://blog.cloudflare.com/email-for-agents/).\n\n## How to setup\n\n### To set up\n\n1. Deploy to Cloudflare. The deploy flow will automatically provision R2, Durable Objects, and Workers AI. You'll be prompted for **DOMAINS**, which is the domain (yourdomain.com) you want to receive emails for (email@yourdomain.com).\n\n     [![Deploy to Cloudflare](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/xlab/email)\n\n2. **Configure Cloudflare Access** -- Enable [one-click Cloudflare Access](https://developers.cloudflare.com/changelog/post/2025-10-03-one-click-access-for-workers/) on your Worker under Settings \u003e Domains \u0026 Routes. The modal will show your `POLICY_AUD` and `TEAM_DOMAIN` values. `TEAM_DOMAIN` can be either your Access team URL or the full `.../cdn-cgi/access/certs` URL. **You must set these as secrets for your Worker.**\n3. **Set up Email Routing** -- In the Cloudflare dashboard, go to your domain \u003e Email Routing and create a catch-all rule that forwards to this Worker\n4. **Enable Email Service** -- The worker needs the `send_email` binding to send outbound emails. See [Email Service docs](https://developers.cloudflare.com/email-routing/email-workers/send-email-workers/)\n5. **Create a mailbox** -- Visit your deployed app and create a mailbox for any address on your domain (e.g. `hello@example.com`)\n\n### Troubleshooting Access\n\n1. If you see `Invalid or expired Access token`, that usually means `POLICY_AUD` or `TEAM_DOMAIN` secrets are incorrect.\n   * Resolution: [turn Access off and back on for the Worker to get the Access modal again](https://developers.cloudflare.com/changelog/post/2025-10-03-one-click-access-for-workers/), then reset your Worker secrets to the latest `POLICY_AUD` and `TEAM_DOMAIN` values shown there.\n2. If you see `Cloudflare Access must be configured in production`, this application is intentionally enforcing Cloudflare Access so your inbox is not exposed to anyone on the internet.\n   * Resolution: enable Access using [one-click Cloudflare Access for Workers](https://developers.cloudflare.com/changelog/post/2025-10-03-one-click-access-for-workers/), then set the `POLICY_AUD` and `TEAM_DOMAIN` Worker secrets from the modal values.\n\n## Features\n\n- **Full email client** — Send and receive emails via Cloudflare Email Routing with a rich text composer, reply/forward threading, folder organization, search, and attachments\n- **Per-mailbox isolation** — Each mailbox runs in its own Durable Object with SQLite storage and R2 for attachments\n- **Built-in AI agent** — Side panel with 9 email tools for reading, searching, drafting, and sending\n- **Auto-draft on new email** — Agent automatically reads inbound emails and generates draft replies, always requiring explicit confirmation before sending\n- **Configurable and persistent** — Custom system prompts per mailbox, persistent chat history, streaming markdown responses, and tool call visibility\n\n## Stack\n\n- **Frontend:** React 19, React Router v7, Tailwind CSS, Zustand, TipTap, `@cloudflare/kumo`\n- **Backend:** Hono, Cloudflare Workers, Durable Objects (SQLite), R2, Email Routing\n- **AI Agent:** Cloudflare Agents SDK (`AIChatAgent`), AI SDK v6, Workers AI (`@cf/moonshotai/kimi-k2.5`), `react-markdown` + `remark-gfm`\n- **Auth:** Cloudflare Access JWT validation (required outside local development)\n\n## Getting Started\n\n```bash\nnpm install\nnpm run dev\n```\n\n### Configuration\n\n1. Set your domain in `wrangler.jsonc`\n2. Create an R2 bucket named `agentic-inbox`: `wrangler r2 bucket create agentic-inbox`\n\n### Deploy\n\n```bash\nnpm run deploy\n```\n\n## Prerequisites\n\n- Cloudflare account with a domain\n- [Email Routing](https://developers.cloudflare.com/email-routing/) enabled for receiving\n- [Email Service](https://developers.cloudflare.com/email-service/) enabled for sending\n- [Workers AI](https://developers.cloudflare.com/workers-ai/) enabled (for the agent)\n- [Cloudflare Access](https://developers.cloudflare.com/cloudflare-one/policies/access/) configured for deployed/shared environments (required in production)\n\nAny user who passes the shared Cloudflare Access policy can access all mailboxes in this app by design. This includes the MCP server at `/mcp` -- external AI tools (Claude Code, Cursor, etc.) connected via MCP can operate on any mailbox by passing a `mailboxId` parameter. There is no per-mailbox authorization; the Cloudflare Access policy is the single trust boundary.\n\n## Architecture\n\n```\n┌──────────────┐     ┌──────────────────┐     ┌─────────────────┐\n│   Browser    │────\u003e│  Hono Worker     │────\u003e│  MailboxDO      │\n│  React SPA   │     │  (API + SSR)     │     │  (SQLite + R2)  │\n│  Agent Panel │     │                  │     └─────────────────┘\n└──────┬───────┘     │  /agents/* ──────┼────\u003e┌─────────────────┐\n       │             │                  │     │  EmailAgent DO  │\n       │ WebSocket   │                  │     │  (AIChatAgent)  │\n       └─────────────┤                  │     │  9 email tools  │\n                     │                  │────\u003e│  Workers AI     │\n                     └──────────────────┘     └─────────────────┘\n```\n\n## License\n\nApache 2.0 -- see [LICENSE](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxlab%2Femail","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxlab%2Femail","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxlab%2Femail/lists"}