From 00e69a8d90cae0e2e4e9281d21088d76c55539ad Mon Sep 17 00:00:00 2001 From: Bert Hausmans Date: Wed, 20 May 2026 23:01:18 +0200 Subject: [PATCH] chore: docker-compose mailpit, env.example, README auth section --- .env.example | 15 +++++++++++++++ README.md | 32 ++++++++++++++++++++++++++++++++ docker-compose.yml | 10 ++++++++++ 3 files changed, 57 insertions(+) create mode 100644 .env.example create mode 100644 docker-compose.yml diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..5d8691f --- /dev/null +++ b/.env.example @@ -0,0 +1,15 @@ +# Backend +PORT=3000 +DB_PATH=./data/flashcard.db +APP_URL=http://localhost:5173 + +# Cookies +COOKIE_SECURE=false + +# SMTP (Mailpit dev defaults; override in production with SES SMTP) +SMTP_HOST=localhost +SMTP_PORT=1025 +SMTP_SECURE=false +SMTP_USER= +SMTP_PASS= +SMTP_FROM="Flashcard " diff --git a/README.md b/README.md index c04b8c1..e53e19c 100644 --- a/README.md +++ b/README.md @@ -55,3 +55,35 @@ Leitner-systeem met 5 dozen: - Fout → terug naar doos 1 Binnen een sessie wordt een fout beantwoorde kaart na ~3 posities opnieuw getoond. + +## Auth & e-mail + +De applicatie zit achter een login. Eerste registratie (POST /api/auth/register via /register pagina) wordt automatisch sysadmin. + +### Lokaal e-mail (Mailpit) + +```bash +docker compose up -d mailpit +# Web UI: http://localhost:8025 +# SMTP: localhost:1025 +``` + +Kopieer `.env.example` → `.env` in repo-root, of zet de waarden inline. + +### Productie (Amazon SES) + +In productie: + +``` +SMTP_HOST=email-smtp.eu-west-1.amazonaws.com +SMTP_PORT=587 +SMTP_USER= +SMTP_PASS= +SMTP_FROM="Flashcard " +COOKIE_SECURE=true +APP_URL=https://yourdomain.com +``` + +### Fallback (geen SMTP) + +Als `SMTP_HOST` ontbreekt, schrijft het systeem de e-mails (incl. links) naar de server-log. diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..64fb08d --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,10 @@ +services: + mailpit: + image: axllent/mailpit:latest + container_name: flashcard-mailpit + ports: + - "1025:1025" # SMTP + - "8025:8025" # Web UI + environment: + MP_MAX_MESSAGES: 5000 + restart: unless-stopped