# ashardeveloper/rechnungspilot architecture

> Architecture diagram of the GitHub repository ashardeveloper/rechnungspilot, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ashardeveloper/rechnungspilot
- Repository: https://github.com/ashardeveloper/rechnungspilot

## Overview

RechnungsPilot DE is a login-protected invoicing workspace for German freelancers and small businesses. Users manage customer records, create and track invoices through lifecycle stages, then download issued invoices as PDF or technical XRechnung XML drafts. Invoice history, archiving, sender details, and numbering support that workflow. The graph includes documented capabilities whose source was not sampled; their exact page or module wiring is therefore left out where it cannot be verified.

Main entry points: [`web/src/server/db/prisma.ts`](https://github.com/ashardeveloper/rechnungspilot/blob/main/web/src/server/db/prisma.ts) (Prisma client), [`web/src/server/invoices/invoice-repository.ts`](https://github.com/ashardeveloper/rechnungspilot/blob/main/web/src/server/invoices/invoice-repository.ts) (Invoice repository), [`web/src/app/actions/invoice-actions.ts`](https://github.com/ashardeveloper/rechnungspilot/blob/main/web/src/app/actions/invoice-actions.ts) (Invoice actions), [`web/src/app/invoices/[invoiceId]/pdf/route.ts`](https://github.com/ashardeveloper/rechnungspilot/blob/main/web/src/app/invoices/%5BinvoiceId%5D/pdf/route.ts) (PDF download)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workspace["Workspace UI"]
  node_dashboard["Dashboard<br/>[page.tsx]"]
  node_customer_ui["Customer management"]
  node_customer_form["Customer form"]
  node_invoice_form["Invoice creation"]
  node_invoice_list["Invoice listing"]
  node_invoice_detail["Invoice detail"]
  node_archive_ui["Archive management"]
end

subgraph group_actions["Server Actions"]
  node_customer_actions["Customer actions"]
  node_invoice_actions["Invoice actions<br/>[invoice-actions.ts]"]
  node_audit_actions["Audit actions"]
  node_settings_actions["Settings actions"]
end

subgraph group_domain["Invoice Domain"]
  node_customer_domain["Customer records<br/>[customer.ts]"]
  node_invoice_domain["Invoice model<br/>[invoice.ts]"]
  node_calculations["Invoice calculations"]
  node_lifecycle["Lifecycle rules"]
  node_validation["Invoice validation"]
end

subgraph group_services["Server Services"]
  node_customer_repo["Customer repository"]
  node_invoice_repo["Invoice repository"]
  node_audit_repo["Audit repository"]
  node_number_settings["Invoice numbering"]
  node_profile_settings["Business profile"]
  node_auth["Authentication<br/>[current-user.ts]"]
  node_pdf_route["PDF download<br/>[route.ts]"]
  node_pdf_render["PDF rendering<br/>[invoice-pdf.ts]"]
  node_xml_route["XRechnung download<br/>[route.ts]"]
  node_xml_render["XML rendering<br/>[xrechnung-xml.ts]"]
end

subgraph group_persistence["Persistence"]
  node_prisma["Prisma client<br/>[prisma.ts]"]
  node_database[("PostgreSQL")]
end

node_user(("Business user"))

node_user -->|"opens workspace"| node_dashboard
node_user -->|"manages customers"| node_customer_ui
node_user -->|"enters details"| node_customer_form
node_user -->|"creates invoice"| node_invoice_form
node_user -->|"reviews invoices"| node_invoice_list
node_user -->|"updates invoice"| node_invoice_detail
node_user -->|"restores invoice"| node_archive_ui
node_customer_ui -->|"searches"| node_customer_actions
node_customer_form -->|"submits details"| node_customer_actions
node_customer_actions -->|"reads and writes"| node_customer_repo
node_customer_repo -->|"queries"| node_prisma
node_customer_repo -->|"maps records"| node_customer_domain
node_invoice_form -->|"submits invoice"| node_invoice_actions
node_invoice_list -->|"searches and resets"| node_invoice_actions
node_invoice_detail -->|"updates and archives"| node_invoice_actions
node_archive_ui -->|"restores invoice"| node_invoice_actions
node_invoice_detail -->|"checks transitions"| node_lifecycle
node_invoice_actions -->|"reads and writes"| node_invoice_repo
node_invoice_repo -->|"queries"| node_prisma
node_invoice_repo -->|"maps records"| node_invoice_domain
node_invoice_detail -->|"loads history"| node_audit_actions
node_audit_actions -->|"reads events"| node_audit_repo
node_audit_repo -->|"queries"| node_prisma
node_settings_actions -->|"manages numbering"| node_number_settings
node_settings_actions -->|"manages profile"| node_profile_settings
node_number_settings -->|"reads and updates"| node_prisma
node_profile_settings -->|"reads and updates"| node_prisma
node_pdf_route -->|"gets user"| node_auth
node_pdf_route -->|"loads invoices"| node_invoice_repo
node_pdf_route -->|"renders PDF"| node_pdf_render
node_pdf_route -->|"records download"| node_audit_repo
node_xml_route -->|"gets user"| node_auth
node_xml_route -->|"loads invoices"| node_invoice_repo
node_xml_route -->|"renders XML"| node_xml_render
node_xml_route -->|"records download"| node_audit_repo
node_prisma -->|"persists data"| node_database

click node_dashboard "https://github.com/ashardeveloper/rechnungspilot/blob/main/web/src/app/page.tsx"
click node_customer_ui "https://github.com/ashardeveloper/rechnungspilot/blob/main/web/src/app/customers/customer-management-client.tsx"
click node_customer_form "https://github.com/ashardeveloper/rechnungspilot/blob/main/web/src/app/customers/new/new-customer-client.tsx"
click node_invoice_form "https://github.com/ashardeveloper/rechnungspilot/blob/main/web/src/app/invoices/new/new-invoice-client.tsx"
click node_invoice_list "https://github.com/ashardeveloper/rechnungspilot/blob/main/web/src/app/invoices/invoice-list-client.tsx"
click node_invoice_detail "https://github.com/ashardeveloper/rechnungspilot/blob/main/web/src/app/invoices/%5BinvoiceId%5D/invoice-detail-client.tsx"
click node_archive_ui "https://github.com/ashardeveloper/rechnungspilot/blob/main/web/src/app/invoices/archived/archived-invoices-client.tsx"
click node_customer_actions "https://github.com/ashardeveloper/rechnungspilot/blob/main/web/src/app/actions/customer-actions.ts"
click node_invoice_actions "https://github.com/ashardeveloper/rechnungspilot/blob/main/web/src/app/actions/invoice-actions.ts"
click node_audit_actions "https://github.com/ashardeveloper/rechnungspilot/blob/main/web/src/app/actions/invoice-audit-actions.ts"
click node_settings_actions "https://github.com/ashardeveloper/rechnungspilot/blob/main/web/src/app/actions/settings-actions.ts"
click node_customer_domain "https://github.com/ashardeveloper/rechnungspilot/blob/main/web/src/domain/customer.ts"
click node_invoice_domain "https://github.com/ashardeveloper/rechnungspilot/blob/main/web/src/domain/invoice.ts"
click node_calculations "https://github.com/ashardeveloper/rechnungspilot/blob/main/web/src/domain/invoice-calculations.ts"
click node_lifecycle "https://github.com/ashardeveloper/rechnungspilot/blob/main/web/src/domain/invoice-lifecycle.ts"
click node_validation "https://github.com/ashardeveloper/rechnungspilot/blob/main/web/src/domain/invoice-validation.ts"
click node_customer_repo "https://github.com/ashardeveloper/rechnungspilot/blob/main/web/src/server/customers/customer-repository.ts"
click node_invoice_repo "https://github.com/ashardeveloper/rechnungspilot/blob/main/web/src/server/invoices/invoice-repository.ts"
click node_audit_repo "https://github.com/ashardeveloper/rechnungspilot/blob/main/web/src/server/invoices/invoice-audit-repository.ts"
click node_number_settings "https://github.com/ashardeveloper/rechnungspilot/blob/main/web/src/server/settings/invoice-number-settings-repository.ts"
click node_profile_settings "https://github.com/ashardeveloper/rechnungspilot/blob/main/web/src/server/settings/business-profile-repository.ts"
click node_auth "https://github.com/ashardeveloper/rechnungspilot/blob/main/web/src/server/auth/current-user.ts"
click node_pdf_route "https://github.com/ashardeveloper/rechnungspilot/blob/main/web/src/app/invoices/%5BinvoiceId%5D/pdf/route.ts"
click node_pdf_render "https://github.com/ashardeveloper/rechnungspilot/blob/main/web/src/server/pdf/invoice-pdf.ts"
click node_xml_route "https://github.com/ashardeveloper/rechnungspilot/blob/main/web/src/app/invoices/%5BinvoiceId%5D/xrechnung/route.ts"
click node_xml_render "https://github.com/ashardeveloper/rechnungspilot/blob/main/web/src/server/xrechnung/xrechnung-xml.ts"
click node_prisma "https://github.com/ashardeveloper/rechnungspilot/blob/main/web/src/server/db/prisma.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_dashboard,node_customer_ui,node_customer_form,node_invoice_form,node_invoice_list,node_invoice_detail,node_archive_ui,node_user toneBlue
class node_customer_actions,node_invoice_actions,node_audit_actions,node_settings_actions toneAmber
class node_customer_domain,node_invoice_domain,node_calculations,node_lifecycle,node_validation toneMint
class node_customer_repo,node_invoice_repo,node_audit_repo,node_number_settings,node_profile_settings,node_auth,node_pdf_route,node_pdf_render,node_xml_route,node_xml_render toneRose
class node_prisma,node_database toneIndigo
```

## Components

### Workspace UI

- [Dashboard](https://github.com/ashardeveloper/rechnungspilot/blob/main/web/src/app/page.tsx): `web/src/app/page.tsx`
- [Customer management](https://github.com/ashardeveloper/rechnungspilot/blob/main/web/src/app/customers/customer-management-client.tsx): `web/src/app/customers/customer-management-client.tsx`
- [Customer form](https://github.com/ashardeveloper/rechnungspilot/blob/main/web/src/app/customers/new/new-customer-client.tsx): `web/src/app/customers/new/new-customer-client.tsx`
- [Invoice creation](https://github.com/ashardeveloper/rechnungspilot/blob/main/web/src/app/invoices/new/new-invoice-client.tsx): `web/src/app/invoices/new/new-invoice-client.tsx`
- [Invoice listing](https://github.com/ashardeveloper/rechnungspilot/blob/main/web/src/app/invoices/invoice-list-client.tsx): `web/src/app/invoices/invoice-list-client.tsx`
- [Invoice detail](https://github.com/ashardeveloper/rechnungspilot/blob/main/web/src/app/invoices/%5BinvoiceId%5D/invoice-detail-client.tsx): `web/src/app/invoices/[invoiceId]/invoice-detail-client.tsx`
- [Archive management](https://github.com/ashardeveloper/rechnungspilot/blob/main/web/src/app/invoices/archived/archived-invoices-client.tsx): `web/src/app/invoices/archived/archived-invoices-client.tsx`

### Server Actions

- [Customer actions](https://github.com/ashardeveloper/rechnungspilot/blob/main/web/src/app/actions/customer-actions.ts): `web/src/app/actions/customer-actions.ts`
- [Invoice actions](https://github.com/ashardeveloper/rechnungspilot/blob/main/web/src/app/actions/invoice-actions.ts): `web/src/app/actions/invoice-actions.ts`
- [Audit actions](https://github.com/ashardeveloper/rechnungspilot/blob/main/web/src/app/actions/invoice-audit-actions.ts): `web/src/app/actions/invoice-audit-actions.ts`
- [Settings actions](https://github.com/ashardeveloper/rechnungspilot/blob/main/web/src/app/actions/settings-actions.ts): `web/src/app/actions/settings-actions.ts`

### Invoice Domain

- [Customer records](https://github.com/ashardeveloper/rechnungspilot/blob/main/web/src/domain/customer.ts): `web/src/domain/customer.ts`
- [Invoice model](https://github.com/ashardeveloper/rechnungspilot/blob/main/web/src/domain/invoice.ts): `web/src/domain/invoice.ts`
- [Invoice calculations](https://github.com/ashardeveloper/rechnungspilot/blob/main/web/src/domain/invoice-calculations.ts): `web/src/domain/invoice-calculations.ts`
- [Lifecycle rules](https://github.com/ashardeveloper/rechnungspilot/blob/main/web/src/domain/invoice-lifecycle.ts): `web/src/domain/invoice-lifecycle.ts`
- [Invoice validation](https://github.com/ashardeveloper/rechnungspilot/blob/main/web/src/domain/invoice-validation.ts): `web/src/domain/invoice-validation.ts`

### Server Services

- [Customer repository](https://github.com/ashardeveloper/rechnungspilot/blob/main/web/src/server/customers/customer-repository.ts): `web/src/server/customers/customer-repository.ts`
- [Invoice repository](https://github.com/ashardeveloper/rechnungspilot/blob/main/web/src/server/invoices/invoice-repository.ts): `web/src/server/invoices/invoice-repository.ts`
- [Audit repository](https://github.com/ashardeveloper/rechnungspilot/blob/main/web/src/server/invoices/invoice-audit-repository.ts): `web/src/server/invoices/invoice-audit-repository.ts`
- [Invoice numbering](https://github.com/ashardeveloper/rechnungspilot/blob/main/web/src/server/settings/invoice-number-settings-repository.ts): `web/src/server/settings/invoice-number-settings-repository.ts`
- [Business profile](https://github.com/ashardeveloper/rechnungspilot/blob/main/web/src/server/settings/business-profile-repository.ts): `web/src/server/settings/business-profile-repository.ts`
- [Authentication](https://github.com/ashardeveloper/rechnungspilot/blob/main/web/src/server/auth/current-user.ts): `web/src/server/auth/current-user.ts`
- [PDF download](https://github.com/ashardeveloper/rechnungspilot/blob/main/web/src/app/invoices/%5BinvoiceId%5D/pdf/route.ts): `web/src/app/invoices/[invoiceId]/pdf/route.ts`
- [PDF rendering](https://github.com/ashardeveloper/rechnungspilot/blob/main/web/src/server/pdf/invoice-pdf.ts): `web/src/server/pdf/invoice-pdf.ts`
- [XRechnung download](https://github.com/ashardeveloper/rechnungspilot/blob/main/web/src/app/invoices/%5BinvoiceId%5D/xrechnung/route.ts): `web/src/app/invoices/[invoiceId]/xrechnung/route.ts`
- [XML rendering](https://github.com/ashardeveloper/rechnungspilot/blob/main/web/src/server/xrechnung/xrechnung-xml.ts): `web/src/server/xrechnung/xrechnung-xml.ts`

### Persistence

- [Prisma client](https://github.com/ashardeveloper/rechnungspilot/blob/main/web/src/server/db/prisma.ts): `web/src/server/db/prisma.ts`
- **PostgreSQL**

### Other components

- **Business user**

## Connections

- Business user → Dashboard: opens workspace
- Business user → Customer management: manages customers
- Business user → Customer form: enters details
- Business user → Invoice creation: creates invoice
- Business user → Invoice listing: reviews invoices
- Business user → Invoice detail: updates invoice
- Business user → Archive management: restores invoice
- Customer management → Customer actions: searches
- Customer form → Customer actions: submits details
- Customer actions → Customer repository: reads and writes
- Customer repository → Prisma client: queries
- Customer repository → Customer records: maps records
- Invoice creation → Invoice actions: submits invoice
- Invoice listing → Invoice actions: searches and resets
- Invoice detail → Invoice actions: updates and archives
- Archive management → Invoice actions: restores invoice
- Invoice detail → Lifecycle rules: checks transitions
- Invoice actions → Invoice repository: reads and writes
- Invoice repository → Prisma client: queries
- Invoice repository → Invoice model: maps records
- Invoice detail → Audit actions: loads history
- Audit actions → Audit repository: reads events
- Audit repository → Prisma client: queries
- Settings actions → Invoice numbering: manages numbering
- Settings actions → Business profile: manages profile
- Invoice numbering → Prisma client: reads and updates
- Business profile → Prisma client: reads and updates
- PDF download → Authentication: gets user
- PDF download → Invoice repository: loads invoices
- PDF download → PDF rendering: renders PDF
- PDF download → Audit repository: records download
- XRechnung download → Authentication: gets user
- XRechnung download → Invoice repository: loads invoices
- XRechnung download → XML rendering: renders XML
- XRechnung download → Audit repository: records download
- Prisma client → PostgreSQL: persists data
