This project is a simple journaling app built with Vite + React + TypeScript and uses Supabase as its backend. Users can currently add entries via a form where they choose a date, write some text, and optionally attach photos. Entries are stored in a Supabase table called journal_entries, which has fields for date, text content, an array of base64‑encoded photo strings and optional social‑media links.
We’d like to allow users to email a photo to a special address and have that photo appear as a new journal entry automatically. To do this, we’ll use Resend’s inbound email feature to receive the email and process its attachments.
Requirements:
Set up a Resend inbound email address and webhook for the email.received event.
Add a server‑side endpoint or Supabase Edge Function that Resend can call via the webhook. It should verify the webhook signature, fetch any image attachments (only JPEG or PNG), convert them to base64, and create a new journal_entries row using the email subject as the entry’s text and the current date.
Use environment variables for RESEND_API_KEY, RESEND_WEBHOOK_SECRET, SUPABASE_SERVICE_ROLE_KEY, etc., and document them in the README.
Write a simple test (mocking Resend and Supabase) to verify that the handler inserts an entry when given a sample payload.
Success means that sending an email with a photo to the Resend address creates a corresponding entry in Supabase and all builds and tests pass.