# dionydar2612/ytpayment architecture

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

- Interactive diagram: https://gitdiagram.com/dionydar2612/ytpayment
- Repository: https://github.com/dionydar2612/ytpayment

## Overview

Group Expense Manager is a role-based FastAPI application for tracking shared monthly expenses, member balances, payments, and transfer-slip approvals. Members and admins use server-rendered pages and authenticated endpoints: admins manage members and expenses; members upload slips; admins review them, and confirmed payments feed balance calculations shown in dashboards and history. The README documents manual slip approval, carry-forward credits, and local slip storage. Some router implementations were not sampled, so their documented capabilities are shown without speculative internal call sequences.

Main entry points: [`app/main.py`](https://github.com/dionydar2612/ytpayment/blob/main/app/main.py) (FastAPI app), [`app/auth.py`](https://github.com/dionydar2612/ytpayment/blob/main/app/auth.py) (Authentication), [`app/models.py`](https://github.com/dionydar2612/ytpayment/blob/main/app/models.py) (Domain models), [`app/services/calculation.py`](https://github.com/dionydar2612/ytpayment/blob/main/app/services/calculation.py) (Balance calculation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web application"]
  node_webapp["Web interface"]
  node_browserjs["Browser behavior<br/>[app.js]"]
  node_entry["FastAPI app<br/>[main.py]"]
  node_pages["Page routes<br/>[pages.py]"]
  node_dashboard["Dashboard<br/>[dashboard.py]"]
end

subgraph group_identity["Identity and access"]
  node_authroute["Auth routes<br/>[auth.py]"]
  node_auth["Authentication<br/>[auth.py]"]
end

subgraph group_finance["Expense and balances"]
  node_members["Member management<br/>[members.py]"]
  node_expenses["Expense management<br/>[expenses.py]"]
  node_calculation["Balance calculation<br/>[calculation.py]"]
  node_history["Financial history<br/>[history.py]"]
end

subgraph group_payments["Payments and slips"]
  node_slips["Slip submissions<br/>[slips.py]"]
  node_storage["Slip storage<br/>[storage.py]"]
  node_payments["Payment review<br/>[payments.py]"]
end

subgraph group_persistence["Persistence"]
  node_models["Domain models<br/>[models.py]"]
  node_database["Database session<br/>[database.py]"]
  node_postgres[("PostgreSQL")]
end

node_member(("Member"))
node_admin(("Admin"))

node_member -->|"uses"| node_webapp
node_admin -->|"uses"| node_webapp
node_webapp -->|"loads"| node_browserjs
node_browserjs -->|"requests"| node_entry
node_entry -->|"dispatches"| node_pages
node_entry -->|"dispatches"| node_authroute
node_entry -->|"dispatches"| node_dashboard
node_entry -->|"dispatches"| node_members
node_entry -->|"dispatches"| node_expenses
node_entry -->|"dispatches"| node_slips
node_entry -->|"dispatches"| node_payments
node_entry -->|"dispatches"| node_history
node_authroute -->|"verifies credentials"| node_auth
node_members -->|"requires admin"| node_auth
node_expenses -->|"checks access"| node_auth
node_slips -->|"checks access"| node_auth
node_payments -->|"requires admin"| node_auth
node_dashboard -->|"checks session"| node_auth
node_history -->|"checks session"| node_auth
node_members -->|"sets old balance"| node_calculation
node_expenses -->|"calculates shares"| node_calculation
node_dashboard -->|"recomputes balances"| node_calculation
node_history -->|"recomputes balances"| node_calculation
node_slips -->|"stores uploads"| node_storage
node_payments -.->|"records confirmed payment"| node_calculation
node_calculation -->|"reads and updates"| node_models
node_members -->|"manages records"| node_models
node_expenses -->|"stores expenses"| node_models
node_slips -->|"stores slip records"| node_models
node_payments -->|"stores payment records"| node_models
node_history -->|"reads records"| node_models
node_dashboard -->|"reads records"| node_models
node_database -->|"connects"| node_postgres
node_entry -->|"initializes schema"| node_database
node_auth -->|"loads user"| node_database

click node_webapp "https://github.com/dionydar2612/ytpayment/tree/main/app/templates"
click node_browserjs "https://github.com/dionydar2612/ytpayment/blob/main/app/static/app.js"
click node_entry "https://github.com/dionydar2612/ytpayment/blob/main/app/main.py"
click node_pages "https://github.com/dionydar2612/ytpayment/blob/main/app/routers/pages.py"
click node_dashboard "https://github.com/dionydar2612/ytpayment/blob/main/app/routers/dashboard.py"
click node_authroute "https://github.com/dionydar2612/ytpayment/blob/main/app/routers/auth.py"
click node_auth "https://github.com/dionydar2612/ytpayment/blob/main/app/auth.py"
click node_members "https://github.com/dionydar2612/ytpayment/blob/main/app/routers/members.py"
click node_expenses "https://github.com/dionydar2612/ytpayment/blob/main/app/routers/expenses.py"
click node_calculation "https://github.com/dionydar2612/ytpayment/blob/main/app/services/calculation.py"
click node_history "https://github.com/dionydar2612/ytpayment/blob/main/app/routers/history.py"
click node_slips "https://github.com/dionydar2612/ytpayment/blob/main/app/routers/slips.py"
click node_storage "https://github.com/dionydar2612/ytpayment/blob/main/app/services/storage.py"
click node_payments "https://github.com/dionydar2612/ytpayment/blob/main/app/routers/payments.py"
click node_models "https://github.com/dionydar2612/ytpayment/blob/main/app/models.py"
click node_database "https://github.com/dionydar2612/ytpayment/blob/main/app/database.py"

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_webapp,node_browserjs,node_entry,node_pages,node_dashboard toneBlue
class node_authroute,node_auth toneAmber
class node_members,node_expenses,node_calculation,node_history toneMint
class node_slips,node_storage,node_payments toneRose
class node_models,node_database,node_postgres,node_member,node_admin toneIndigo
```

## Components

### Web application

- [Web interface](https://github.com/dionydar2612/ytpayment/tree/main/app/templates): `app/templates`
- [Browser behavior](https://github.com/dionydar2612/ytpayment/blob/main/app/static/app.js): `app/static/app.js`
- [FastAPI app](https://github.com/dionydar2612/ytpayment/blob/main/app/main.py): `app/main.py`
- [Page routes](https://github.com/dionydar2612/ytpayment/blob/main/app/routers/pages.py): `app/routers/pages.py`
- [Dashboard](https://github.com/dionydar2612/ytpayment/blob/main/app/routers/dashboard.py): `app/routers/dashboard.py`

### Identity and access

- [Auth routes](https://github.com/dionydar2612/ytpayment/blob/main/app/routers/auth.py): `app/routers/auth.py`
- [Authentication](https://github.com/dionydar2612/ytpayment/blob/main/app/auth.py): `app/auth.py`

### Expense and balances

- [Member management](https://github.com/dionydar2612/ytpayment/blob/main/app/routers/members.py): `app/routers/members.py`
- [Expense management](https://github.com/dionydar2612/ytpayment/blob/main/app/routers/expenses.py): `app/routers/expenses.py`
- [Balance calculation](https://github.com/dionydar2612/ytpayment/blob/main/app/services/calculation.py): `app/services/calculation.py`
- [Financial history](https://github.com/dionydar2612/ytpayment/blob/main/app/routers/history.py): `app/routers/history.py`

### Payments and slips

- [Slip submissions](https://github.com/dionydar2612/ytpayment/blob/main/app/routers/slips.py): `app/routers/slips.py`
- [Slip storage](https://github.com/dionydar2612/ytpayment/blob/main/app/services/storage.py): `app/services/storage.py`
- [Payment review](https://github.com/dionydar2612/ytpayment/blob/main/app/routers/payments.py): `app/routers/payments.py`

### Persistence

- [Domain models](https://github.com/dionydar2612/ytpayment/blob/main/app/models.py): `app/models.py`
- [Database session](https://github.com/dionydar2612/ytpayment/blob/main/app/database.py): `app/database.py`
- **PostgreSQL**

### Other components

- **Member**
- **Admin**

## Connections

- Member → Web interface: uses
- Admin → Web interface: uses
- Web interface → Browser behavior: loads
- Browser behavior → FastAPI app: requests
- FastAPI app → Page routes: dispatches
- FastAPI app → Auth routes: dispatches
- FastAPI app → Dashboard: dispatches
- FastAPI app → Member management: dispatches
- FastAPI app → Expense management: dispatches
- FastAPI app → Slip submissions: dispatches
- FastAPI app → Payment review: dispatches
- FastAPI app → Financial history: dispatches
- Auth routes → Authentication: verifies credentials
- Member management → Authentication: requires admin
- Expense management → Authentication: checks access
- Slip submissions → Authentication: checks access
- Payment review → Authentication: requires admin
- Dashboard → Authentication: checks session
- Financial history → Authentication: checks session
- Member management → Balance calculation: sets old balance
- Expense management → Balance calculation: calculates shares
- Dashboard → Balance calculation: recomputes balances
- Financial history → Balance calculation: recomputes balances
- Slip submissions → Slip storage: stores uploads
- Payment review → Balance calculation: records confirmed payment
- Balance calculation → Domain models: reads and updates
- Member management → Domain models: manages records
- Expense management → Domain models: stores expenses
- Slip submissions → Domain models: stores slip records
- Payment review → Domain models: stores payment records
- Financial history → Domain models: reads records
- Dashboard → Domain models: reads records
- Database session → PostgreSQL: connects
- FastAPI app → Database session: initializes schema
- Authentication → Database session: loads user
