Skip to content

Self-hosting (on-premises)

For organizations that may not send invoices to an external service. The same engine runs inside your network: API, MCP server, dashboard, official validators and the PDF/A checker. No invoice data leaves your infrastructure; the services make no outbound calls except the ones you configure (mail, webhooks).

Self-hosting is offered under an annual licence with installation and rule-set updates — write to [email protected]. How the licence works is described below.

What you get

Service Image Purpose
api built from the source REST API, MCP, jobs, webhooks
web built from the source dashboard, docs, public validator
validator built from the source; downloads the pinned rule sets at build time KoSIT validator 1.6.3 with XRechnung, Peppol BIS, Factur-X / ZUGFeRD, Facturae and KSeF configurations
pdfa verapdf/rest (pinned digest) PDF/A-3 check of ZUGFeRD PDFs
postgres postgres:17-alpine data
caddy (profile) caddy:2-alpine TLS reverse proxy when you do not have your own

Requirements

  • Linux host with Docker 24+ and Compose 2.20+; 2 vCPU, 4 GB RAM, 20 GB disk for up to roughly 100,000 documents per month.
  • Outbound HTTPS during the image build (rule-set downloads from GitHub, facturae.gob.es and crd.gov.pl, verified by SHA-256). For air-gapped sites we ship the built images instead, and rule-set updates as signed bundles.
  • At run time, only for the signing-certificate check of Facturae files: HTTPS to ec.europa.eu and tsl.digital.gob.es once a day (trusted lists), and HTTP(S) to the OCSP responders and CRLs named in signing certificates. TRUST_LISTS=false switches the trust check off (findings then list it as not checked); REVOCATION_CHECKS=false keeps the trusted lists but sends no OCSP / CRL requests.
  • An SMTP server for sign-in links (MAIL_DRIVER=smtp), or SSO in front of the dashboard on request.

Install

cp .env.example .env              # fill ENCRYPTION_KEY, KEY_PEPPER, IP_HASH_SALT, METRICS_TOKEN, POSTGRES_PASSWORD, APP_URL, SMTP_URL
docker compose --profile caddy up -d --build

APP_URL is your internal address (e.g. https://einvoice.intern.example). Behind your own reverse proxy, leave out the caddy profile and set TRUST_PROXY_HOPS to the number of proxies. Set PDFA_URL=http://pdfa:8080 (default in the compose file) to enable PDF/A checks.

Licence

Set SELF_HOSTED=true and point LICENCE_FILE at the licence file you received from us. The file is JSON signed with our Ed25519 key; the server holds only the public key and checks the signature, so the file cannot be changed. A licence names the licensee, its id, the issue and expiry dates, an optional cap on live documents per calendar month for the whole installation, and the included features (mcp, partner, bureau).

To mount it, put the file next to docker-compose.yml and add a docker-compose.override.yml:

services:
  api:
    environment:
      SELF_HOSTED: "true"
      LICENCE_FILE: /data/licence/licence.json
    volumes: ["./licence.json:/data/licence/licence.json:ro"]
State When What works
valid more than 30 days before the expiry date everything
expires soon 30 days before the expiry date until the expiry date itself everything; the owners of the installation's organizations get an e-mail 30 and 7 days before
grace period 14 days after the expiry date everything; the owners get an e-mail when it starts
expired after the grace period live keys get HTTP 402 licence_expired; test keys, the dashboard and reading or exporting stored data keep working
missing or invalid no file, unreadable, or a signature that does not match live keys get HTTP 402 licence_invalid; test keys keep working

Above the monthly cap, live documents get HTTP 402 licence_limit_reached until the next month (the count is refreshed once a minute). Without the mcp feature the MCP endpoint, and without partner the partner API and partner dashboard, answer HTTP 402 licence_feature_missing. The bureau feature is recorded in the licence and shown, but this release does not switch the bureau functions off.

The status is shown in Dashboard → Integration health and by the admin command:

docker compose exec api node apps/server/dist/cli/admin.js licence show

To renew, replace the file; the server reads it again within a minute, no restart needed. On the hosted service at einvoiceengine.com SELF_HOSTED is off and no licence is checked.

Updates of the rule sets

Rule sets are pinned in validator/artefacts.lock and the XRechnung configuration in validator/scripts/fetch.sh. Each release lists the rule-set bundle (ruleset.version, e.g. 2026-11) and is tested against the official test suites before it is published. Clients that pin rules= keep getting the old bundle until they move. There are two ways to update:

  • With internet access: a new release of this repository; rebuild the validator image and restart it.
  • Air-gapped: a signed rules bundle from us, installed without rebuilding any image.

A rules bundle is a .tgz file (a plain tar, readable with tar tzf) with the validator configuration (bis/, config/, extra/), a manifest listing the SHA-256 of every file, and an Ed25519 signature of the manifest made with the same key as the licence. To install one:

docker compose cp rules-2026-12.tgz api:/tmp/rules.tgz
docker compose exec -u root api chown einv:einv /data/rules      # once, before the first import
docker compose exec api node apps/server/dist/cli/admin.js rules import /tmp/rules.tgz
docker compose restart validator

rules import checks the signature, every file's checksum, that no file is missing or unlisted and that all paths stay inside the three configuration folders; nothing is written unless all checks pass. It then writes the files to a new folder in the rules volume and switches the current link to it in one step. The validator container mounts that volume read-only and, at start, uses current when it holds a complete configuration, otherwise the rule sets built into its image. A running validator does not pick up a new bundle: the restart is required. rules show prints the installed bundle. The previous folders stay in the volume (the last three are kept); to go back, point current at the older folder and restart the validator.

A bundle updates the validator's configuration (Schematron, XSD, scenarios), not the validator program, the API or the rule-set label it reports; those change with a release.

Data and backups

All documents are encrypted at rest (AES-256-GCM, ENCRYPTION_KEY); API keys are stored as HMAC hashes. Back up the Postgres volume and the storage volume together, and keep ENCRYPTION_KEY separately — documents cannot be read without it. deploy/backup.sh shows an encrypted nightly backup with age.

Licences of the bundled rule sets

KoSIT validator and configurations: Apache-2.0. CEN EN 16931 artefacts: EUPL-1.2. OpenPeppol rules: MPL-2.0. Factur-X / ZUGFeRD artefacts: FNFE-MPE / FeRD terms (packaged by the Mustang project, Apache-2.0). veraPDF: MPL-2.0 (chosen of GPLv3+/MPLv2+). Fonts: SIL OFL 1.1. sRGB profile: CC0.