Invoice Ninja self-hosted: Invoicing and Time Tracking
What This Article Covers
- What Invoice Ninja is: Open-source invoicing software for freelancers and small businesses.
- Docker setup and configuration.
- Invoices, quotes, time tracking, client portal.
- REST API for automation: generate invoices from workflows.
- AI integration: quote text generation, payment reminders, reporting.
Introduction
Invoice Ninja is the most established open-source solution for invoicing, quotes, and time tracking. It’s actively maintained and developed, includes a client portal so customers can view invoices and pay online. For freelancers and small firms that don’t want to hand their data over to Lexoffice or sevDesk, it’s the standard choice.
The REST API makes it a building block for automation: deals from Twenty become invoices in Invoice Ninja; completed projects get logged as time entries and converted to invoices.
Common Use Cases
- Freelancer invoicing: Quotes transformed into invoices, track payments.
- Time tracking: Log hours per project, convert them directly into invoice line items.
- Recurring invoices: Automate retainers, subscriptions, and repeating billing.
- Client portal: Customers view history, download PDFs, pay online.
- Workflow automation: Win a deal in your CRM, automatically generate an invoice.
Installation: Docker
services:
invoiceninja:
image: invoiceninja/invoiceninja:5
ports:
- "127.0.0.1:8082:80"
environment:
- APP_URL=https://rechnungen.deine-domain.de
- APP_KEY=base64:generierter-key
- DB_HOST=db
- DB_DATABASE=invoiceninja
- DB_USERNAME=ninja
- DB_PASSWORD=geheim
- MAIL_MAILER=smtp
- MAIL_HOST=smtp.dein-server.de
- MAIL_PORT=587
- MAIL_USERNAME=...
- MAIL_PASSWORD=...
- MAIL_FROM_ADDRESS=rechnung@deine-domain.de
volumes:
- ninja_public:/var/www/app/public
- ninja_storage:/var/www/app/storage
depends_on: [db]
restart: always
db:
image: mysql:8
environment:
MYSQL_DATABASE: invoiceninja
MYSQL_USER: ninja
MYSQL_PASSWORD: geheim
MYSQL_ROOT_PASSWORD: root-geheim
volumes: [db_data:/var/lib/mysql]
restart: always
volumes:
ninja_public:
ninja_storage:
db_data:
Generate APP_KEY: docker run --rm invoiceninja/invoiceninja:5 php artisan key:generate --show
Basic Configuration
After startup, run the setup wizard to create your company, upload a logo, configure tax rates (19%/7% for Germany), customize invoice templates, and add payment methods (bank transfer, Stripe, PayPal).
Germany notes: Invoice Ninja supports DSGVO-compliant invoices with required fields (VAT ID, tax number, sequential invoice numbering). Check GoBD compliance with your accountant; the software helps, but responsibility is yours.
REST API: Creating Invoices Programmatically
import requests
IN = "https://rechnungen.deine-domain.de"
HEADERS = {"X-API-TOKEN": "dein-api-token",
"X-Requested-With": "XMLHttpRequest",
"Content-Type": "application/json"}
# Create a client
requests.post(f"{IN}/api/v1/clients", headers=HEADERS, json={
"name": "Musterfirma GmbH",
"contacts": [{"email": "buchhaltung@muster.de"}]
})
# Create an invoice
requests.post(f"{IN}/api/v1/invoices", headers=HEADERS, json={
"client_id": "CLIENT_ID",
"line_items": [{
"product_key": "Beratung",
"notes": "KI-Consulting März",
"quantity": 8,
"unit_cost": 120.00,
}]
})
n8n Workflow: CRM to Invoice
Twenty webhook: Deal won
│
▼
Map data (Company → Client, Amount → Items)
│
▼
Invoice Ninja API: Find/create client → Create invoice
│
▼
Optional: Ollama generates personalized invoice notes
│
▼
Invoice sent via email to client (Invoice Ninja handles it)
AI Integration
- Quote text: Ollama generates custom quote text from project briefs.
- Payment reminders: AI writes tactful payment reminders with tone adjusted for escalation level.
- Time entry summaries: AI condenses work logs into clean invoice line items.
- Receipt categorization: Incoming documents (OCR via Stirling-PDF) automatically sorted and assigned.
Security and Legal Compliance
- GoBD: Invoices must be archived immutably. Invoice Ninja supports this via sequential numbering and PDF archiving, but consult your accountant.
- HTTPS and authentication: Financial data requires TLS and strong passwords/2FA.
- Backups: Protect database and storage, see Backup.
- Access control: Keep invoicing software internal or behind a VPN, never expose it to the public internet.
Further Reading
- IRC-Coding.de: Programming tutorials: REST APIs, PDF generation.
- Twenty CRM: Converting deals to invoices.
- Stirling-PDF: PDF processing.
- n8n: Workflow automation.
- Docker: Deployment.
Key Takeaways:
- Invoice Ninja is open-source invoicing, time tracking, and client portal in one.
- REST API integrates with automation workflows (CRM to invoice).
- Mind GoBD and DSGVO compliance; use TLS, backups, and restricted access.
- For freelancers and small businesses, it’s the standard self-hosted alternative to Lexoffice or sevDesk.
- AI can generate quote copy, write payment reminders, and categorize receipts.
FAQ
Is Invoice Ninja GoBD-compliant?
Does it include time tracking?
Online payments?
Invoice Ninja or Lexoffice?
Multiple users?
Sources and Further Reading
- Invoice Ninja: GitHub.
- Invoice Ninja Docs: Documentation.
- IRC-Coding.de: Programming tutorials.


