90 lines
2.1 KiB
Markdown
90 lines
2.1 KiB
Markdown
# Flashcard
|
|
|
|
Single-user lokale flashcard webapplicatie met hiërarchische lessen, spaced repetition (Leitner), Excel import/export en statistieken.
|
|
|
|
## Snelstart
|
|
|
|
```bash
|
|
npm install
|
|
npm run db:migrate
|
|
npm run db:seed # optioneel, voegt demo data toe
|
|
npm run dev # backend op :3000, frontend op :5173
|
|
```
|
|
|
|
Open http://localhost:5173.
|
|
|
|
## Build (productie)
|
|
|
|
```bash
|
|
npm run build
|
|
npm start # backend serveert frontend + API op :3000
|
|
```
|
|
|
|
## Tests
|
|
|
|
```bash
|
|
npm test # unit tests (backend)
|
|
npm run e2e # playwright smoke
|
|
```
|
|
|
|
## Excel-formaat
|
|
|
|
Eén werkblad met header-rij. Kolommen:
|
|
|
|
- `question` (verplicht)
|
|
- `answer` (verplicht)
|
|
- `hint` (optioneel)
|
|
- `lesson_path` (optioneel, bv. `Spaans/Begroetingen`)
|
|
|
|
Bij import kun je kiezen of bestaande kaarten (zelfde vraag in dezelfde les) worden bijgewerkt en of onbekende lessen worden aangemaakt.
|
|
|
|
## Architectuur
|
|
|
|
Monorepo (npm workspaces):
|
|
|
|
- `packages/shared` — gedeelde TypeScript types en Zod schemas
|
|
- `packages/backend` — Express 4 + Drizzle ORM + better-sqlite3
|
|
- `packages/frontend` — React 18 + Vite + Tailwind + Zustand + Framer Motion
|
|
|
|
## Spaced repetition
|
|
|
|
Leitner-systeem met 5 dozen:
|
|
|
|
- Nieuwe kaart → doos 1 (direct due)
|
|
- Goed → naar volgende doos, langer wachten (1d, 3d, 7d, 14d)
|
|
- 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.
|