code-kumpel/docs/round3.md

2.1 KiB
Raw Permalink Blame History

Runde 3 – Konfiguration (Brain auf Render, env-Variablen)

Feature env-Variablen ohne Config
Mail (Passwort vergessen, E-Mail-Bestätigung) RESEND_API_KEY oder SMTP_HOST, SMTP_PORT, SMTP_USER, SMTP_PASS; dazu MAIL_FROM (z. B. Code-Kumpel <noreply@deine-domain.de>) /auth/forgot → 503 mail_disabled, Button ausgeblendet; Bestätigung übersprungen. Dev: NODE_ENV=development oder MAIL_DEV_LOG=1 → Links nur im Server-Log
Links in Mails APP_URL (Default https://code-kumpel.onrender.com) –
GitHub-Login GITHUB_CLIENT_ID, GITHUB_CLIENT_SECRET – Callback: https://code-kumpel-brain.onrender.com/auth/oauth/github/callback Button ausgeblendet
Google-Login GOOGLE_CLIENT_ID, GOOGLE_CLIENT_SECRET – Redirect-URI: https://code-kumpel-brain.onrender.com/auth/oauth/google/callback Button ausgeblendet
Brain-URL für OAuth-Callbacks BRAIN_PUBLIC_URL (Default https://code-kumpel-brain.onrender.com) –
Sentry (optional) SENTRY_DSN_PUBLIC (Browser-DSN) nur eigener /errors-Endpoint
Fehlerliste lesen ADMIN_TOKEN → GET /errors mit Authorization: Bearer <ADMIN_TOKEN> gesperrt

Endpunkte

  • GET /auth/config – welche Features aktiv sind
  • POST /auth/forgot {email} · POST /auth/reset {token,password} (Token SHA-256-gehasht, 1 h, einmalig; beendet alle Sessions)
  • POST /auth/verify {token} · POST /auth/resend-verify (Bearer)
  • GET /auth/oauth/{github|google}/start?return=<App-URL> → Callback → #oauth_code= → POST /auth/oauth/exchange {code}
  • GET /leaderboard (Top 50) · POST /leaderboard {optIn,name,xp,level,streak} (Bearer)
  • GET /backups · POST /backups/restore {index} (Bearer; letzte 10 Stände, automatisch max. 1/Stunde)
  • POST /errors {message,stack,url,ua,platform,version} (rate-limitiert, Tokens werden geschwärzt)

GitHub Actions

  • vercel-deploy.yml: bei Push auf main → Tests → statischer Ordner → vercel deploy --prod (Secret VERCEL_TOKEN).
  • keep-alive.yml: alle 10 min GET /health am Brain.