kerimatilganandClaude Opus 4.8 a617846aa9 Kontaktformular-Dienst (Node + nodemailer), self-hosted für Coolify
- POST /api/kontakt: validiert, Honeypot-Spamschutz, Rate-Limit (5/10min)
- Versand per SMTP über eigenes Postfach, keine Speicherung/DB
- CORS auf die eigene Website beschränkt (ALLOWED_ORIGIN)
- Konfiguration komplett über Environment-Variablen (.env.example)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-03 15:13:38 +02:00

kontakt-api

Winziger, selbst gehosteter Dienst, der das Kontaktformular von atilgan-gartenbau.de entgegennimmt und als E-Mail über das eigene Postfach verschickt. Keine Datenbank, keine Speicherung – die Daten verlassen den eigenen Server nur als E-Mail an den Betreiber. Node.js + nodemailer.

Endpunkt

POST /api/kontakt — JSON: { name, email, telefon, betreff, nachricht, website } (website = Honeypot, muss leer sein). Antwort: { ok: true } oder Fehler. GET /health — Health-Check.

Deployment auf Coolify

  1. Neue Application aus diesem Repo (kontakt-api) anlegen.
  2. Build Pack: Nixpacks (erkennt Node automatisch, npm start). Kein Dockerfile nötig.
  3. Eine Domain/Subdomain vergeben, z. B. https://formular.atilgan-gartenbau.de.
  4. Environment-Variablen setzen (siehe .env.example), v. a.:
    • ALLOWED_ORIGIN = die Live-Domain der Website
    • SMTP_HOST, SMTP_PORT, SMTP_SECURE, SMTP_USER, SMTP_PASS
    • MAIL_TO (Standard: info@adnan-atilgan.de)
  5. Deployen. Test: GET https://formular.atilgan-gartenbau.de/health → { "ok": true }.

Anschließend im Website-Repo in js/main.js die Konstante KONTAKT_ENDPOINT auf https://<eure-subdomain>/api/kontakt setzen (falls abweichend).

Lokal testen

npm install
cp .env.example .env   # Werte eintragen
npm start
S
Description
Kleiner Mail-Weiterleitungs-Dienst für das Kontaktformular von atilgan-gartenbau.de (self-hosted auf Coolify)
Readme
43 KiB
0 Stars 1 Watchers 0 Forks
Languages
JavaScript 100%