# minhdev-ops/xyphora architecture

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

- Interactive diagram: https://gitdiagram.com/minhdev-ops/xyphora
- Repository: https://github.com/minhdev-ops/xyphora

## Overview

Xyphora is represented here as an event-based shared-expense backend: users authenticate, create or join events, record and split expenses, then review balances and activity. API routes dispatch requests to focused controllers; Eloquent models provide the internal domain layer. The tree contains Flutter platform launchers but no application Dart sources, so frontend behavior is not mapped. Controller-to-model links follow the source index where excerpts are incomplete; integrations are shown only where the AuthController explicitly calls them.

Main entry points: [`backend/app/Http/Controllers/ExpenseController.php`](https://github.com/minhdev-ops/xyphora/blob/main/backend/app/Http/Controllers/ExpenseController.php) (Expense management), [`backend/routes/api.php`](https://github.com/minhdev-ops/xyphora/blob/main/backend/routes/api.php) (API routes), [`backend/app/Http/Controllers/DashboardController.php`](https://github.com/minhdev-ops/xyphora/blob/main/backend/app/Http/Controllers/DashboardController.php) (Dashboard), [`backend/app/Http/Controllers/AuthController.php`](https://github.com/minhdev-ops/xyphora/blob/main/backend/app/Http/Controllers/AuthController.php) (Authentication)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API entry"]
  node_bootstrap["Application bootstrap<br/>[app.php]"]
  node_routes["API routes<br/>[api.php]"]
end

subgraph group_identity["Identity"]
  node_auth["Authentication<br/>[AuthController.php]"]
  node_users["User accounts<br/>[User.php]"]
  node_otp["OTP email<br/>[OtpMail.php]"]
  node_userctl["User management<br/>[UserController.php]"]
end

subgraph group_events["Events"]
  node_eventctl["Event management"]
end

subgraph group_expenses["Expenses"]
  node_expensectl["Expense management"]
end

subgraph group_insights["Activity and insights"]
  node_dashboard["Dashboard"]
  node_statistics["Statistics"]
  node_notificationctl["Notification management"]
end

subgraph group_domain["Domain records"]
  node_event["Events<br/>[Event.php]"]
  node_participants["Participants<br/>[Participant.php]"]
  node_invitations["Invitations<br/>[Invitation.php]"]
  node_expense["Expenses<br/>[Expense.php]"]
  node_category["Categories<br/>[Category.php]"]
  node_payers["Expense payers<br/>[ExpensePayer.php]"]
  node_splits["Expense splits<br/>[ExpenseSplit.php]"]
  node_history["Expense history<br/>[ExpenseHistory.php]"]
  node_photos["Photos<br/>[Photo.php]"]
  node_notifications["Notifications<br/>[Notification.php]"]
end

node_client(("API client"))
node_google["Google token service"]
node_mail["Mail service"]

node_client -->|"sends requests"| node_routes
node_bootstrap -->|"registers routes"| node_routes
node_routes -->|"dispatches"| node_auth
node_routes -->|"dispatches"| node_eventctl
node_routes -->|"dispatches"| node_expensectl
node_routes -->|"dispatches"| node_dashboard
node_routes -->|"dispatches"| node_statistics
node_routes -->|"dispatches"| node_notificationctl
node_routes -->|"dispatches"| node_userctl
node_auth -->|"creates or updates"| node_users
node_auth -->|"validates token"| node_google
node_auth -->|"sends OTP mail"| node_otp
node_otp -.->|"uses mail transport"| node_mail
node_eventctl -->|"manages"| node_event
node_eventctl -->|"manages"| node_participants
node_eventctl -->|"creates and checks"| node_invitations
node_expensectl -->|"creates and queries"| node_expense
node_expensectl -->|"checks event access"| node_event
node_expensectl -->|"queries categories"| node_category
node_expensectl -->|"checks participants"| node_participants
node_expensectl -->|"records payments"| node_payers
node_expensectl -->|"records allocations"| node_splits
node_expensectl -.->|"records changes"| node_history
node_expensectl -->|"creates alerts"| node_notifications
node_dashboard -->|"queries events"| node_event
node_dashboard -->|"queries spending"| node_expense
node_dashboard -->|"sums payments"| node_payers
node_dashboard -->|"sums shares"| node_splits
node_dashboard -->|"finds memberships"| node_participants
node_dashboard -->|"lists alerts"| node_notifications
node_statistics -->|"queries event data"| node_event
node_statistics -->|"aggregates expenses"| node_expense
node_statistics -->|"checks membership"| node_participants
node_notificationctl -->|"manages alerts"| node_notifications
node_expense -->|"relates photos"| node_photos

click node_bootstrap "https://github.com/minhdev-ops/xyphora/blob/main/backend/bootstrap/app.php"
click node_routes "https://github.com/minhdev-ops/xyphora/blob/main/backend/routes/api.php"
click node_auth "https://github.com/minhdev-ops/xyphora/blob/main/backend/app/Http/Controllers/AuthController.php"
click node_users "https://github.com/minhdev-ops/xyphora/blob/main/backend/app/Models/User.php"
click node_otp "https://github.com/minhdev-ops/xyphora/blob/main/backend/app/Mail/OtpMail.php"
click node_eventctl "https://github.com/minhdev-ops/xyphora/blob/main/backend/app/Http/Controllers/EventController.php"
click node_event "https://github.com/minhdev-ops/xyphora/blob/main/backend/app/Models/Event.php"
click node_participants "https://github.com/minhdev-ops/xyphora/blob/main/backend/app/Models/Participant.php"
click node_invitations "https://github.com/minhdev-ops/xyphora/blob/main/backend/app/Models/Invitation.php"
click node_expensectl "https://github.com/minhdev-ops/xyphora/blob/main/backend/app/Http/Controllers/ExpenseController.php"
click node_expense "https://github.com/minhdev-ops/xyphora/blob/main/backend/app/Models/Expense.php"
click node_category "https://github.com/minhdev-ops/xyphora/blob/main/backend/app/Models/Category.php"
click node_payers "https://github.com/minhdev-ops/xyphora/blob/main/backend/app/Models/ExpensePayer.php"
click node_splits "https://github.com/minhdev-ops/xyphora/blob/main/backend/app/Models/ExpenseSplit.php"
click node_history "https://github.com/minhdev-ops/xyphora/blob/main/backend/app/Models/ExpenseHistory.php"
click node_photos "https://github.com/minhdev-ops/xyphora/blob/main/backend/app/Models/Photo.php"
click node_dashboard "https://github.com/minhdev-ops/xyphora/blob/main/backend/app/Http/Controllers/DashboardController.php"
click node_statistics "https://github.com/minhdev-ops/xyphora/blob/main/backend/app/Http/Controllers/StatisticsController.php"
click node_notificationctl "https://github.com/minhdev-ops/xyphora/blob/main/backend/app/Http/Controllers/NotificationController.php"
click node_notifications "https://github.com/minhdev-ops/xyphora/blob/main/backend/app/Models/Notification.php"
click node_userctl "https://github.com/minhdev-ops/xyphora/blob/main/backend/app/Http/Controllers/UserController.php"

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_bootstrap,node_routes,node_client toneBlue
class node_auth,node_users,node_otp,node_userctl toneAmber
class node_eventctl toneMint
class node_expensectl toneRose
class node_dashboard,node_statistics,node_notificationctl,node_google,node_mail toneIndigo
class node_event,node_participants,node_invitations,node_expense,node_category,node_payers,node_splits,node_history,node_photos,node_notifications toneTeal
```

## Components

### API entry

- [Application bootstrap](https://github.com/minhdev-ops/xyphora/blob/main/backend/bootstrap/app.php): `backend/bootstrap/app.php`
- [API routes](https://github.com/minhdev-ops/xyphora/blob/main/backend/routes/api.php): `backend/routes/api.php`

### Identity

- [Authentication](https://github.com/minhdev-ops/xyphora/blob/main/backend/app/Http/Controllers/AuthController.php): `backend/app/Http/Controllers/AuthController.php`
- [User accounts](https://github.com/minhdev-ops/xyphora/blob/main/backend/app/Models/User.php): `backend/app/Models/User.php`
- [OTP email](https://github.com/minhdev-ops/xyphora/blob/main/backend/app/Mail/OtpMail.php): `backend/app/Mail/OtpMail.php`
- [User management](https://github.com/minhdev-ops/xyphora/blob/main/backend/app/Http/Controllers/UserController.php): `backend/app/Http/Controllers/UserController.php`

### Events

- [Event management](https://github.com/minhdev-ops/xyphora/blob/main/backend/app/Http/Controllers/EventController.php): `backend/app/Http/Controllers/EventController.php`

### Expenses

- [Expense management](https://github.com/minhdev-ops/xyphora/blob/main/backend/app/Http/Controllers/ExpenseController.php): `backend/app/Http/Controllers/ExpenseController.php`

### Activity and insights

- [Dashboard](https://github.com/minhdev-ops/xyphora/blob/main/backend/app/Http/Controllers/DashboardController.php): `backend/app/Http/Controllers/DashboardController.php`
- [Statistics](https://github.com/minhdev-ops/xyphora/blob/main/backend/app/Http/Controllers/StatisticsController.php): `backend/app/Http/Controllers/StatisticsController.php`
- [Notification management](https://github.com/minhdev-ops/xyphora/blob/main/backend/app/Http/Controllers/NotificationController.php): `backend/app/Http/Controllers/NotificationController.php`

### Domain records

- [Events](https://github.com/minhdev-ops/xyphora/blob/main/backend/app/Models/Event.php): `backend/app/Models/Event.php`
- [Participants](https://github.com/minhdev-ops/xyphora/blob/main/backend/app/Models/Participant.php): `backend/app/Models/Participant.php`
- [Invitations](https://github.com/minhdev-ops/xyphora/blob/main/backend/app/Models/Invitation.php): `backend/app/Models/Invitation.php`
- [Expenses](https://github.com/minhdev-ops/xyphora/blob/main/backend/app/Models/Expense.php): `backend/app/Models/Expense.php`
- [Categories](https://github.com/minhdev-ops/xyphora/blob/main/backend/app/Models/Category.php): `backend/app/Models/Category.php`
- [Expense payers](https://github.com/minhdev-ops/xyphora/blob/main/backend/app/Models/ExpensePayer.php): `backend/app/Models/ExpensePayer.php`
- [Expense splits](https://github.com/minhdev-ops/xyphora/blob/main/backend/app/Models/ExpenseSplit.php): `backend/app/Models/ExpenseSplit.php`
- [Expense history](https://github.com/minhdev-ops/xyphora/blob/main/backend/app/Models/ExpenseHistory.php): `backend/app/Models/ExpenseHistory.php`
- [Photos](https://github.com/minhdev-ops/xyphora/blob/main/backend/app/Models/Photo.php): `backend/app/Models/Photo.php`
- [Notifications](https://github.com/minhdev-ops/xyphora/blob/main/backend/app/Models/Notification.php): `backend/app/Models/Notification.php`

### Other components

- **API client**
- **Google token service**
- **Mail service**

## Connections

- API client → API routes: sends requests (evidence: `backend/routes/api.php`)
- Application bootstrap → API routes: registers routes (evidence: `backend/bootstrap/app.php`)
- API routes → Authentication: dispatches (evidence: `backend/routes/api.php`)
- API routes → Event management: dispatches (evidence: `backend/routes/api.php`)
- API routes → Expense management: dispatches (evidence: `backend/routes/api.php`)
- API routes → Dashboard: dispatches (evidence: `backend/routes/api.php`)
- API routes → Statistics: dispatches (evidence: `backend/routes/api.php`)
- API routes → Notification management: dispatches (evidence: `backend/routes/api.php`)
- API routes → User management: dispatches (evidence: `backend/routes/api.php`)
- Authentication → User accounts: creates or updates (evidence: `backend/app/Http/Controllers/AuthController.php`)
- Authentication → Google token service: validates token (evidence: `backend/app/Http/Controllers/AuthController.php`)
- Authentication → OTP email: sends OTP mail (evidence: `backend/app/Http/Controllers/AuthController.php`)
- OTP email → Mail service: uses mail transport
- Event management → Events: manages (evidence: `backend/app/Http/Controllers/EventController.php`)
- Event management → Participants: manages (evidence: `backend/app/Http/Controllers/EventController.php`)
- Event management → Invitations: creates and checks (evidence: `backend/app/Http/Controllers/EventController.php`)
- Expense management → Expenses: creates and queries (evidence: `backend/app/Http/Controllers/ExpenseController.php`)
- Expense management → Events: checks event access (evidence: `backend/app/Http/Controllers/ExpenseController.php`)
- Expense management → Categories: queries categories (evidence: `backend/app/Http/Controllers/ExpenseController.php`)
- Expense management → Participants: checks participants (evidence: `backend/app/Http/Controllers/ExpenseController.php`)
- Expense management → Expense payers: records payments (evidence: `backend/app/Http/Controllers/ExpenseController.php`)
- Expense management → Expense splits: records allocations (evidence: `backend/app/Http/Controllers/ExpenseController.php`)
- Expense management → Expense history: records changes (evidence: `backend/app/Http/Controllers/ExpenseController.php`)
- Expense management → Notifications: creates alerts (evidence: `backend/app/Http/Controllers/ExpenseController.php`)
- Dashboard → Events: queries events (evidence: `backend/app/Http/Controllers/DashboardController.php`)
- Dashboard → Expenses: queries spending (evidence: `backend/app/Http/Controllers/DashboardController.php`)
- Dashboard → Expense payers: sums payments (evidence: `backend/app/Http/Controllers/DashboardController.php`)
- Dashboard → Expense splits: sums shares (evidence: `backend/app/Http/Controllers/DashboardController.php`)
- Dashboard → Participants: finds memberships (evidence: `backend/app/Http/Controllers/DashboardController.php`)
- Dashboard → Notifications: lists alerts (evidence: `backend/app/Http/Controllers/DashboardController.php`)
- Statistics → Events: queries event data (evidence: `backend/app/Http/Controllers/StatisticsController.php`)
- Statistics → Expenses: aggregates expenses (evidence: `backend/app/Http/Controllers/StatisticsController.php`)
- Statistics → Participants: checks membership (evidence: `backend/app/Http/Controllers/StatisticsController.php`)
- Notification management → Notifications: manages alerts (evidence: `backend/app/Http/Controllers/NotificationController.php`)
- Expenses → Photos: relates photos (evidence: `backend/app/Models/Expense.php`)
