| 📥 Inbound email | Email Routing → Worker email() handler → parsed & stored in D1 |
| 📤 Outbound email | Send real mail as you@yourdomain.com via the send_email binding |
| � Multi-identity | Multiple addresses per mailbox — pick an identity, send as it, RSVP from the invited address |
| �📅 Calendar invites | Parses text/calendar, RSVP Yes / Maybe / No sends a real iCal METHOD:REPLY — organizers see you@yourdomain.com: Accepted |
| 🗓️ Independent calendar | Create/edit/delete events in your own calendar, send REQUEST/CANCEL invites, import .ics anywhere |
| ⏰ Reminders | Cron trigger emails you before events |
| 🔄 Attio sync | Mirror emails → notes and events → meetings in Attio (covers providers Attio's Google/Microsoft-only sync can't reach) |
| 🔐 Auth | Cloudflare Access (Zero Trust) gates the UI/API; no app-level password |
| 🖥️ UI | Minimal dark interface — Inbox, Sent, Compose, Month-view Calendar |
flowchart LR
A[📧 Someone emails<br/>you@yourdomain.com] -->|Email Routing| W[☁️ Worker]
W -->|parse + store| DB[(D1)]
UI[🖥️ Built-in UI] -->|REST API| W
W -->|send_email| OUT[📤 Outbound]
CRON[⏰ Cron */10m] --> W
GCAL[📅 Google invite] -->|text/calendar| W
W -->|METHOD:REPLY| GCAL2[Organizer sees<br/>✅ Accepted]
git clone https://github.com/DevArtsLab/devarts-mail.git
cd devarts-mail
./install.shThat's it. The installer:
pnpm install- generates
.dev.varsfor local secrets - runs
wrangler loginif needed (browser OAuth — that's the only interaction) - provisions D1, runs migrations, uploads secrets, deploys, and creates the Email Routing rule
you@domain → worker
The deploy alone does not open the mailbox: the UI/API is gated by
Cloudflare Access (Zero Trust), not a password. Before first sign-in,
create a self-hosted Access application covering mail.devartslab.com
and devarts-mail.devartslab.workers.dev, with an allow policy for your
email (optionally restricted by country), then set
CF_ACCESS_TEAM_DOMAIN + CF_ACCESS_AUD in wrangler.jsonc and redeploy.
Hosted requests fail closed if either value is missing; pnpm dev bypasses
auth locally via CF_ACCESS_BYPASS.
Everything lives in wrangler.jsonc — worker, assets, D1, send_email, cron, routes, and all app variables:
| Var | Default | Meaning |
|---|---|---|
MAIL_DOMAIN |
devartslab.com |
Your domain |
PRIMARY_ADDRESS |
amir@devartslab.com |
Primary send/receive identity |
DISPLAY_NAME |
Amir | DevArts Lab |
From-name on outgoing mail |
AUTO_ACCEPT_INVITES |
"false" |
Auto-accept incoming invites |
INVITE_REMINDER_MINUTES |
"30" |
Reminder email before events (0 = off) |
CF_ACCESS_TEAM_DOMAIN |
— | Zero Trust team domain for JWT verify |
CF_ACCESS_AUD |
— | Access application AUD tag |
ATTIO_SYNC_ENABLED |
"true" |
Mirror mail/calendar to Attio CRM (trial: set "false" when it ends) |
ATTIO_IGNORE_ADDRESSES |
"" |
Extra "self" addresses excluded from sync |
| Secret | Meaning |
|---|---|
EXTRA_IDENTITIES |
Extra send/receive addresses: alias@domain=Name;alias2@domain — kept secret so your addresses stay out of this repo. Each gets a routing rule via pnpm run setup. |
GCAL_FORWARD_TO |
Personal Gmail that gets read-only METHOD:PUBLISH copies of incoming invites/cancels — Gmail shows "Add to calendar" with no RSVP path and the address is never sent to organizers. |
ATTIO_ACCESS_TOKEN |
Attio workspace access token (Settings → Developers → Access tokens) for the CRM sync. Scopes: record_permission:read-write, object_configuration:read, note:read-write, meeting:read-write. |
Secrets live in .dev.vars locally / wrangler secret in prod.
Attio sync notes: deleting an email or event in the UI also deletes its
Attio copy (notes on person records, meetings). Cancelling an invite
removes the Attio meeting. ATTIO_SYNC_ENABLED is "true" for the
trial — set it to "false" in wrangler.jsonc when the trial ends.
├── wrangler.jsonc # ← THE unified config
├── install.sh # one-command setup
├── migrations/ # D1 schema
├── scripts/setup.mjs # provisioning engine (idempotent)
├── src/
│ ├── index.ts # entry: fetch + email + scheduled
│ ├── inbound.ts # inbound parse → store → RSVP side-effects
│ ├── mail.ts # postal-mime in / mimetext + send_email out
│ ├── ical.ts # RFC 5545 iCal parser + generator
│ ├── api.ts # REST API for the UI
│ ├── auth.ts # cookie session auth
│ └── db.ts # D1 access layer
├── public/ # the UI (served via Workers Assets)
└── test/ # vitest unit tests
pnpm dev # local dev server
pnpm test # unit tests
pnpm typecheck # TypeScript check
pnpm deploy # deploy
pnpm run setup # full re-provisioning (idempotent)
pnpm run migrate:remote # apply D1 migrationsPush to main auto-deploys via GitHub Actions (set repo secrets
CLOUDFLARE_API_TOKEN + CLOUDFLARE_ACCOUNT_ID).
- Clone →
./install.shafter editingwrangler.jsoncvars(MAIL_DOMAIN,PRIMARY_ADDRESS,DISPLAY_NAME,D1_DATABASE_NAME) - Done — your mail + calendar runs on Cloudflare, data stays in your D1.
- Replies to calendar invites are real RFC 5546
METHOD:REPLYemails withIn-Reply-Tothreading — Gmail/Google Calendar records your status. - Email Sending requires the
cf-bounceDNS records on your domain — don't delete them. - Full calendar export:
GET /api/calendar.ics.
