Sostituisce Resend con Cloudflare Email Service.
Usa il binding EMAIL per contatti e newsletter, eliminando la dipendenza da Resend e dalle relative API key. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
21
README.md
21
README.md
@ -15,7 +15,7 @@ Sito istituzionale NexStudio basato su Astro, con deploy su Cloudflare e form co
|
||||
- Adapter Cloudflare (`@astrojs/cloudflare`)
|
||||
- Sitemap (`@astrojs/sitemap`)
|
||||
- Form backend su endpoint `/api/contact`
|
||||
- Turnstile + Resend per anti-spam e invio email
|
||||
- Turnstile + Cloudflare Email Service per anti-spam e invio email
|
||||
|
||||
## Struttura essenziale
|
||||
|
||||
@ -29,8 +29,7 @@ Sito istituzionale NexStudio basato su Astro, con deploy su Cloudflare e form co
|
||||
|
||||
- Node.js 20+
|
||||
- npm 10+
|
||||
- Account Cloudflare (Pages/Workers + Turnstile)
|
||||
- Account Resend (API key + sender verificato)
|
||||
- Account Cloudflare (Workers + Turnstile + Email Service con dominio onboardato, es. `nexstudio.ai`)
|
||||
|
||||
## Avvio locale
|
||||
|
||||
@ -63,8 +62,7 @@ Variabili pubbliche (frontend):
|
||||
Variabili server (Cloudflare/local):
|
||||
|
||||
- `CONTACT_FORM_MODE` (`dev` oppure `live`)
|
||||
- `CONTACT_FORM_RESEND_API_KEY`
|
||||
- `CONTACT_FORM_FROM_EMAIL` (consigliato: `no-reply@nexstudio.ai`)
|
||||
- `CONTACT_FORM_FROM_EMAIL` (consigliato: `no-reply@nexstudio.ai`, dominio verificato su Email Service)
|
||||
- `CONTACT_FORM_TO_EMAIL` (default destinatario, es. `info@nexstudio.ai`)
|
||||
- `CONTACT_FORM_TO_EMAIL_INFO` (opzionale, override esplicito per area "info")
|
||||
- `CONTACT_FORM_TO_EMAIL_PRIVACY`
|
||||
@ -74,7 +72,7 @@ Variabili server (Cloudflare/local):
|
||||
Comportamento:
|
||||
|
||||
- `dev`: accetta submit e scrive payload nei log (senza invio reale)
|
||||
- `live`: valida Turnstile e invia email via Resend
|
||||
- `live`: valida Turnstile e invia email via binding `EMAIL` (Cloudflare Email Service)
|
||||
|
||||
Routing pubblico consigliato (portale vetrina):
|
||||
|
||||
@ -91,12 +89,13 @@ Indirizzi consigliati portale:
|
||||
|
||||
## Configurazione newsletter
|
||||
|
||||
Sistema custom su Cloudflare D1 + Resend (double opt-in).
|
||||
Sistema custom su Cloudflare D1 + Cloudflare Email Service (double opt-in).
|
||||
|
||||
Prerequisito: dominio (es. `nexstudio.ai`) onboardato in **Email Service** con SPF/DKIM, e binding `send_email` → `EMAIL` nel Worker.
|
||||
|
||||
Variabili server:
|
||||
|
||||
- `NEWSLETTER_MODE` (`dev` oppure `live`; se assente usa `CONTACT_FORM_MODE`)
|
||||
- `NEWSLETTER_RESEND_API_KEY` (fallback: `CONTACT_FORM_RESEND_API_KEY`)
|
||||
- `NEWSLETTER_FROM_EMAIL` (fallback: `CONTACT_FORM_FROM_EMAIL`, consigliato `no-reply@nexstudio.ai`)
|
||||
- `NEWSLETTER_NOTIFY_TO_EMAIL` (notifiche admin; fallback: `CONTACT_FORM_TO_EMAIL`)
|
||||
- `NEWSLETTER_ADMIN_TOKEN` (Bearer token per endpoint admin)
|
||||
@ -114,6 +113,8 @@ Endpoint admin (header `Authorization: Bearer <NEWSLETTER_ADMIN_TOKEN>`):
|
||||
- `GET /api/newsletter/admin/subscribers?status=active|pending|unsubscribed`
|
||||
- `POST /api/newsletter/admin/send` — body JSON `{ "subject", "text", "html?", "dryRun?" }`
|
||||
|
||||
Nota: Email Service è pensato per email **transazionali** (conferme, contatti, notifiche). Le campagne marketing di massa non sono ancora il target ufficiale del servizio.
|
||||
|
||||
Database:
|
||||
|
||||
- D1 `nexstudio-newsletter` (binding `NEWSLETTER_DB`)
|
||||
@ -122,8 +123,8 @@ Database:
|
||||
|
||||
Comportamento:
|
||||
|
||||
- `dev`: accetta submit e logga (senza D1/Resend obbligatori)
|
||||
- `live`: scrive su D1, invia email di conferma via Resend, richiede binding D1
|
||||
- `dev`: accetta submit e logga (senza D1/Email obbligatori)
|
||||
- `live`: scrive su D1, invia email di conferma via Cloudflare Email Service, richiede binding D1 + EMAIL
|
||||
|
||||
## Deploy Cloudflare
|
||||
|
||||
|
||||
Reference in New Issue
Block a user