# ilhanbasic/pausalio-backend architecture

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

- Interactive diagram: https://gitdiagram.com/ilhanbasic/pausalio-backend
- Repository: https://github.com/ilhanbasic/pausalio-backend

## Overview

Pausalio is a backend for Serbian flat-rate entrepreneurs, supporting business administration, invoicing, financial records, and related workflows. The main path is an authenticated user calling the REST API, whose application services operate on business data persisted through repositories and EF Core. Separate capabilities include PDF invoice export, AI assistance, real-time chat, file storage, and scheduled reminder notifications. The README documents the broad layer and feature boundaries; sampled source confirms selected invoice, financial-context, and persistence relationships, so unsampled internal links are omitted.

Main entry points: [`Pausalio.API/Controllers`](https://github.com/ilhanbasic/pausalio-backend/tree/master/Pausalio.API/Controllers) (REST API), [`Pausalio.Infrastructure/Repositories/Implementations/UnitOfWork.cs`](https://github.com/ilhanbasic/pausalio-backend/blob/master/Pausalio.Infrastructure/Repositories/Implementations/UnitOfWork.cs) (Unit of work), [`Pausalio.Application/Services/Implementations/FinancialContextService.cs`](https://github.com/ilhanbasic/pausalio-backend/blob/master/Pausalio.Application/Services/Implementations/FinancialContextService.cs) (Financial context), [`Pausalio.API/Controllers/InvoiceController.cs`](https://github.com/ilhanbasic/pausalio-backend/blob/master/Pausalio.API/Controllers/InvoiceController.cs) (Invoice endpoints)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API and identity"]
  node_rest["REST API<br/>[Controllers]"]
  node_auth["Authentication<br/>[AuthController.cs]"]
  node_context["Business context"]
  node_invoice_api["Invoice endpoints"]
  node_chat_hub["SignalR chat<br/>[ChatHub.cs]"]
end

subgraph group_business["Business operations"]
  node_profiles["Business profiles"]
  node_clients["Clients<br/>[ClientService.cs]"]
  node_invoices["Invoices<br/>[InvoiceService.cs]"]
  node_pdf["PDF export"]
  node_expenses["Expenses<br/>[ExpenseService.cs]"]
  node_payments["Payments<br/>[PaymentService.cs]"]
  node_tax["Tax obligations"]
  node_reminders["Reminders<br/>[ReminderService.cs]"]
end

subgraph group_application["Application services"]
  node_financial_context["Financial context"]
  node_ai["AI assistant"]
  node_chat["Member chat<br/>[ChatService.cs]"]
  node_files["File handling"]
  node_exchange["Currency conversion"]
  node_localization["Localization"]
end

subgraph group_data["Persistence"]
  node_database[("MySQL database")]
  node_unitofwork["Unit of work<br/>[UnitOfWork.cs]"]
  node_repo_base["Base repository<br/>[Repository.cs]"]
  node_invoice_repo["Invoice repository"]
  node_expense_repo["Expense repository"]
  node_tax_repo["Tax repository"]
end

subgraph group_integrations["External integrations"]
  node_email["Email delivery<br/>[EmailService.cs]"]
  node_blob["Azure Blob"]
  node_openrouter["OpenRouter"]
  node_functions["Reminder scheduler"]
end

node_user(("Entrepreneur"))

node_user -->|"calls"| node_rest
node_rest -->|"authenticates via"| node_auth
node_rest -->|"routes invoice requests"| node_invoice_api
node_invoice_api -->|"calls"| node_invoices
node_invoice_api -->|"requests export"| node_pdf
node_rest -->|"serves profile operations"| node_profiles
node_rest -->|"serves client operations"| node_clients
node_rest -->|"serves expense operations"| node_expenses
node_rest -->|"serves payment operations"| node_payments
node_rest -->|"serves tax operations"| node_tax
node_rest -->|"serves reminder operations"| node_reminders
node_financial_context -->|"queries through"| node_unitofwork
node_financial_context -->|"reads invoices"| node_invoice_repo
node_financial_context -->|"reads expenses"| node_expense_repo
node_financial_context -->|"reads obligations"| node_tax_repo
node_rest -->|"serves AI assistant"| node_ai
node_ai -->|"calls model API"| node_openrouter
node_ai -.->|"uses financial data"| node_financial_context
node_rest -->|"offers real-time chat"| node_chat_hub
node_chat_hub -.->|"uses chat service"| node_chat
node_rest -->|"handles uploads"| node_files
node_files -->|"stores files"| node_blob
node_rest -->|"serves conversion"| node_exchange
node_functions -.->|"sends reminders"| node_email
node_invoices -.->|"persists records"| node_unitofwork
node_expenses -.->|"persists records"| node_unitofwork
node_payments -.->|"persists records"| node_unitofwork
node_tax -.->|"persists records"| node_unitofwork
node_unitofwork -.->|"exposes repositories"| node_repo_base
node_repo_base -->|"queries and updates"| node_database
node_context -.->|"scopes business requests"| node_rest

click node_rest "https://github.com/ilhanbasic/pausalio-backend/tree/master/Pausalio.API/Controllers"
click node_auth "https://github.com/ilhanbasic/pausalio-backend/blob/master/Pausalio.API/Controllers/AuthController.cs"
click node_context "https://github.com/ilhanbasic/pausalio-backend/blob/master/Pausalio.API/Middlewares/BusinessContextMiddleware.cs"
click node_profiles "https://github.com/ilhanbasic/pausalio-backend/blob/master/Pausalio.Application/Services/Implementations/BusinessProfileService.cs"
click node_clients "https://github.com/ilhanbasic/pausalio-backend/blob/master/Pausalio.Application/Services/Implementations/ClientService.cs"
click node_invoices "https://github.com/ilhanbasic/pausalio-backend/blob/master/Pausalio.Application/Services/Implementations/InvoiceService.cs"
click node_invoice_api "https://github.com/ilhanbasic/pausalio-backend/blob/master/Pausalio.API/Controllers/InvoiceController.cs"
click node_pdf "https://github.com/ilhanbasic/pausalio-backend/blob/master/Pausalio.Application/Services/Implementations/InvoiceExportService.cs"
click node_expenses "https://github.com/ilhanbasic/pausalio-backend/blob/master/Pausalio.Application/Services/Implementations/ExpenseService.cs"
click node_payments "https://github.com/ilhanbasic/pausalio-backend/blob/master/Pausalio.Application/Services/Implementations/PaymentService.cs"
click node_tax "https://github.com/ilhanbasic/pausalio-backend/blob/master/Pausalio.Application/Services/Implementations/TaxObligationService.cs"
click node_reminders "https://github.com/ilhanbasic/pausalio-backend/blob/master/Pausalio.Application/Services/Implementations/ReminderService.cs"
click node_financial_context "https://github.com/ilhanbasic/pausalio-backend/blob/master/Pausalio.Application/Services/Implementations/FinancialContextService.cs"
click node_ai "https://github.com/ilhanbasic/pausalio-backend/blob/master/Pausalio.Application/Services/Implementations/AIAssistantService.cs"
click node_chat "https://github.com/ilhanbasic/pausalio-backend/blob/master/Pausalio.Application/Services/Implementations/ChatService.cs"
click node_files "https://github.com/ilhanbasic/pausalio-backend/blob/master/Pausalio.Application/Services/Implementations/UploadFileService.cs"
click node_exchange "https://github.com/ilhanbasic/pausalio-backend/blob/master/Pausalio.Application/Services/Implementations/ExchangeRateService.cs"
click node_email "https://github.com/ilhanbasic/pausalio-backend/blob/master/Pausalio.Application/Services/Implementations/EmailService.cs"
click node_database "https://github.com/ilhanbasic/pausalio-backend/blob/master/Pausalio.Infrastructure/Persistence/PausalioDbContext.cs"
click node_unitofwork "https://github.com/ilhanbasic/pausalio-backend/blob/master/Pausalio.Infrastructure/Repositories/Implementations/UnitOfWork.cs"
click node_repo_base "https://github.com/ilhanbasic/pausalio-backend/blob/master/Pausalio.Infrastructure/Repositories/Implementations/Repository.cs"
click node_invoice_repo "https://github.com/ilhanbasic/pausalio-backend/blob/master/Pausalio.Infrastructure/Repositories/Implementations/InvoiceRepository.cs"
click node_expense_repo "https://github.com/ilhanbasic/pausalio-backend/blob/master/Pausalio.Infrastructure/Repositories/Implementations/ExpenseRepository.cs"
click node_tax_repo "https://github.com/ilhanbasic/pausalio-backend/blob/master/Pausalio.Infrastructure/Repositories/Implementations/TaxObligationRepository.cs"
click node_functions "https://github.com/ilhanbasic/pausalio-backend/blob/master/Pausalio.Functions/ReminderNotificationFunction.cs"
click node_chat_hub "https://github.com/ilhanbasic/pausalio-backend/blob/master/Pausalio.API/Hubs/ChatHub.cs"
click node_localization "https://github.com/ilhanbasic/pausalio-backend/blob/master/Pausalio.Shared/Localization/ILocalizationHelper.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_rest,node_auth,node_context,node_invoice_api,node_chat_hub toneBlue
class node_profiles,node_clients,node_invoices,node_pdf,node_expenses,node_payments,node_tax,node_reminders toneAmber
class node_financial_context,node_ai,node_chat,node_files,node_exchange,node_localization toneMint
class node_database,node_unitofwork,node_repo_base,node_invoice_repo,node_expense_repo,node_tax_repo toneRose
class node_email,node_blob,node_openrouter,node_functions,node_user toneIndigo
```

## Components

### API and identity

- [REST API](https://github.com/ilhanbasic/pausalio-backend/tree/master/Pausalio.API/Controllers): `Pausalio.API/Controllers`
- [Authentication](https://github.com/ilhanbasic/pausalio-backend/blob/master/Pausalio.API/Controllers/AuthController.cs): `Pausalio.API/Controllers/AuthController.cs`
- [Business context](https://github.com/ilhanbasic/pausalio-backend/blob/master/Pausalio.API/Middlewares/BusinessContextMiddleware.cs): `Pausalio.API/Middlewares/BusinessContextMiddleware.cs`
- [Invoice endpoints](https://github.com/ilhanbasic/pausalio-backend/blob/master/Pausalio.API/Controllers/InvoiceController.cs): `Pausalio.API/Controllers/InvoiceController.cs`
- [SignalR chat](https://github.com/ilhanbasic/pausalio-backend/blob/master/Pausalio.API/Hubs/ChatHub.cs): `Pausalio.API/Hubs/ChatHub.cs`

### Business operations

- [Business profiles](https://github.com/ilhanbasic/pausalio-backend/blob/master/Pausalio.Application/Services/Implementations/BusinessProfileService.cs): `Pausalio.Application/Services/Implementations/BusinessProfileService.cs`
- [Clients](https://github.com/ilhanbasic/pausalio-backend/blob/master/Pausalio.Application/Services/Implementations/ClientService.cs): `Pausalio.Application/Services/Implementations/ClientService.cs`
- [Invoices](https://github.com/ilhanbasic/pausalio-backend/blob/master/Pausalio.Application/Services/Implementations/InvoiceService.cs): `Pausalio.Application/Services/Implementations/InvoiceService.cs`
- [PDF export](https://github.com/ilhanbasic/pausalio-backend/blob/master/Pausalio.Application/Services/Implementations/InvoiceExportService.cs): `Pausalio.Application/Services/Implementations/InvoiceExportService.cs`
- [Expenses](https://github.com/ilhanbasic/pausalio-backend/blob/master/Pausalio.Application/Services/Implementations/ExpenseService.cs): `Pausalio.Application/Services/Implementations/ExpenseService.cs`
- [Payments](https://github.com/ilhanbasic/pausalio-backend/blob/master/Pausalio.Application/Services/Implementations/PaymentService.cs): `Pausalio.Application/Services/Implementations/PaymentService.cs`
- [Tax obligations](https://github.com/ilhanbasic/pausalio-backend/blob/master/Pausalio.Application/Services/Implementations/TaxObligationService.cs): `Pausalio.Application/Services/Implementations/TaxObligationService.cs`
- [Reminders](https://github.com/ilhanbasic/pausalio-backend/blob/master/Pausalio.Application/Services/Implementations/ReminderService.cs): `Pausalio.Application/Services/Implementations/ReminderService.cs`

### Application services

- [Financial context](https://github.com/ilhanbasic/pausalio-backend/blob/master/Pausalio.Application/Services/Implementations/FinancialContextService.cs): `Pausalio.Application/Services/Implementations/FinancialContextService.cs`
- [AI assistant](https://github.com/ilhanbasic/pausalio-backend/blob/master/Pausalio.Application/Services/Implementations/AIAssistantService.cs): `Pausalio.Application/Services/Implementations/AIAssistantService.cs`
- [Member chat](https://github.com/ilhanbasic/pausalio-backend/blob/master/Pausalio.Application/Services/Implementations/ChatService.cs): `Pausalio.Application/Services/Implementations/ChatService.cs`
- [File handling](https://github.com/ilhanbasic/pausalio-backend/blob/master/Pausalio.Application/Services/Implementations/UploadFileService.cs): `Pausalio.Application/Services/Implementations/UploadFileService.cs`
- [Currency conversion](https://github.com/ilhanbasic/pausalio-backend/blob/master/Pausalio.Application/Services/Implementations/ExchangeRateService.cs): `Pausalio.Application/Services/Implementations/ExchangeRateService.cs`
- [Localization](https://github.com/ilhanbasic/pausalio-backend/blob/master/Pausalio.Shared/Localization/ILocalizationHelper.cs): `Pausalio.Shared/Localization/ILocalizationHelper.cs`

### Persistence

- [MySQL database](https://github.com/ilhanbasic/pausalio-backend/blob/master/Pausalio.Infrastructure/Persistence/PausalioDbContext.cs): `Pausalio.Infrastructure/Persistence/PausalioDbContext.cs`
- [Unit of work](https://github.com/ilhanbasic/pausalio-backend/blob/master/Pausalio.Infrastructure/Repositories/Implementations/UnitOfWork.cs): `Pausalio.Infrastructure/Repositories/Implementations/UnitOfWork.cs`
- [Base repository](https://github.com/ilhanbasic/pausalio-backend/blob/master/Pausalio.Infrastructure/Repositories/Implementations/Repository.cs): `Pausalio.Infrastructure/Repositories/Implementations/Repository.cs`
- [Invoice repository](https://github.com/ilhanbasic/pausalio-backend/blob/master/Pausalio.Infrastructure/Repositories/Implementations/InvoiceRepository.cs): `Pausalio.Infrastructure/Repositories/Implementations/InvoiceRepository.cs`
- [Expense repository](https://github.com/ilhanbasic/pausalio-backend/blob/master/Pausalio.Infrastructure/Repositories/Implementations/ExpenseRepository.cs): `Pausalio.Infrastructure/Repositories/Implementations/ExpenseRepository.cs`
- [Tax repository](https://github.com/ilhanbasic/pausalio-backend/blob/master/Pausalio.Infrastructure/Repositories/Implementations/TaxObligationRepository.cs): `Pausalio.Infrastructure/Repositories/Implementations/TaxObligationRepository.cs`

### External integrations

- [Email delivery](https://github.com/ilhanbasic/pausalio-backend/blob/master/Pausalio.Application/Services/Implementations/EmailService.cs): `Pausalio.Application/Services/Implementations/EmailService.cs`
- **Azure Blob**
- **OpenRouter**
- [Reminder scheduler](https://github.com/ilhanbasic/pausalio-backend/blob/master/Pausalio.Functions/ReminderNotificationFunction.cs): `Pausalio.Functions/ReminderNotificationFunction.cs`

### Other components

- **Entrepreneur**

## Connections

- Entrepreneur → REST API: calls
- REST API → Authentication: authenticates via
- REST API → Invoice endpoints: routes invoice requests
- Invoice endpoints → Invoices: calls (evidence: `Pausalio.API/Controllers/InvoiceController.cs`)
- Invoice endpoints → PDF export: requests export (evidence: `Pausalio.API/Controllers/InvoiceController.cs`)
- REST API → Business profiles: serves profile operations
- REST API → Clients: serves client operations
- REST API → Expenses: serves expense operations
- REST API → Payments: serves payment operations
- REST API → Tax obligations: serves tax operations
- REST API → Reminders: serves reminder operations
- Financial context → Unit of work: queries through (evidence: `Pausalio.Application/Services/Implementations/FinancialContextService.cs`)
- Financial context → Invoice repository: reads invoices (evidence: `Pausalio.Application/Services/Implementations/FinancialContextService.cs`)
- Financial context → Expense repository: reads expenses (evidence: `Pausalio.Application/Services/Implementations/FinancialContextService.cs`)
- Financial context → Tax repository: reads obligations (evidence: `Pausalio.Application/Services/Implementations/FinancialContextService.cs`)
- REST API → AI assistant: serves AI assistant
- AI assistant → OpenRouter: calls model API
- AI assistant → Financial context: uses financial data
- REST API → SignalR chat: offers real-time chat
- SignalR chat → Member chat: uses chat service
- REST API → File handling: handles uploads
- File handling → Azure Blob: stores files
- REST API → Currency conversion: serves conversion
- Reminder scheduler → Email delivery: sends reminders
- Invoices → Unit of work: persists records
- Expenses → Unit of work: persists records
- Payments → Unit of work: persists records
- Tax obligations → Unit of work: persists records
- Unit of work → Base repository: exposes repositories
- Base repository → MySQL database: queries and updates (evidence: `Pausalio.Infrastructure/Repositories/Implementations/Repository.cs`)
- Business context → REST API: scopes business requests
