OpenInvoice Germany — free <a href=self-hostable invoicing with XRechnung / EN 16931, GoBD and § 14 UStG" width="100%" />

Free, self-hostable open-source invoicing software for Germany. E-invoice (XRechnung / ZUGFeRD) · GoBD · § 14 UStG · small business § 19 · GDPR

 ·  Licence: AGPL-3.0  ·  English · Deutsch

Why? From 2025 German B2B must be able to receive structured e-invoices; from 2027/2028 sending becomes mandatory. Many freelancers and SMEs pay a monthly fee just to stay compliant. This project makes it free and open — you host it yourself, your data stays with you.

⚠️ Not tax or legal advice. GoBD compliance additionally requires the user's own process documentation (Verfahrensdokumentation). All legal references with sources live in COMPLIANCE.md (single source of truth). No warranty.


🗣️ Talk to it with Claude Code (MCP)

Connect your local instance to Claude Code or Claude Desktop and create legally sound invoices just by describing them:

"Create an invoice to Müller GmbH for 3 hours of consulting at €95, delivered today, finalise it and export the XRechnung."

Claude calls the right tools in order (create customer/service → invoice → finalise → PDF + XRechnung). Finalising enforces the § 14 UStG mandatory fields — non-compliant invoices are rejected. The invoice is created and stored locally. Setup + examples: docs/MCP.md.

npm run mcp   # start the MCP server (stdio) / wire it into Claude Code via .mcp.json

🔒 Data protection (GDPR). The app core runs 100% locally, but the MCP feature is optional and not automatically GDPR-compliant: when you let a cloud LLM (e.g. Claude) create the invoice, the data you describe (customer name, items, amounts = personal data) is sent to that provider and processed on your behalf (Art. 28 GDPR). For business use with real personal data, either use a local model (the MCP server is model-agnostic) or a commercial API with a DPA — note that Claude Code/Desktop always use Anthropic's cloud and the consumer Pro/Max subscription has no DPA. List the provider as a sub-processor in your records and privacy policy. Details: docs/MCP.md. Not legal advice.

Features

  • Voice control via MCP (Claude Code/Desktop) — see above.
  • GoBD core: finalisation (draft → immutable), gapless number ranges, append-only audit hash-chain, cancellation instead of deletion.
  • § 14 UStG: mandatory-field check blocks finalisation when data is missing.
  • Tax schemes: standard rating (19/7/0), small business (§ 19), reverse charge (§ 13b), intra-EU supply, margin scheme (§ 25a), small amount (§ 33).
  • E-invoice: XRechnung (UBL, EN 16931) and ZUGFeRD/Factur-X hybrid PDF (embedded EN-16931 CII), both validated against the official Schematron rules (SaxonJS, no Java) — cross-checked by the KoSIT validator in CI.
  • Documents: quotes, order confirmations, pro-forma — convertible into an invoice.
  • Payments & dunning: record (partial) payments; staged reminders (payment reminder → 1st/2nd dunning) with default interest (§ 288 BGB, day-accurate) + €40 flat fee (B2B), each as a PDF.
  • Recurring invoices / subscriptions: weekly–yearly templates, optional auto-finalisation, run via UI/MCP or cron (npm run recurring:run).
  • Credit notes: full cancellation or partial credit, original stays finalised.
  • PDF export ("other invoice") with all mandatory fields.
  • Self-hosted: SQLite solo without a server or PostgreSQL via Docker.
  • Sign-in: built-in admin account (scrypt hash + signed session cookie) — app and API protected.

Status

MVP. What works: master data/customers/products, quotes & invoices, draft → finalise → cancel, partial credit notes, payments + dunning (§ 288 BGB), recurring invoices/subscriptions, PDF + XRechnung + ZUGFeRD export, GoBD number range + audit. On the roadmap: DATEV/CSV export, B2G/Leitweg-ID EAS codes, OSS/ZM, multi-user, built-in scheduler. See docs/ARCHITEKTUR.md (MVP / stage 2 / stage 3) and the honest list of known limitations.

Tech stack

Next.js 16 (App Router) · TypeScript (strict) · Prisma 6 · SQLite/PostgreSQL · TailwindCSS · Zod · Vitest. Money as integer cents, quantities as integer milli-units, tax per EN-16931 group — see docs/ARCHITEKTUR.md.

Quick start (solo / SQLite — no server needed)

git clone https://github.com/automationsmanufaktur-labs/open-invoice-germany.git
cd open-invoice-germany
npm install
cp .env.example .env            # DATABASE_URL="file:./dev.db" is the default
npm run db:migrate              # create the schema
npm run db:seed                 # optional demo data
npm run dev                     # http://localhost:3000

The SQLite file lives at prisma/dev.db and belongs to you alone. On first start you create your admin account under /setup (after npm run db:seed there is a demo login [email protected] / demo1234 — please change it). For production: set AUTH_SECRET in .env (openssl rand -base64 32) and run behind HTTPS.

In the app: Settings (create company) → CustomersNew invoice → add line items → Finalise (assigns the number, makes it GoBD-immutable) → PDF and XRechnung export. Full step-by-step guide: docs/ANLEITUNG.md (German).

With Docker (PostgreSQL + ZUGFeRD sidecar)

cp .env.example .env            # switch DATABASE_URL to the postgresql:// line
docker compose up --build

docker-compose.yml starts the app + PostgreSQL + the Mustang sidecar (XRechnung/ZUGFeRD generation & validation). The Postgres schema lives in prisma/schema.postgres.prisma (model-identical, only a different datasource).

Tests

npm test          # Vitest: money, tax, number ranges, GoBD immutability, hash-chain, EN 16931

The integration tests prove, among other things, gapless, immutable number ranges and that finalised invoices cannot be edited.

E-invoice validation

npm run validate:erechnung      # official Schematron rules, no Java

Validates the generated XRechnung against the official Schematron rules in pure Node via SaxonJS:

  • EN-16931 UBL Schematron (ConnectingEurope) and
  • XRechnung CIUS / BR-DE (official KoSIT config 3.0.2; requires unzip).

This is essentially the same Schematron check as the KoSIT validator — and runs as a hard gate in CI. The KoSIT validator (Java) additionally runs there as an independent cross-check (also covering the upstream XSD check). Fast core rules are part of npm test.