How achouvardas/elefthero works
Purpose and runtime
Elefthero is a self-hosted Greek small-business invoicing system that creates invoices, validates business/customer data, submits myDATA XML to AADE, and preserves submission evidence. The application is a Python/Flask server, principally entered through app.py, rendering server-side HTML from templates/. SQLite is the local system of record; no frontend build pipeline is present.
Application boundary and UI
app.py is the central application boundary: it serves setup, authentication, settings, invoices, clients, templates, logs, and administration. Browser workflows are server-rendered through shared layout and feature pages such as templates/base.html, templates/invoice_form.html, and templates/dashboard.html. The first-run setup path is represented by templates/setup.html; subsequent configuration is managed through authenticated settings pages.
Identity, setup, and operational security
First-run setup establishes the local business and administrator context. Authentication supports login, roles, optional TOTP challenge/enrollment, rate limiting, CSRF protection, and optional Turnstile. Relevant UI boundaries are templates/login.html, templates/two_factor_setup.html, and templates/users.html. Secrets for AADE and optional integrations are configured in-app and encrypted locally; bootstrap/runtime environment values are exemplified in .env.example.
Invoice lifecycle and myDATA submission
The core control flow is invoice draft creation/editing, validation of document/VAT/classification/payment rules, myDATA XML construction, and explicit Test or Production AADE REST submission. AADE results—MARK, UID, QR URL, response payload, and failures—feed back into the invoice record and audit trail. Invoice list/detail/form paths are grounded in templates/invoices.html, templates/invoice_detail.html, and templates/invoice_form.html. Cancellation, credit-document reuse, templates, and resend operate on this persisted invoice lifecycle.
Records, auditability, and outputs
SQLite retains business data, clients, invoices, configuration, and inspectable sent/received AADE XML. Developer-facing submission/audit history is exposed at templates/logs.html, while invoice delivery artifacts are rendered as inline PDFs and can be resent through Resend. PDF generation uses ReportLab; XML and AADE identifiers remain associated with invoice detail rather than being delegated to an opaque external platform.
Client and reporting domain
Client records support saved counterparties, addresses, VIES VAT validation, and optional ΓΕΜΗ enrichment before invoice use. Client management and analytical views are represented by templates/clients.html and templates/client_invoices.html. Dashboard aggregation and customer/invoice statistics are surfaced through templates/dashboard.html; reusable invoice patterns are managed at templates/templates.html.
Deployment and external infrastructure
Production is intended to run Flask behind Gunicorn under systemd, with Cloudflare Tunnel exposing the service rather than requiring a separate web application tier. Service definitions are deploy/systemd/myaade.service and deploy/systemd/myaade-cloudflared.service; tunnel configuration is based on cloudflared/config.example.yml and scripts/run-tunnel.sh. External boundaries are AADE myDATA REST/XML, VIES, optional ΓΕΜΗ, Resend email, optional Cloudflare Turnstile, and Cloudflare Tunnel.
Main entry points: app.py Flask routes · myaade.service Gunicorn / systemd · myaade-cloudflared.service Cloudflare Tunnel · base.html Shared layout
Components 18
Flask application
- Flask routes · Central setup, auth, invoicing, administration, and API boundary.
app.py - Setup & access control · Establishes business/admin context and enforces roles, TOTP, CSRF, and rate limits.
- Invoice lifecycle · Draft, validate, submit, resend, cancel, and credit-document handling.
- myDATA XML builder · Builds validated invoice XML and records submission outcomes.
- PDF output · Renders invoice delivery artifacts inline.
Server-rendered UI
- Shared layout
templates/base.html - Invoice pages · Invoice list, detail, and editor pages.
templates/invoice_form.html - Setup, auth & admin pages · Includes setup, login, two-factor enrollment, and users.
templates/setup.html - Dashboard & reporting
templates/dashboard.html - Submission audit history · Inspectable sent/received XML and submission history.
templates/logs.html
Local records
- SQLite system of record · Stores business, clients, invoices, encrypted settings, XML, and audit evidence.
External services
- AADE myDATA · Test and Production invoice submission endpoint.
- VIES & ΓΕΜΗ · VAT validation and optional client enrichment.
- Resend
- Cloudflare Turnstile
Deployment
- Gunicorn / systemd
deploy/systemd/myaade.service - Cloudflare Tunnel
deploy/systemd/myaade-cloudflared.service
Other components
- Browser user
Connections 20
- Browser user → Cloudflare Tunnel: HTTPS access
- Cloudflare Tunnel → Gunicorn / systemd: forwards traffic
- Gunicorn / systemd → Flask routes: runs
- Browser user → Flask routes: server requests
- Flask routes → Setup & access control: applies
- Flask routes → Shared layout: renders
- Flask routes → Invoice pages: renders
- Flask routes → Setup, auth & admin pages: renders
- Flask routes → Dashboard & reporting: renders
- Flask routes → Submission audit history: renders
- Flask routes → Invoice lifecycle: drives
- Invoice lifecycle → SQLite system of record: persists invoices and evidence
- Invoice lifecycle → myDATA XML builder: validates and builds XML
- myDATA XML builder → AADE myDATA: submits Test or Production XML
- AADE myDATA → SQLite system of record: MARK, UID, QR and responses
- Invoice lifecycle → PDF output: renders invoice PDF
- Invoice lifecycle → Resend: sends invoice email
- Flask routes → VIES & ΓΕΜΗ: validates/enriches clients
- Setup & access control → SQLite system of record: stores local context and encrypted secrets
- Setup & access control → Cloudflare Turnstile: optional challenge