How quietfox42/midnight-card works
Midnight Card is a public, temporary-email service: a visitor gets a random or custom address, incoming mail is parsed and stored, and the browser polls to display messages and extracted verification codes or links. The Worker handles email events, API requests, and scheduled cleanup; D1 holds mail, while static assets serve the web app. The graph preserves both the main receive-and-view journey and address customization, extraction, and retention. Some relationships are documented in the README or source index; unsampled implementation details are not inferred.
Main entry points: App.tsx Web app · index.ts Worker entry · 0001_init.sql D1 mail database · email.ts Email handler
Components 20
Web experience
- Web app
src/web/App.tsx - Address rules
src/shared/address.ts - Address controls
src/web/components/PrefixSheet.tsx - Address card
src/web/components/card/MidnightCard.tsx - Inbox polling
src/web/lib/useInbox.ts - API client
src/web/lib/api.ts - Inbox list
src/web/components/Inbox.tsx - Mail detail
src/web/components/MailDetail.tsx
Mail processing
- Email handler
src/worker/email.ts - Code and link extraction
src/worker/extract.ts
Worker runtime
- Worker entry
src/worker/index.ts - HTTP API
src/worker/api.ts - Expiry cleanup
src/worker/cleanup.ts - Runtime config
src/worker/env.ts
Mail state
- D1 mail database
migrations/0001_init.sql
Other components
- Visitor
- Mail sender
- Email Routing
- Static assets
- Hourly Cron
Connections 24
- Visitor → Static assets: opens app
README.md - Static assets → Web app: serves
README.md - Web app → API client: requests config
src/web/App.tsx - Web app → Address card: renders
src/web/App.tsx - Web app → Inbox list: renders
src/web/App.tsx - Web app → Address controls: opens
src/web/App.tsx - Web app → Address rules: validates prefix
src/web/App.tsx - Web app → Inbox polling: starts polling
src/web/App.tsx - Inbox list → Mail detail: opens message
src/web/components/Inbox.tsx - Inbox polling → API client: fetches pages
src/web/lib/useInbox.ts - API client → Worker entry: calls /api
README.md - Visitor → Email Routing: sends mail
README.md - Email Routing → Worker entry: routes email
README.md - Worker entry → Email handler: dispatches email
src/worker/index.ts - Worker entry → HTTP API: dispatches HTTP
src/worker/index.ts - Worker entry → Expiry cleanup: runs scheduled cleanup
src/worker/index.ts - Email handler → Code and link extraction: extracts content
src/worker/email.ts - Email handler → D1 mail database: stores mail
README.md - HTTP API → D1 mail database: reads mail
README.md - Expiry cleanup → D1 mail database: deletes expired mail
README.md - Hourly Cron → Worker entry: triggers hourly
README.md - Worker entry → Runtime config: loads settings
src/worker/index.ts - Runtime config → Address rules: uses shared rules
src/worker/env.ts - Code and link extraction → D1 mail database: persists extracted fields
README.md