# eldinho2/paguei architecture

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

- Interactive diagram: https://gitdiagram.com/eldinho2/paguei
- Repository: https://github.com/eldinho2/paguei

## Overview

Paguei is a mobile-focused personal finance web app for recording and reviewing expenses and income. Users authenticate, view a monthly dashboard or open expense/income lists, and add or delete records; the dashboard presents summaries and spending trends. The frontend delegates record retrieval and mutations to query hooks and uses selected-month/year state. The README also documents installable PWA support. Some query, form, and PWA implementation details were not excerpted, so uncertain connections are omitted or marked unverified.

Main entry points: [`components/Main.tsx`](https://github.com/eldinho2/paguei/blob/main/components/Main.tsx) (Dashboard composition), [`components/BillListTable/ExpensesListTable.tsx`](https://github.com/eldinho2/paguei/blob/main/components/BillListTable/ExpensesListTable.tsx) (Bill list and actions), [`utils/queries/get-incomes-by-month.ts`](https://github.com/eldinho2/paguei/blob/main/utils/queries/get-incomes-by-month.ts) (Income queries), [`utils/queries/get-expenses-by-month.ts`](https://github.com/eldinho2/paguei/blob/main/utils/queries/get-expenses-by-month.ts) (Expense queries)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Finance experience"]
  node_home["Home dashboard<br/>[page.tsx]"]
  node_dashboard["Dashboard composition<br/>[Main.tsx]"]
  node_summary["Financial summary<br/>[MainResume.tsx]"]
  node_overview["Category overview<br/>[OverviewCard.tsx]"]
  node_trend["Monthly trends"]
  node_recentexpenses["Recent expenses<br/>[LastExpenses.tsx]"]
  node_recentincomes["Recent income<br/>[LastIncomes.tsx]"]
  node_expensepage["Expense page<br/>[page.tsx]"]
  node_incomepage["Income page<br/>[page.tsx]"]
  node_monthnav["Month navigation"]
end

subgraph group_records["Bill management"]
  node_billtable["Bill list and actions"]
  node_billform["Bill entry form<br/>[AddBillForm.tsx]"]
  node_expensecreate["Create expense<br/>[create-expense.ts]"]
  node_incomecreate["Create income<br/>[create-income.ts]"]
  node_expensequery["Expense queries"]
  node_incomequery["Income queries"]
  node_expensedelete["Delete expense<br/>[delete-expense.ts]"]
  node_incomedelete["Delete income<br/>[delete-income.ts]"]
end

subgraph group_identity["Identity and access"]
  node_login["Login page<br/>[page.tsx]"]
  node_googlelogin["Google sign-in control<br/>[AuthWithGoogle.tsx]"]
  node_auth["Authentication config<br/>[auth.ts]"]
  node_authroute["Auth API route<br/>[route.ts]"]
  node_backendauth{{"Backend auth API"}}
end

subgraph group_client["Client state and PWA"]
  node_monthstate["Selected month state"]
  node_yearstate["Selected year state"]
  node_serviceworker["PWA service worker<br/>[sw.js]"]
end

node_user(("User"))
node_browser(("Browser"))

node_user -->|"opens"| node_home
node_home -->|"renders"| node_dashboard
node_dashboard -->|"renders"| node_summary
node_dashboard -->|"renders"| node_overview
node_dashboard -->|"renders"| node_trend
node_dashboard -->|"renders"| node_recentexpenses
node_dashboard -->|"renders"| node_recentincomes
node_dashboard -->|"loads expenses"| node_expensequery
node_dashboard -->|"loads income"| node_incomequery
node_expensepage -->|"renders"| node_monthnav
node_incomepage -->|"renders"| node_monthnav
node_expensepage -->|"renders"| node_billtable
node_incomepage -->|"renders"| node_billtable
node_expensepage -->|"loads expenses"| node_expensequery
node_incomepage -->|"loads income"| node_incomequery
node_billtable -->|"loads expenses"| node_expensequery
node_billtable -->|"loads income"| node_incomequery
node_billtable -->|"deletes expense"| node_expensedelete
node_billtable -->|"deletes income"| node_incomedelete
node_expensepage -.->|"opens entry"| node_billform
node_incomepage -.->|"opens entry"| node_billform
node_billform -.->|"creates expense"| node_expensecreate
node_billform -.->|"creates income"| node_incomecreate
node_user -->|"signs in"| node_login
node_login -->|"renders"| node_googlelogin
node_googlelogin -.->|"initiates sign-in"| node_auth
node_authroute -->|"uses handlers"| node_auth
node_auth -->|"checks and authenticates"| node_backendauth
node_auth -->|"registers users"| node_backendauth
node_browser -.->|"runs offline support"| node_serviceworker
node_monthnav -->|"updates selection"| node_monthstate
node_trend -->|"reads selection"| node_monthstate
node_expensequery -->|"reads selection"| node_monthstate
node_expensequery -->|"reads selection"| node_yearstate
node_incomequery -->|"reads selection"| node_monthstate
node_incomequery -->|"reads selection"| node_yearstate
node_recentincomes -->|"loads income"| node_incomequery

click node_home "https://github.com/eldinho2/paguei/blob/main/app/page.tsx"
click node_dashboard "https://github.com/eldinho2/paguei/blob/main/components/Main.tsx"
click node_summary "https://github.com/eldinho2/paguei/blob/main/components/MainResume.tsx"
click node_overview "https://github.com/eldinho2/paguei/blob/main/components/OverviewCard.tsx"
click node_trend "https://github.com/eldinho2/paguei/blob/main/components/ChartMonthResume.tsx"
click node_recentexpenses "https://github.com/eldinho2/paguei/blob/main/components/LastExpenses.tsx"
click node_recentincomes "https://github.com/eldinho2/paguei/blob/main/components/LastIncomes.tsx"
click node_expensepage "https://github.com/eldinho2/paguei/blob/main/app/(pages)/despesas/page.tsx"
click node_incomepage "https://github.com/eldinho2/paguei/blob/main/app/(pages)/receitas/page.tsx"
click node_monthnav "https://github.com/eldinho2/paguei/blob/main/components/CarouselComponent.tsx"
click node_billtable "https://github.com/eldinho2/paguei/blob/main/components/BillListTable/ExpensesListTable.tsx"
click node_billform "https://github.com/eldinho2/paguei/blob/main/components/form/AddBillForm.tsx"
click node_expensecreate "https://github.com/eldinho2/paguei/blob/main/utils/queries/create-expense.ts"
click node_incomecreate "https://github.com/eldinho2/paguei/blob/main/utils/queries/create-income.ts"
click node_expensequery "https://github.com/eldinho2/paguei/blob/main/utils/queries/get-expenses-by-month.ts"
click node_incomequery "https://github.com/eldinho2/paguei/blob/main/utils/queries/get-incomes-by-month.ts"
click node_expensedelete "https://github.com/eldinho2/paguei/blob/main/utils/queries/delete-expense.ts"
click node_incomedelete "https://github.com/eldinho2/paguei/blob/main/utils/queries/delete-income.ts"
click node_login "https://github.com/eldinho2/paguei/blob/main/app/(pages)/login/page.tsx"
click node_googlelogin "https://github.com/eldinho2/paguei/blob/main/components/AuthWithGoogle.tsx"
click node_auth "https://github.com/eldinho2/paguei/blob/main/lib/auth.ts"
click node_authroute "https://github.com/eldinho2/paguei/blob/main/app/api/auth/%5B...nextauth%5D/route.ts"
click node_monthstate "https://github.com/eldinho2/paguei/blob/main/stores/selectedMonth-store.ts"
click node_yearstate "https://github.com/eldinho2/paguei/blob/main/stores/selectedYear-store.ts"
click node_serviceworker "https://github.com/eldinho2/paguei/blob/main/public/sw.js"

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_home,node_dashboard,node_summary,node_overview,node_trend,node_recentexpenses,node_recentincomes,node_expensepage,node_incomepage,node_monthnav,node_user,node_browser toneBlue
class node_billtable,node_billform,node_expensecreate,node_incomecreate,node_expensequery,node_incomequery,node_expensedelete,node_incomedelete toneAmber
class node_login,node_googlelogin,node_auth,node_authroute,node_backendauth toneMint
class node_monthstate,node_yearstate,node_serviceworker toneRose
```

## Components

### Finance experience

- [Home dashboard](https://github.com/eldinho2/paguei/blob/main/app/page.tsx): `app/page.tsx`
- [Dashboard composition](https://github.com/eldinho2/paguei/blob/main/components/Main.tsx): `components/Main.tsx`
- [Financial summary](https://github.com/eldinho2/paguei/blob/main/components/MainResume.tsx): `components/MainResume.tsx`
- [Category overview](https://github.com/eldinho2/paguei/blob/main/components/OverviewCard.tsx): `components/OverviewCard.tsx`
- [Monthly trends](https://github.com/eldinho2/paguei/blob/main/components/ChartMonthResume.tsx): `components/ChartMonthResume.tsx`
- [Recent expenses](https://github.com/eldinho2/paguei/blob/main/components/LastExpenses.tsx): `components/LastExpenses.tsx`
- [Recent income](https://github.com/eldinho2/paguei/blob/main/components/LastIncomes.tsx): `components/LastIncomes.tsx`
- [Expense page](https://github.com/eldinho2/paguei/blob/main/app/(pages)/despesas/page.tsx): `app/(pages)/despesas/page.tsx`
- [Income page](https://github.com/eldinho2/paguei/blob/main/app/(pages)/receitas/page.tsx): `app/(pages)/receitas/page.tsx`
- [Month navigation](https://github.com/eldinho2/paguei/blob/main/components/CarouselComponent.tsx): `components/CarouselComponent.tsx`

### Bill management

- [Bill list and actions](https://github.com/eldinho2/paguei/blob/main/components/BillListTable/ExpensesListTable.tsx): `components/BillListTable/ExpensesListTable.tsx`
- [Bill entry form](https://github.com/eldinho2/paguei/blob/main/components/form/AddBillForm.tsx): `components/form/AddBillForm.tsx`
- [Create expense](https://github.com/eldinho2/paguei/blob/main/utils/queries/create-expense.ts): `utils/queries/create-expense.ts`
- [Create income](https://github.com/eldinho2/paguei/blob/main/utils/queries/create-income.ts): `utils/queries/create-income.ts`
- [Expense queries](https://github.com/eldinho2/paguei/blob/main/utils/queries/get-expenses-by-month.ts): `utils/queries/get-expenses-by-month.ts`
- [Income queries](https://github.com/eldinho2/paguei/blob/main/utils/queries/get-incomes-by-month.ts): `utils/queries/get-incomes-by-month.ts`
- [Delete expense](https://github.com/eldinho2/paguei/blob/main/utils/queries/delete-expense.ts): `utils/queries/delete-expense.ts`
- [Delete income](https://github.com/eldinho2/paguei/blob/main/utils/queries/delete-income.ts): `utils/queries/delete-income.ts`

### Identity and access

- [Login page](https://github.com/eldinho2/paguei/blob/main/app/(pages)/login/page.tsx): `app/(pages)/login/page.tsx`
- [Google sign-in control](https://github.com/eldinho2/paguei/blob/main/components/AuthWithGoogle.tsx): `components/AuthWithGoogle.tsx`
- [Authentication config](https://github.com/eldinho2/paguei/blob/main/lib/auth.ts): `lib/auth.ts`
- [Auth API route](https://github.com/eldinho2/paguei/blob/main/app/api/auth/%5B...nextauth%5D/route.ts): `app/api/auth/[...nextauth]/route.ts`
- **Backend auth API**

### Client state and PWA

- [Selected month state](https://github.com/eldinho2/paguei/blob/main/stores/selectedMonth-store.ts): `stores/selectedMonth-store.ts`
- [Selected year state](https://github.com/eldinho2/paguei/blob/main/stores/selectedYear-store.ts): `stores/selectedYear-store.ts`
- [PWA service worker](https://github.com/eldinho2/paguei/blob/main/public/sw.js): `public/sw.js`

### Other components

- **User**
- **Browser**

## Connections

- User → Home dashboard: opens (evidence: `app/page.tsx`)
- Home dashboard → Dashboard composition: renders (evidence: `app/page.tsx`)
- Dashboard composition → Financial summary: renders (evidence: `components/Main.tsx`)
- Dashboard composition → Category overview: renders (evidence: `components/Main.tsx`)
- Dashboard composition → Monthly trends: renders (evidence: `components/Main.tsx`)
- Dashboard composition → Recent expenses: renders (evidence: `components/Main.tsx`)
- Dashboard composition → Recent income: renders (evidence: `components/Main.tsx`)
- Dashboard composition → Expense queries: loads expenses (evidence: `components/Main.tsx`)
- Dashboard composition → Income queries: loads income (evidence: `components/Main.tsx`)
- Expense page → Month navigation: renders (evidence: `app/(pages)/despesas/page.tsx`)
- Income page → Month navigation: renders (evidence: `app/(pages)/receitas/page.tsx`)
- Expense page → Bill list and actions: renders (evidence: `app/(pages)/despesas/page.tsx`)
- Income page → Bill list and actions: renders (evidence: `app/(pages)/receitas/page.tsx`)
- Expense page → Expense queries: loads expenses (evidence: `app/(pages)/despesas/page.tsx`)
- Income page → Income queries: loads income (evidence: `app/(pages)/receitas/page.tsx`)
- Bill list and actions → Expense queries: loads expenses (evidence: `components/BillListTable/ExpensesListTable.tsx`)
- Bill list and actions → Income queries: loads income (evidence: `components/BillListTable/ExpensesListTable.tsx`)
- Bill list and actions → Delete expense: deletes expense (evidence: `components/BillListTable/ExpensesListTable.tsx`)
- Bill list and actions → Delete income: deletes income (evidence: `components/BillListTable/ExpensesListTable.tsx`)
- Expense page → Bill entry form: opens entry
- Income page → Bill entry form: opens entry
- Bill entry form → Create expense: creates expense
- Bill entry form → Create income: creates income
- User → Login page: signs in (evidence: `app/(pages)/login/page.tsx`)
- Login page → Google sign-in control: renders (evidence: `app/(pages)/login/page.tsx`)
- Google sign-in control → Authentication config: initiates sign-in
- Auth API route → Authentication config: uses handlers (evidence: `app/api/auth/[...nextauth]/route.ts`)
- Authentication config → Backend auth API: checks and authenticates (evidence: `lib/auth.ts`)
- Authentication config → Backend auth API: registers users (evidence: `lib/auth.ts`)
- Browser → PWA service worker: runs offline support
- Month navigation → Selected month state: updates selection (evidence: `components/CarouselComponent.tsx`)
- Monthly trends → Selected month state: reads selection (evidence: `components/ChartMonthResume.tsx`)
- Expense queries → Selected month state: reads selection (evidence: `utils/queries/get-expenses-by-month.ts`)
- Expense queries → Selected year state: reads selection (evidence: `utils/queries/get-expenses-by-month.ts`)
- Income queries → Selected month state: reads selection (evidence: `utils/queries/get-incomes-by-month.ts`)
- Income queries → Selected year state: reads selection (evidence: `utils/queries/get-incomes-by-month.ts`)
- Recent income → Income queries: loads income (evidence: `components/LastIncomes.tsx`)
