# sebastianoprita/invoiceflow architecture

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

- Interactive diagram: https://gitdiagram.com/sebastianoprita/invoiceflow
- Repository: https://github.com/sebastianoprita/invoiceflow

## Overview

InvoiceFlow is a multi-service invoicing platform. The documented business flow begins with invoice creation or payment recording, then propagates events to update invoice status and trigger notifications, reporting projections, and due-date reminders. The tree shows APIs and query handlers for identity, customers, products, and invoices, but not the event infrastructure or several documented worker services. Edges for those domain flows are therefore based on the README; source-level edges are limited to relationships visible in excerpts or the source index.

Main entry points: [`src/Services/InvoiceFlow.Invoices/InvoiceFlow.Invoices.Api/Controllers/InvoicesController.cs`](https://github.com/sebastianoprita/invoiceflow/blob/main/src/Services/InvoiceFlow.Invoices/InvoiceFlow.Invoices.Api/Controllers/InvoicesController.cs) (Invoicing Service), [`src/Services/InvoiceFlow.Customers/InvoiceFlow.Customers.Application/Features/Customers/Queries/GetCustomerById/GetCustomerByIdQueryHandler.cs`](https://github.com/sebastianoprita/invoiceflow/blob/main/src/Services/InvoiceFlow.Customers/InvoiceFlow.Customers.Application/Features/Customers/Queries/GetCustomerById/GetCustomerByIdQueryHandler.cs) (Customer Queries), [`src/Services/InvoiceFlow.Invoices/InvoiceFlow.Invoices.Application/Features/Invoices/Queries/GetInvoiceById/GetInvoiceByIdQueryHandler.cs`](https://github.com/sebastianoprita/invoiceflow/blob/main/src/Services/InvoiceFlow.Invoices/InvoiceFlow.Invoices.Application/Features/Invoices/Queries/GetInvoiceById/GetInvoiceByIdQueryHandler.cs) (Invoice Queries), [`src/Gateway/InvoiceFlow.Gateway/Program.cs`](https://github.com/sebastianoprita/invoiceflow/blob/main/src/Gateway/InvoiceFlow.Gateway/Program.cs) (API Gateway)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Entry and Identity"]
  node_gateway["API Gateway<br/>[Program.cs]"]
  node_identity["Identity Service<br/>[Program.cs]"]
  node_identity_queries["Identity Queries"]
end

subgraph group_catalog["Tenant Data"]
  node_customers["Customers Service<br/>[Program.cs]"]
  node_customer_queries["Customer Queries"]
  node_products["Products Service<br/>[Program.cs]"]
  node_product_queries["Product Queries"]
end

subgraph group_billing["Billing"]
  node_invoicing["Invoicing Service"]
  node_invoice_queries["Invoice Queries"]
  node_payments["Payments Service<br/>[Program.cs]"]
end

subgraph group_async["Event Consumers"]
  node_notifications["Notifications"]
  node_reporting[("Reporting")]
  node_reminder["Reminder Worker"]
  node_invoice_events["Invoice Events"]
  node_payment_events["Payment Events"]
end

subgraph group_shared["Shared Application"]
  node_customer_repo["Customer Repository Contract"]
  node_invoice_repo["Invoice Repository Contract"]
  node_result["Result Type<br/>[Result.cs]"]
end

node_user(("User"))

node_user -.->|"requests APIs"| node_gateway
node_gateway -.->|"routes requests"| node_identity
node_identity_queries -.->|"serves identity data"| node_identity
node_customer_queries -->|"queries repository"| node_customer_repo
node_customer_queries -->|"returns result"| node_result
node_product_queries -.->|"serves product data"| node_products
node_invoice_queries -->|"queries repository"| node_invoice_repo
node_invoice_queries -->|"returns result"| node_result
node_invoicing -->|"publishes issued"| node_invoice_events
node_invoice_events -->|"triggers email"| node_notifications
node_invoice_events -->|"projects dashboard"| node_reporting
node_invoice_events -->|"schedules reminder"| node_reminder
node_payments -->|"publishes recorded"| node_payment_events
node_payment_events -->|"updates balances"| node_invoicing
node_invoicing -->|"publishes status"| node_invoice_events
node_payment_events -->|"triggers status email"| node_notifications
node_payment_events -->|"updates read model"| node_reporting

click node_gateway "https://github.com/sebastianoprita/invoiceflow/blob/main/src/Gateway/InvoiceFlow.Gateway/Program.cs"
click node_identity "https://github.com/sebastianoprita/invoiceflow/blob/main/src/Services/InvoiceFlow.Identity/InvoiceFlow.Identity.Api/Program.cs"
click node_identity_queries "https://github.com/sebastianoprita/invoiceflow/blob/main/src/Services/InvoiceFlow.Identity/InvoiceFlow.Identity.Application/Features/PlatformUsers/Queries/GetPlatformUserById/GetPlatformUserByIdQueryHandler.cs"
click node_customers "https://github.com/sebastianoprita/invoiceflow/blob/main/src/Services/InvoiceFlow.Customers/InvoiceFlow.Customers.Api/Program.cs"
click node_customer_queries "https://github.com/sebastianoprita/invoiceflow/blob/main/src/Services/InvoiceFlow.Customers/InvoiceFlow.Customers.Application/Features/Customers/Queries/GetCustomerById/GetCustomerByIdQueryHandler.cs"
click node_products "https://github.com/sebastianoprita/invoiceflow/blob/main/src/Services/InvoiceFlow.Products/InvoiceFlow.Products.Api/Program.cs"
click node_product_queries "https://github.com/sebastianoprita/invoiceflow/blob/main/src/Services/InvoiceFlow.Products/InvoiceFlow.Products.Application/Features/Products/Queries/GetProductById/GetProductByIdQueryHandler.cs"
click node_invoicing "https://github.com/sebastianoprita/invoiceflow/blob/main/src/Services/InvoiceFlow.Invoices/InvoiceFlow.Invoices.Api/Controllers/InvoicesController.cs"
click node_invoice_queries "https://github.com/sebastianoprita/invoiceflow/blob/main/src/Services/InvoiceFlow.Invoices/InvoiceFlow.Invoices.Application/Features/Invoices/Queries/GetInvoiceById/GetInvoiceByIdQueryHandler.cs"
click node_payments "https://github.com/sebastianoprita/invoiceflow/blob/main/src/Services/InvoiceFlow.Payments/InvoiceFlow.Payments.Api/Program.cs"
click node_customer_repo "https://github.com/sebastianoprita/invoiceflow/blob/main/src/Services/InvoiceFlow.Customers/InvoiceFlow.Customers.Application/Common/Abstractions/Repositories/ICustomersRepository.cs"
click node_invoice_repo "https://github.com/sebastianoprita/invoiceflow/blob/main/src/Services/InvoiceFlow.Invoices/InvoiceFlow.Invoices.Application/Common/Abstractions/Repositories/IInvoiceRepository.cs"
click node_result "https://github.com/sebastianoprita/invoiceflow/blob/main/src/BuildingBlocks/InvoiceFlow.BuildingBlocks.Application/ApplicationErrors/Result.cs"

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_gateway,node_identity,node_identity_queries,node_user toneBlue
class node_customers,node_customer_queries,node_products,node_product_queries toneAmber
class node_invoicing,node_invoice_queries,node_payments toneMint
class node_notifications,node_reporting,node_reminder,node_invoice_events,node_payment_events toneRose
class node_customer_repo,node_invoice_repo,node_result toneIndigo
```

## Components

### Entry and Identity

- [API Gateway](https://github.com/sebastianoprita/invoiceflow/blob/main/src/Gateway/InvoiceFlow.Gateway/Program.cs): `src/Gateway/InvoiceFlow.Gateway/Program.cs`
- [Identity Service](https://github.com/sebastianoprita/invoiceflow/blob/main/src/Services/InvoiceFlow.Identity/InvoiceFlow.Identity.Api/Program.cs): `src/Services/InvoiceFlow.Identity/InvoiceFlow.Identity.Api/Program.cs`
- [Identity Queries](https://github.com/sebastianoprita/invoiceflow/blob/main/src/Services/InvoiceFlow.Identity/InvoiceFlow.Identity.Application/Features/PlatformUsers/Queries/GetPlatformUserById/GetPlatformUserByIdQueryHandler.cs): `src/Services/InvoiceFlow.Identity/InvoiceFlow.Identity.Application/Features/PlatformUsers/Queries/GetPlatformUserById/GetPlatformUserByIdQueryHandler.cs`

### Tenant Data

- [Customers Service](https://github.com/sebastianoprita/invoiceflow/blob/main/src/Services/InvoiceFlow.Customers/InvoiceFlow.Customers.Api/Program.cs): `src/Services/InvoiceFlow.Customers/InvoiceFlow.Customers.Api/Program.cs`
- [Customer Queries](https://github.com/sebastianoprita/invoiceflow/blob/main/src/Services/InvoiceFlow.Customers/InvoiceFlow.Customers.Application/Features/Customers/Queries/GetCustomerById/GetCustomerByIdQueryHandler.cs): `src/Services/InvoiceFlow.Customers/InvoiceFlow.Customers.Application/Features/Customers/Queries/GetCustomerById/GetCustomerByIdQueryHandler.cs`
- [Products Service](https://github.com/sebastianoprita/invoiceflow/blob/main/src/Services/InvoiceFlow.Products/InvoiceFlow.Products.Api/Program.cs): `src/Services/InvoiceFlow.Products/InvoiceFlow.Products.Api/Program.cs`
- [Product Queries](https://github.com/sebastianoprita/invoiceflow/blob/main/src/Services/InvoiceFlow.Products/InvoiceFlow.Products.Application/Features/Products/Queries/GetProductById/GetProductByIdQueryHandler.cs): `src/Services/InvoiceFlow.Products/InvoiceFlow.Products.Application/Features/Products/Queries/GetProductById/GetProductByIdQueryHandler.cs`

### Billing

- [Invoicing Service](https://github.com/sebastianoprita/invoiceflow/blob/main/src/Services/InvoiceFlow.Invoices/InvoiceFlow.Invoices.Api/Controllers/InvoicesController.cs): `src/Services/InvoiceFlow.Invoices/InvoiceFlow.Invoices.Api/Controllers/InvoicesController.cs`
- [Invoice Queries](https://github.com/sebastianoprita/invoiceflow/blob/main/src/Services/InvoiceFlow.Invoices/InvoiceFlow.Invoices.Application/Features/Invoices/Queries/GetInvoiceById/GetInvoiceByIdQueryHandler.cs): `src/Services/InvoiceFlow.Invoices/InvoiceFlow.Invoices.Application/Features/Invoices/Queries/GetInvoiceById/GetInvoiceByIdQueryHandler.cs`
- [Payments Service](https://github.com/sebastianoprita/invoiceflow/blob/main/src/Services/InvoiceFlow.Payments/InvoiceFlow.Payments.Api/Program.cs): `src/Services/InvoiceFlow.Payments/InvoiceFlow.Payments.Api/Program.cs`

### Event Consumers

- **Notifications**
- **Reporting**
- **Reminder Worker**
- **Invoice Events**
- **Payment Events**

### Shared Application

- [Customer Repository Contract](https://github.com/sebastianoprita/invoiceflow/blob/main/src/Services/InvoiceFlow.Customers/InvoiceFlow.Customers.Application/Common/Abstractions/Repositories/ICustomersRepository.cs): `src/Services/InvoiceFlow.Customers/InvoiceFlow.Customers.Application/Common/Abstractions/Repositories/ICustomersRepository.cs`
- [Invoice Repository Contract](https://github.com/sebastianoprita/invoiceflow/blob/main/src/Services/InvoiceFlow.Invoices/InvoiceFlow.Invoices.Application/Common/Abstractions/Repositories/IInvoiceRepository.cs): `src/Services/InvoiceFlow.Invoices/InvoiceFlow.Invoices.Application/Common/Abstractions/Repositories/IInvoiceRepository.cs`
- [Result Type](https://github.com/sebastianoprita/invoiceflow/blob/main/src/BuildingBlocks/InvoiceFlow.BuildingBlocks.Application/ApplicationErrors/Result.cs): `src/BuildingBlocks/InvoiceFlow.BuildingBlocks.Application/ApplicationErrors/Result.cs`

### Other components

- **User**

## Connections

- User → API Gateway: requests APIs
- API Gateway → Identity Service: routes requests
- Identity Queries → Identity Service: serves identity data
- Customer Queries → Customer Repository Contract: queries repository (evidence: `src/Services/InvoiceFlow.Customers/InvoiceFlow.Customers.Application/Features/Customers/Queries/GetCustomerById/GetCustomerByIdQueryHandler.cs`)
- Customer Queries → Result Type: returns result (evidence: `src/Services/InvoiceFlow.Customers/InvoiceFlow.Customers.Application/Features/Customers/Queries/GetCustomerById/GetCustomerByIdQueryHandler.cs`)
- Product Queries → Products Service: serves product data
- Invoice Queries → Invoice Repository Contract: queries repository (evidence: `src/Services/InvoiceFlow.Invoices/InvoiceFlow.Invoices.Application/Features/Invoices/Queries/GetInvoiceById/GetInvoiceByIdQueryHandler.cs`)
- Invoice Queries → Result Type: returns result (evidence: `src/Services/InvoiceFlow.Invoices/InvoiceFlow.Invoices.Application/Features/Invoices/Queries/GetInvoiceById/GetInvoiceByIdQueryHandler.cs`)
- Invoicing Service → Invoice Events: publishes issued
- Invoice Events → Notifications: triggers email
- Invoice Events → Reporting: projects dashboard
- Invoice Events → Reminder Worker: schedules reminder
- Payments Service → Payment Events: publishes recorded
- Payment Events → Invoicing Service: updates balances
- Invoicing Service → Invoice Events: publishes status
- Payment Events → Notifications: triggers status email
- Payment Events → Reporting: updates read model
