Low-Tech API-Gateway für digitale Souveränität
Find a file
2025-09-02 18:38:33 +02:00
.gitea/issue_template feat: Initiale Furt API-Gateway Projektstruktur 2025-06-03 16:39:17 +02:00
config feat(config): integrate rate limiting and CORS configuration from furt.conf 2025-08-29 20:01:47 +02:00
deployment/openbsd refactor: clean repository structure for v0.1.0 open source release 2025-08-14 09:36:55 +02:00
docs feat(config): implement multi-tenant config system (DAW/furt#89) 2025-08-15 16:18:55 +02:00
integrations feat(integration): add universal merkwerk binary detection 2025-08-28 17:34:36 +02:00
scripts fix(service): add service vs interactive detection to start.sh 2025-09-02 18:35:00 +02:00
src feat(config): integrate rate limiting and CORS configuration from furt.conf 2025-08-29 20:01:47 +02:00
tests refactor: clean repository structure for v0.1.0 open source release 2025-08-14 09:36:55 +02:00
.env.example feat(auth): implement complete API-key authentication with modular architecture (#47) 2025-06-24 22:01:38 +02:00
.env.production refactor: clean repository structure for v0.1.0 open source release 2025-08-14 09:36:55 +02:00
.gitignore fix(config): lua 5.1 compatibility and multi-tenant validation 2025-08-28 19:53:30 +02:00
.version_history chore: merkwerk auto-update 2025-09-02 18:36:07 +02:00
LICENSE feat: Initiale Furt API-Gateway Projektstruktur 2025-06-03 16:39:17 +02:00
README.md refactor: clean repository structure for v0.1.0 open source release 2025-08-14 09:36:55 +02:00
VERSION feat(core): implement file-based API versioning system (DAW/furt#83) 2025-08-15 16:57:33 +02:00

Furt API Gateway

HTTP-Server in Lua für Service-Integration

Überblick

Furt ist ein HTTP-Server der verschiedene Services unter einer API vereint. Aktuell unterstützt es Mail-Versendung über SMTP und bietet eine einfache JSON-API für Web-Integration.

Features

  • HTTP-Server mit JSON-APIs
  • Mail-Versendung über SMTP
  • Request-Routing und Authentication
  • Health-Check-Endpoints
  • Konfigurierbare Rate-Limiting
  • Hugo/Website-Integration

Dependencies

Erforderlich:

  • lua 5.4+
  • lua-socket (HTTP-Server)
  • lua-cjson (JSON-Verarbeitung)

Installation:

# Arch Linux
pacman -S lua lua-socket lua-cjson

# Ubuntu/Debian
apt install lua5.4 lua-socket lua-cjson

Installation

# Repository klonen
git clone <repository-url>
cd furt

# Scripts ausführbar machen
chmod +x scripts/*.sh

# Server starten
./scripts/start.sh

Server läuft auf: http://127.0.0.1:8080

API-Endpoints

Health Check

GET /health
→ {"status":"healthy","service":"furt","version":"1.0.0"}

Mail senden

POST /v1/mail/send
Content-Type: application/json

{
  "name": "Name",
  "email": "sender@example.com",
  "message": "Nachricht"
}{"success":true,"message":"Mail sent"}

Konfiguration

Environment Variables (.env):

FURT_MAIL_HOST=mail.example.com
FURT_MAIL_PORT=587
FURT_MAIL_USERNAME=user@example.com
FURT_MAIL_PASSWORD=password
FURT_MAIL_TO=empfaenger@example.com

Server-Config (config/server.lua):

  • Port und Host-Einstellungen
  • API-Key-Konfiguration
  • Rate-Limiting-Parameter

Testing

Automatische Tests:

lua tests/test_http.lua

Manuelle Tests:

./scripts/test_curl.sh

# Oder direkt:
curl -X POST http://127.0.0.1:8080/v1/mail/send \
     -H "Content-Type: application/json" \
     -d '{"name":"Test","email":"test@example.com","message":"Test"}'

Deployment

OpenBSD:

  • rc.d-Script in deployment/openbsd/
  • Systemd-Integration über Scripts

Production-Setup:

# Environment-Config kopieren
cp .env.example .env.production
# → SMTP-Credentials anpassen

# Production-Mode starten
export FURT_ENV=production
./scripts/start.sh

Projektstruktur

furt/
├── src/                    # Lua-Source-Code
│   ├── main.lua           # HTTP-Server
│   ├── routes/            # API-Endpoints
│   └── smtp.lua           # Mail-Integration
├── config/                # Konfiguration
├── scripts/               # Start/Test-Scripts
├── tests/                 # Test-Suite
└── deployment/            # System-Integration

Hugo-Integration

Shortcode-Beispiel:

<form action="http://your-server:8080/v1/mail/send" method="POST">
  <input name="name" type="text" required>
  <input name="email" type="email" required>
  <textarea name="message" required></textarea>
  <button type="submit">Senden</button>
</form>

Development

Code-Struktur:

  • Module unter 200 Zeilen
  • Funktionen unter 50 Zeilen
  • Klare Fehlerbehandlung
  • Testbare Komponenten

Dependencies minimal halten:

  • Nur lua-socket und lua-cjson
  • Keine externen HTTP-Libraries
  • Standard-Lua-Funktionen bevorzugen