addcefe70b
Implements Phase 1 of groombook/groombook#4 — automated email reminders for upcoming appointments, with booking confirmations sent immediately on creation. - **DB**: new `reminder_logs` table tracks sent reminders per appointment (unique on appointmentId+type prevents duplicates); `clients` gains `email_opt_out` boolean (migration 0004_reminder_logs) - **Email service**: `apps/api/src/services/email.ts` — nodemailer SMTP transport (disabled when SMTP_HOST is unset, so self-hosted installs without email config are unaffected); confirmation and reminder email templates included - **Reminder scheduler**: `apps/api/src/services/reminders.ts` — node-cron job runs every minute, checks for appointments in the upcoming reminder windows (default: 24 h and 2 h), sends emails for opted-in clients, and records sends in reminder_logs (idempotent via ON CONFLICT DO NOTHING) - **Confirmation email**: sent fire-and-forget after successful appointment creation (both single and recurring); never blocks the API response - **Config**: SMTP_HOST, SMTP_PORT, SMTP_SECURE, SMTP_USER, SMTP_PASS, SMTP_FROM, REMINDER_HOURS_EARLY, REMINDER_HOURS_LATE env vars documented in .env.example; all optional — feature is silently disabled without them - **Types**: Client.emailOptOut field added to shared types package Co-authored-by: Groom Book CTO <cto@groombook.app> Co-authored-by: Paperclip <noreply@paperclip.ing>
31 lines
1.7 KiB
Bash
31 lines
1.7 KiB
Bash
# Groom Book — Environment Variables
|
|
# Copy this file to .env and adjust values for your deployment.
|
|
|
|
# ── Database ──────────────────────────────────────────────────────────────────
|
|
DATABASE_URL=postgres://groombook:groombook@postgres:5432/groombook
|
|
|
|
# ── Authentication ────────────────────────────────────────────────────────────
|
|
# Set AUTH_DISABLED=true to skip OIDC validation (useful for local dev/Docker).
|
|
# In production, configure an Authentik instance and set these values.
|
|
AUTH_DISABLED=false
|
|
OIDC_ISSUER=https://authentik.example.com
|
|
OIDC_AUDIENCE=groombook
|
|
|
|
# ── API ───────────────────────────────────────────────────────────────────────
|
|
PORT=3000
|
|
CORS_ORIGIN=http://localhost:8080
|
|
|
|
# ── Email Reminders (optional) ────────────────────────────────────────────────
|
|
# Leave SMTP_HOST unset to disable email notifications entirely.
|
|
# When configured, appointment confirmation and reminder emails are sent via SMTP.
|
|
SMTP_HOST=smtp.example.com
|
|
SMTP_PORT=587
|
|
SMTP_SECURE=false
|
|
SMTP_USER=user@example.com
|
|
SMTP_PASS=password
|
|
SMTP_FROM="Groom Book <noreply@example.com>"
|
|
|
|
# Hours before appointment to send reminder emails (defaults: 24 and 2)
|
|
REMINDER_HOURS_EARLY=24
|
|
REMINDER_HOURS_LATE=2
|