# ARCHITEKTUR.md – Systemarchitektur & Datenkonzept ## 1. Übersicht Formeleon folgt einer entkoppelten Architektur: * **Public Form API (`/api/v1`):** Nimmt Formular-Submissions von externen Mandanten-Webseiten entgegen. * **Admin Dashboard (`/admin`):** Verwaltung von Mandanten, Formular-Layouts und Submissions. * **Form Embed Snippet:** Ein leichtes JS-Script, das dynamisch Formulare rendert und Sicherheits-Tokens verarbeitet. --- ## 2. Ordnerstruktur (Blueprint-Muster) ```text formeleon/ ├── AGENTS.md ├── ARCHITEKTUR.md ├── README.md ├── README.EN.md ├── docker-compose.yml ├── Dockerfile ├── requirements.txt ├── app.py # Anwendungs-Initialisierung & Blueprint-Registration ├── models.py # SQLAlchemy Datenmodelle ├── routes/ │ ├── api.py # Blueprint: Public Submissions & Handshake (@api_bp) │ ├── admin.py # Blueprint: Admin Panel & Config (@admin_bp) │ └── auth.py # Blueprint: OIDC / Zitadel Handler (@auth_bp) ├── services/ │ ├── recaptcha.py # reCAPTCHA Validation & Mocking │ ├── exporter.py # Stream-Export Logik (CSV/JSON/YAML) │ └── mailer.py # E-Mail Versand (SMTP Relay) ├── static/ │ ├── js/ # Snippets & Mithril.js Admin UI │ └── css/ # Bootstrap / Custom Styles └── docs/ ├── coding-standards.md # Header & PyDoc Spezifikation ├── deployment.md └── dev-guide.md ``` --- ## 3. Datenmodell (SQLAlchemy) Das Datenmodell nutzt ein flexibles JSON-Payload-Feld für die dynamischen Formulareingaben, um Schema-Änderungen pro Mandant ohne Tabellen-Umbau zu ermöglichen. * **Tenant:** ID, Name, Public Key, Allowed Origins. * **FormConfig:** ID, Tenant_ID, Name, Form-Structure (JSON). * **Submission:** ID, FormConfig_ID, Payload (JSON), IP_Hash, Created_At.