Noureddine RAMDI / MoeMail: a serverless, programmable temporary email service with AI agent CLI

Created Sat, 23 May 2026 20:41:14 +0000 Modified Sat, 23 May 2026 20:41:27 +0000

beilunyang/moemail

Temporary email services are nothing new, but MoeMail stands out by combining a fully serverless, self-hosted stack with a novel agent-first CLI designed for AI-driven email automation. It’s built to work seamlessly on Cloudflare’s free tier, delivering disposable inboxes with configurable lifetimes and real-time message polling. What caught my eye is how it treats email infrastructure as a programmable resource — not just for human users but for AI agents interacting via a dedicated CLI and OpenAPI keys.

How MoeMail builds a serverless temporary email platform

MoeMail is a TypeScript project built on Next.js and runs atop Cloudflare’s serverless stack, including Pages for frontend hosting, D1 (Cloudflare’s serverless SQLite-compatible database) for storage, and Email Workers for inbound message handling. This architecture means the entire email service — mailbox creation, message storage, sending, and receiving — operates without dedicated servers or traditional backend infrastructure.

The frontend is a Next.js app providing a clean UI for users to create disposable email addresses with customizable validity periods ranging from one hour to permanent addresses. Incoming emails are polled in real-time, offering a near-instant inbox refresh experience.

Emails are sent out through integration with the Resend email platform, while incoming email routing is handled by Cloudflare Email Workers. The database layer uses D1 to persist email metadata and messages.

An RBAC (role-based access control) system governs permissions with four tiers: Emperor, Duke, Knight, and Civilian, allowing fine-grained control over mailbox management and API usage. This is not typical for temporary email services and adds a layer of organizational control and security.

Webhook notifications enable integrations, firing events on email receipt or mailbox changes. Finally, OpenAPI access with API keys allows programmatic interaction with MoeMail’s backend, making it accessible for automation scripts or external tools.

The agent-first CLI: enabling AI-driven email workflows

The technical highlight is the @moemail/cli package, which isn’t just a user-facing CLI but an “agent-first” tool designed explicitly for AI agents — software programs that create and manage temporary mailboxes autonomously. This positions MoeMail as an infrastructure component in the growing agentic automation space.

The CLI auto-detects installed agent platforms and can be configured to operate as a skill within those platforms, allowing AI agents to orchestrate email workflows such as creating addresses, polling for mail, and sending replies.

By combining OpenAPI keys, webhook notifications, and this CLI, MoeMail provides a programmable email environment that fits neatly into automated pipelines, AI experiments, or ephemeral communications where privacy and automation intersect.

From a code quality perspective, the repo is well-structured with clear separation between frontend, backend worker scripts, and CLI tooling. It uses TypeScript throughout, improving maintainability and type safety. The choice of Cloudflare’s edge stack trades off the complexity and cost of traditional email hosting for the constraints and vendor lock-in associated with serverless edge platforms. For many use cases, especially privacy-focused or low-cost deployments, this tradeoff is reasonable.

Getting started with MoeMail

The project requires Node.js 18+, pnpm for package management, Wrangler CLI for Cloudflare deployment, and a Cloudflare account.

Here are the exact steps to set it up locally and deploy:

# Clone the repo
git clone https://github.com/beilunyang/moemail.git
cd moemail

# Install dependencies
pnpm install

# Setup Wrangler config files
cp wrangler.example.json wrangler.json
cp wrangler.email.example.json wrangler.email.json
cp wrangler.cleanup.example.json wrangler.cleanup.json
# Edit these configs to set your Cloudflare D1 database name and ID

# Setup environment variables
cp .env.example .env.local
# Fill in AUTH_GITHUB_ID, AUTH_GITHUB_SECRET, AUTH_SECRET in .env.local

# Create local database schema
pnpm db:migrate-local

# Install the CLI globally
npm i -g @moemail/cli

# Auto-detect agent platforms and install CLI skill
moemail skill install

The instructions are comprehensive and mostly declarative, reflecting the complexity of integrating with Cloudflare’s stack. The database migration command sets up the D1 schema locally, while the CLI installation and skill setup prepare the environment for AI agent interactions.

Verdict: who should consider MoeMail

MoeMail is a solid choice if you want a self-hosted, serverless temporary email service that can be deployed cost-effectively on Cloudflare’s free tier. The project’s strength lies in its programmable approach, especially the agent-first CLI enabling AI-driven workflows — a rare feature in this space.

That said, it’s tied tightly to Cloudflare’s platform and D1 database, so it’s not a plug-and-play solution for every environment. The serverless model brings limits on storage and execution time, which might not suit high-volume or long-term email needs.

If you’re exploring AI automation with ephemeral email, need disposable inboxes integrated into development or testing pipelines, or want to experiment with programmable email infrastructure, MoeMail is worth a look. For general-purpose temporary email without AI integration, simpler alternatives may suffice.

Overall, the codebase is clean and maintainable, the architecture is modern and serverless, and the project provides a unique take on programmable email with AI in mind. It’s a good example of combining cloud-native infrastructure with emerging automation trends.


→ GitHub Repo: beilunyang/moemail ⭐ 2,582 · TypeScript