0009. Newsletter sign-up works before the API exists, without pretending
Context
The user wants a newsletter pop-up on load plus an inline call to action. There's no backend yet; "the api will be coming soon".
Options
- Fake success: say "You're subscribed" and drop the email. Misleading.
- Hide the form until the API exists: loses early interest.
- Use a third-party form service now: adds a vendor decision the user hasn't made.
- Keep the email in the visitor's browser and say so honestly; send it automatically once the API is configured.
Decision
Option 4. lib/newsletter.ts POSTs to NEXT_PUBLIC_NEWSLETTER_ENDPOINT when it's set. Until then, it saves the email in localStorage and tells the visitor it will be sent on their next visit after sign-ups open. The pop-up shows 2.5 seconds after load, never returns after subscribing, and stays away 14 days after it's closed.
Consequences
- Emails saved before launch only reach the list if that visitor returns after the API is live.
- Connecting the API is one environment variable and a rebuild.