chore: docker-compose mailpit, env.example, README auth section

This commit is contained in:
2026-05-20 23:01:18 +02:00
parent bb0d9d7d01
commit 00e69a8d90
3 changed files with 57 additions and 0 deletions

15
.env.example Normal file
View File

@@ -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 <noreply@flashcard.local>"

View File

@@ -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=<SES SMTP username>
SMTP_PASS=<SES SMTP password>
SMTP_FROM="Flashcard <noreply@yourdomain.com>"
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.

10
docker-compose.yml Normal file
View File

@@ -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