# gustawohler/familybudget architecture

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

- Interactive diagram: https://gitdiagram.com/gustawohler/familybudget
- Repository: https://github.com/gustawohler/familybudget

## Overview

FamilyBudget is a group-budget API with an in-progress Next.js frontend. Its main workflow lets authenticated users create budgets, add members, and record or retrieve income and expenses; authorization controls access, while balance changes update a budget’s balance. The graph also shows authentication, domain validation, and persistence. Backend controller and application calls are evidenced by excerpts or the source index; frontend-to-API wiring and some unsampled subsystem details are not shown, so those links are omitted.

Main entry points: [`Backend/Application/BalanceChangeOperations/BalanceChangeManager.cs`](https://github.com/gustawohler/familybudget/blob/main/Backend/Application/BalanceChangeOperations/BalanceChangeManager.cs) (Balance changes), [`Backend/UI/Controllers/BudgetController.cs`](https://github.com/gustawohler/familybudget/blob/main/Backend/UI/Controllers/BudgetController.cs) (Budget endpoints), [`Backend/Domain/Interfaces/Database/IRepository.cs`](https://github.com/gustawohler/familybudget/blob/main/Backend/Domain/Interfaces/Database/IRepository.cs) (Repository contract), [`Backend/Infrastructure/Database/Repositories/StandardRepository.cs`](https://github.com/gustawohler/familybudget/blob/main/Backend/Infrastructure/Database/Repositories/StandardRepository.cs) (Standard repository)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Frontend"]
  node_frontend["Budget pages"]
  node_api_connector["API connector<br/>[ApiConnector.tsx]"]
end

subgraph group_api["API and auth"]
  node_budget_controller["Budget endpoints"]
  node_auth_controller["Authentication endpoints"]
  node_auth_services["Authentication services"]
  node_authorization["Authorization checks"]
end

subgraph group_operations["Budget operations"]
  node_budget_manager["Budget management<br/>[BudgetManager.cs]"]
  node_budget_retriever["Budget retrieval<br/>[BudgetRetriever.cs]"]
  node_balance_manager["Balance changes"]
  node_balance_retriever["Change retrieval"]
  node_specifications["Query specifications"]
end

subgraph group_domain["Domain model"]
  node_budget["Budget<br/>[Budget.cs]"]
  node_balance_change["Balance change<br/>[BalanceChange.cs]"]
  node_category["Category<br/>[Category.cs]"]
  node_user["User<br/>[User.cs]"]
  node_validation["Object validation<br/>[ObjectValidator.cs]"]
end

subgraph group_persistence["Persistence"]
  node_repository_contract["Repository contract<br/>[IRepository.cs]"]
  node_repository["Standard repository"]
  node_db_context[("Budget database context")]
end

node_users(("Budget users"))

node_users -->|"send budget requests"| node_budget_controller
node_users -->|"authenticate"| node_auth_controller
node_budget_controller -->|"manages budgets"| node_budget_manager
node_budget_controller -->|"retrieves budgets"| node_budget_retriever
node_budget_controller -->|"creates changes"| node_balance_manager
node_budget_controller -->|"retrieves changes"| node_balance_retriever
node_auth_controller -->|"uses auth services"| node_auth_services
node_budget_manager -->|"checks admin rights"| node_authorization
node_balance_manager -->|"checks membership"| node_authorization
node_budget_manager -->|"reads and writes"| node_repository_contract
node_budget_retriever -->|"queries data"| node_repository_contract
node_balance_manager -->|"writes changes"| node_repository_contract
node_balance_retriever -->|"queries changes"| node_repository_contract
node_budget_retriever -->|"builds queries"| node_specifications
node_balance_retriever -->|"builds queries"| node_specifications
node_balance_manager -->|"updates balance"| node_budget
node_balance_manager -->|"creates record"| node_balance_change
node_balance_manager -->|"assigns category"| node_category
node_repository -->|"implements"| node_repository_contract
node_repository -->|"queries and saves"| node_db_context
node_repository -->|"validates entities"| node_validation

click node_frontend "https://github.com/gustawohler/familybudget/tree/main/Frontend/src/pages"
click node_api_connector "https://github.com/gustawohler/familybudget/blob/main/Frontend/src/APIConnection/ApiConnector.tsx"
click node_budget_controller "https://github.com/gustawohler/familybudget/blob/main/Backend/UI/Controllers/BudgetController.cs"
click node_auth_controller "https://github.com/gustawohler/familybudget/blob/main/Backend/UI/Controllers/AuthenticationController.cs"
click node_auth_services "https://github.com/gustawohler/familybudget/tree/main/Backend/Application/Auth"
click node_authorization "https://github.com/gustawohler/familybudget/blob/main/Backend/Application/Auth/AuthorizationVerifier.cs"
click node_budget_manager "https://github.com/gustawohler/familybudget/blob/main/Backend/Application/BudgetOperations/BudgetManager.cs"
click node_budget_retriever "https://github.com/gustawohler/familybudget/blob/main/Backend/Application/BudgetOperations/BudgetRetriever.cs"
click node_balance_manager "https://github.com/gustawohler/familybudget/blob/main/Backend/Application/BalanceChangeOperations/BalanceChangeManager.cs"
click node_balance_retriever "https://github.com/gustawohler/familybudget/blob/main/Backend/Application/BalanceChangeOperations/BalanceChangesRetriever.cs"
click node_specifications "https://github.com/gustawohler/familybudget/tree/main/Backend/Infrastructure/Database/Specifications"
click node_budget "https://github.com/gustawohler/familybudget/blob/main/Backend/Domain/Models/Budget.cs"
click node_balance_change "https://github.com/gustawohler/familybudget/blob/main/Backend/Domain/Models/BalanceChange.cs"
click node_category "https://github.com/gustawohler/familybudget/blob/main/Backend/Domain/Models/Category.cs"
click node_user "https://github.com/gustawohler/familybudget/blob/main/Backend/Domain/Models/User.cs"
click node_validation "https://github.com/gustawohler/familybudget/blob/main/Backend/Domain/Validation/ObjectValidator.cs"
click node_repository_contract "https://github.com/gustawohler/familybudget/blob/main/Backend/Domain/Interfaces/Database/IRepository.cs"
click node_repository "https://github.com/gustawohler/familybudget/blob/main/Backend/Infrastructure/Database/Repositories/StandardRepository.cs"
click node_db_context "https://github.com/gustawohler/familybudget/blob/main/Backend/Infrastructure/Database/FamilyBudgetDbContext.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_frontend,node_api_connector,node_users toneBlue
class node_budget_controller,node_auth_controller,node_auth_services,node_authorization toneAmber
class node_budget_manager,node_budget_retriever,node_balance_manager,node_balance_retriever,node_specifications toneMint
class node_budget,node_balance_change,node_category,node_user,node_validation toneRose
class node_repository_contract,node_repository,node_db_context toneIndigo
```

## Components

### Frontend

- [Budget pages](https://github.com/gustawohler/familybudget/tree/main/Frontend/src/pages): `Frontend/src/pages`
- [API connector](https://github.com/gustawohler/familybudget/blob/main/Frontend/src/APIConnection/ApiConnector.tsx): `Frontend/src/APIConnection/ApiConnector.tsx`

### API and auth

- [Budget endpoints](https://github.com/gustawohler/familybudget/blob/main/Backend/UI/Controllers/BudgetController.cs): `Backend/UI/Controllers/BudgetController.cs`
- [Authentication endpoints](https://github.com/gustawohler/familybudget/blob/main/Backend/UI/Controllers/AuthenticationController.cs): `Backend/UI/Controllers/AuthenticationController.cs`
- [Authentication services](https://github.com/gustawohler/familybudget/tree/main/Backend/Application/Auth): `Backend/Application/Auth`
- [Authorization checks](https://github.com/gustawohler/familybudget/blob/main/Backend/Application/Auth/AuthorizationVerifier.cs): `Backend/Application/Auth/AuthorizationVerifier.cs`

### Budget operations

- [Budget management](https://github.com/gustawohler/familybudget/blob/main/Backend/Application/BudgetOperations/BudgetManager.cs): `Backend/Application/BudgetOperations/BudgetManager.cs`
- [Budget retrieval](https://github.com/gustawohler/familybudget/blob/main/Backend/Application/BudgetOperations/BudgetRetriever.cs): `Backend/Application/BudgetOperations/BudgetRetriever.cs`
- [Balance changes](https://github.com/gustawohler/familybudget/blob/main/Backend/Application/BalanceChangeOperations/BalanceChangeManager.cs): `Backend/Application/BalanceChangeOperations/BalanceChangeManager.cs`
- [Change retrieval](https://github.com/gustawohler/familybudget/blob/main/Backend/Application/BalanceChangeOperations/BalanceChangesRetriever.cs): `Backend/Application/BalanceChangeOperations/BalanceChangesRetriever.cs`
- [Query specifications](https://github.com/gustawohler/familybudget/tree/main/Backend/Infrastructure/Database/Specifications): `Backend/Infrastructure/Database/Specifications`

### Domain model

- [Budget](https://github.com/gustawohler/familybudget/blob/main/Backend/Domain/Models/Budget.cs): `Backend/Domain/Models/Budget.cs`
- [Balance change](https://github.com/gustawohler/familybudget/blob/main/Backend/Domain/Models/BalanceChange.cs): `Backend/Domain/Models/BalanceChange.cs`
- [Category](https://github.com/gustawohler/familybudget/blob/main/Backend/Domain/Models/Category.cs): `Backend/Domain/Models/Category.cs`
- [User](https://github.com/gustawohler/familybudget/blob/main/Backend/Domain/Models/User.cs): `Backend/Domain/Models/User.cs`
- [Object validation](https://github.com/gustawohler/familybudget/blob/main/Backend/Domain/Validation/ObjectValidator.cs): `Backend/Domain/Validation/ObjectValidator.cs`

### Persistence

- [Repository contract](https://github.com/gustawohler/familybudget/blob/main/Backend/Domain/Interfaces/Database/IRepository.cs): `Backend/Domain/Interfaces/Database/IRepository.cs`
- [Standard repository](https://github.com/gustawohler/familybudget/blob/main/Backend/Infrastructure/Database/Repositories/StandardRepository.cs): `Backend/Infrastructure/Database/Repositories/StandardRepository.cs`
- [Budget database context](https://github.com/gustawohler/familybudget/blob/main/Backend/Infrastructure/Database/FamilyBudgetDbContext.cs): `Backend/Infrastructure/Database/FamilyBudgetDbContext.cs`

### Other components

- **Budget users**

## Connections

- Budget users → Budget endpoints: send budget requests (evidence: `Backend/UI/Controllers/BudgetController.cs`)
- Budget users → Authentication endpoints: authenticate (evidence: `Backend/UI/Controllers/AuthenticationController.cs`)
- Budget endpoints → Budget management: manages budgets (evidence: `Backend/UI/Controllers/BudgetController.cs`)
- Budget endpoints → Budget retrieval: retrieves budgets (evidence: `Backend/UI/Controllers/BudgetController.cs`)
- Budget endpoints → Balance changes: creates changes (evidence: `Backend/UI/Controllers/BudgetController.cs`)
- Budget endpoints → Change retrieval: retrieves changes (evidence: `Backend/UI/Controllers/BudgetController.cs`)
- Authentication endpoints → Authentication services: uses auth services (evidence: `Backend/UI/Controllers/AuthenticationController.cs`)
- Budget management → Authorization checks: checks admin rights (evidence: `Backend/Application/BudgetOperations/BudgetManager.cs`)
- Balance changes → Authorization checks: checks membership (evidence: `Backend/Application/BalanceChangeOperations/BalanceChangeManager.cs`)
- Budget management → Repository contract: reads and writes (evidence: `Backend/Application/BudgetOperations/BudgetManager.cs`)
- Budget retrieval → Repository contract: queries data (evidence: `Backend/Application/BudgetOperations/BudgetRetriever.cs`)
- Balance changes → Repository contract: writes changes (evidence: `Backend/Application/BalanceChangeOperations/BalanceChangeManager.cs`)
- Change retrieval → Repository contract: queries changes (evidence: `Backend/Application/BalanceChangeOperations/BalanceChangesRetriever.cs`)
- Budget retrieval → Query specifications: builds queries (evidence: `Backend/Application/BudgetOperations/BudgetRetriever.cs`)
- Change retrieval → Query specifications: builds queries (evidence: `Backend/Application/BalanceChangeOperations/BalanceChangesRetriever.cs`)
- Balance changes → Budget: updates balance (evidence: `Backend/Application/BalanceChangeOperations/BalanceChangeManager.cs`)
- Balance changes → Balance change: creates record (evidence: `Backend/Application/BalanceChangeOperations/BalanceChangeManager.cs`)
- Balance changes → Category: assigns category (evidence: `Backend/Application/BalanceChangeOperations/BalanceChangeManager.cs`)
- Standard repository → Repository contract: implements (evidence: `Backend/Infrastructure/Database/Repositories/StandardRepository.cs`)
- Standard repository → Budget database context: queries and saves (evidence: `Backend/Infrastructure/Database/Repositories/StandardRepository.cs`)
- Standard repository → Object validation: validates entities (evidence: `Backend/Infrastructure/Database/Repositories/StandardRepository.cs`)
