Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,48 @@ Track shared costs, calculate who owes whom, and manage group finances effortles

Follows DDD principles for separting the application into generic, core, and supporting domains - enforced by [deptrac](https://github.com/deptrac/deptrac).

## Architecture diagram

```
Browser / Client
┌────────────────┼─────────────────┐
│ :8000 │ :8080 │ :5173 (dev)
▼ ▼ ▼
┌────────────┐ ┌──────────────┐ ┌───────────────┐
│ dashboard │ │ web (Nginx) │ │ npm-dev │
│ (Homer) │ │ │ │ (Vite/React/ │
└────────────┘ └──────┬───────┘ │ TypeScript) │
│ FastCGI └───────────────┘
│ :9000
┌──────────────────┐ async ┌──────────────┐
│ app (PHP-FPM) │────messages────▶│ worker │
│ Symfony │ │ (Messenger) │
└──────────────────┘ └──────────────┘
│ │
└────────────────┬────────────────┘
│ SQL
┌─────────────────┐
│ db (MySQL) │
└─────────────────┘

───────────────────────── Backend Layers ─────────────────────────

┌─────────────────────────────────────────────────────────────────┐
│ Supporting │ Controllers · Auth · Repositories · Async │
│ │ Normalizers · Instrumentation · EventListeners │
├──────────────┴──────────────────────────────────────────────────┤
│ Core │ ExpenseTracker · Calculator │
│ (Domain) │ Event Sourcing · Expenses · Compensation │
├──────────────┴──────────────────────────────────────────────────┤
│ Generic │ Symfony · Doctrine · Twig · DomPDF · Monolog |
| │ PhpParser · phpDocumenter · OpenAPI |
└─────────────────────────────────────────────────────────────────┘
Supporting depends on Core & Generic · Core has no deps
```

## Prerequisites

- [Make](https://www.gnu.org/software/make/)
Expand Down
2 changes: 0 additions & 2 deletions backend/deptrac.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ deptrac:
value: .*Monolog\\.*
- type: classLike
value: .*OpenApi\\Attributes\\.*
- type: classLike
value: .*OpenTelemetry\\.*
- type: classLike
value: .*phpDocumentor\\Reflection\\.*
- type: classLike
Expand Down
2 changes: 1 addition & 1 deletion backend/src/Controller/API/CalculateExpensesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public function calculate(): JsonResponse

$expenses = $this->calculator->calculate();

Ensure::that(2 === count($expenses));
Ensure::that(2 === count($expenses), 'Track your expenses first!');

$compensation = Compensation::calculate($expenses[0], $expenses[1]);

Expand Down
3 changes: 2 additions & 1 deletion frontend/src/features/calculation/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ export async function fetchCalculation(): Promise<CalculationResponse> {
})

if (!response.ok) {
throw new Error('Failed to fetch calculation')
const error = await response.json()
throw new Error(error.detail || 'Failed to fetch calculation')
}

return response.json()
Expand Down