# lindsey5/expense-tracker-backend architecture

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

- Interactive diagram: https://gitdiagram.com/lindsey5/expense-tracker-backend
- Repository: https://github.com/lindsey5/expense-tracker-backend

## Overview

This NestJS backend exposes an expense-tracking API: users can register, verify email, and log in, then manage wallets, budgets, and transactions and request transaction summaries. Controllers dispatch requests to domain services; the sampled authentication service persists user state through Prisma and sends verification mail through the email service. The tree also contains user lookup and a worker subsystem, but their implementation and wiring were not sampled, so their behavior and connections are left unspecified.

Main entry points: [`src/transaction/transaction.controller.ts`](https://github.com/lindsey5/expense-tracker-backend/blob/main/src/transaction/transaction.controller.ts) (Transaction API), [`src/auth/guards/JwtAuthGuard.ts`](https://github.com/lindsey5/expense-tracker-backend/blob/main/src/auth/guards/JwtAuthGuard.ts) (JWT guard), [`src/auth/auth.service.ts`](https://github.com/lindsey5/expense-tracker-backend/blob/main/src/auth/auth.service.ts) (Authentication), [`src/wallet/wallet.controller.ts`](https://github.com/lindsey5/expense-tracker-backend/blob/main/src/wallet/wallet.controller.ts) (Wallet API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API and identity"]
  node_auth_controller["Auth endpoints<br/>[auth.controller.ts]"]
  node_auth_service["Authentication<br/>[auth.service.ts]"]
  node_jwt_guard["JWT guard<br/>[JwtAuthGuard.ts]"]
  node_user_controller["User lookup API<br/>[user.controller.ts]"]
  node_user_service["User operations<br/>[user.service.ts]"]
end

subgraph group_finance["Financial domains"]
  node_wallet_controller["Wallet API"]
  node_wallet_service["Wallet operations<br/>[wallet.service.ts]"]
  node_budget_controller["Budget API"]
  node_budget_service["Budget operations<br/>[budget.service.ts]"]
  node_transaction_controller["Transaction API"]
  node_transaction_service["Transaction operations"]
  node_summary_service["Transaction summaries"]
end

subgraph group_infra["Persistence and email"]
  node_prisma["Prisma database access<br/>[prisma.service.ts]"]
  node_postgres[("PostgreSQL")]
  node_email_service["Verification email<br/>[email.service.ts]"]
  node_brevo["Brevo email service"]
end

subgraph group_background["Background processing"]
  node_worker["Worker subsystem<br/>[worker.ts]"]
end

node_client(("API client"))

node_client -->|"submits auth"| node_auth_controller
node_client -->|"looks up user"| node_user_controller
node_client -->|"manages wallets"| node_wallet_controller
node_client -->|"manages budgets"| node_budget_controller
node_client -->|"manages transactions"| node_transaction_controller
node_auth_controller -->|"dispatches auth"| node_auth_service
node_user_controller -->|"dispatches lookup"| node_user_service
node_wallet_controller -->|"dispatches wallet"| node_wallet_service
node_budget_controller -->|"dispatches budget"| node_budget_service
node_transaction_controller -->|"dispatches transactions"| node_transaction_service
node_transaction_controller -->|"requests summaries"| node_summary_service
node_jwt_guard -->|"guards routes"| node_wallet_controller
node_jwt_guard -->|"guards routes"| node_budget_controller
node_jwt_guard -->|"guards routes"| node_transaction_controller
node_auth_service -->|"reads and writes"| node_prisma
node_auth_service -->|"sends codes"| node_email_service
node_email_service -->|"sends email"| node_brevo
node_prisma -->|"accesses database"| node_postgres

click node_auth_controller "https://github.com/lindsey5/expense-tracker-backend/blob/main/src/auth/auth.controller.ts"
click node_auth_service "https://github.com/lindsey5/expense-tracker-backend/blob/main/src/auth/auth.service.ts"
click node_jwt_guard "https://github.com/lindsey5/expense-tracker-backend/blob/main/src/auth/guards/JwtAuthGuard.ts"
click node_user_controller "https://github.com/lindsey5/expense-tracker-backend/blob/main/src/user/user.controller.ts"
click node_user_service "https://github.com/lindsey5/expense-tracker-backend/blob/main/src/user/user.service.ts"
click node_wallet_controller "https://github.com/lindsey5/expense-tracker-backend/blob/main/src/wallet/wallet.controller.ts"
click node_wallet_service "https://github.com/lindsey5/expense-tracker-backend/blob/main/src/wallet/wallet.service.ts"
click node_budget_controller "https://github.com/lindsey5/expense-tracker-backend/blob/main/src/budget/budget.controller.ts"
click node_budget_service "https://github.com/lindsey5/expense-tracker-backend/blob/main/src/budget/budget.service.ts"
click node_transaction_controller "https://github.com/lindsey5/expense-tracker-backend/blob/main/src/transaction/transaction.controller.ts"
click node_transaction_service "https://github.com/lindsey5/expense-tracker-backend/blob/main/src/transaction/transaction.service.ts"
click node_summary_service "https://github.com/lindsey5/expense-tracker-backend/blob/main/src/transaction/transaction-summary.service.ts"
click node_prisma "https://github.com/lindsey5/expense-tracker-backend/blob/main/src/prisma/prisma.service.ts"
click node_email_service "https://github.com/lindsey5/expense-tracker-backend/blob/main/src/email/email.service.ts"
click node_worker "https://github.com/lindsey5/expense-tracker-backend/blob/main/src/worker/worker.ts"

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_auth_controller,node_auth_service,node_jwt_guard,node_user_controller,node_user_service,node_client toneBlue
class node_wallet_controller,node_wallet_service,node_budget_controller,node_budget_service,node_transaction_controller,node_transaction_service,node_summary_service toneAmber
class node_prisma,node_postgres,node_email_service,node_brevo toneMint
class node_worker toneRose
```

## Components

### API and identity

- [Auth endpoints](https://github.com/lindsey5/expense-tracker-backend/blob/main/src/auth/auth.controller.ts): `src/auth/auth.controller.ts`
- [Authentication](https://github.com/lindsey5/expense-tracker-backend/blob/main/src/auth/auth.service.ts): `src/auth/auth.service.ts`
- [JWT guard](https://github.com/lindsey5/expense-tracker-backend/blob/main/src/auth/guards/JwtAuthGuard.ts): `src/auth/guards/JwtAuthGuard.ts`
- [User lookup API](https://github.com/lindsey5/expense-tracker-backend/blob/main/src/user/user.controller.ts): `src/user/user.controller.ts`
- [User operations](https://github.com/lindsey5/expense-tracker-backend/blob/main/src/user/user.service.ts): `src/user/user.service.ts`

### Financial domains

- [Wallet API](https://github.com/lindsey5/expense-tracker-backend/blob/main/src/wallet/wallet.controller.ts): `src/wallet/wallet.controller.ts`
- [Wallet operations](https://github.com/lindsey5/expense-tracker-backend/blob/main/src/wallet/wallet.service.ts): `src/wallet/wallet.service.ts`
- [Budget API](https://github.com/lindsey5/expense-tracker-backend/blob/main/src/budget/budget.controller.ts): `src/budget/budget.controller.ts`
- [Budget operations](https://github.com/lindsey5/expense-tracker-backend/blob/main/src/budget/budget.service.ts): `src/budget/budget.service.ts`
- [Transaction API](https://github.com/lindsey5/expense-tracker-backend/blob/main/src/transaction/transaction.controller.ts): `src/transaction/transaction.controller.ts`
- [Transaction operations](https://github.com/lindsey5/expense-tracker-backend/blob/main/src/transaction/transaction.service.ts): `src/transaction/transaction.service.ts`
- [Transaction summaries](https://github.com/lindsey5/expense-tracker-backend/blob/main/src/transaction/transaction-summary.service.ts): `src/transaction/transaction-summary.service.ts`

### Persistence and email

- [Prisma database access](https://github.com/lindsey5/expense-tracker-backend/blob/main/src/prisma/prisma.service.ts): `src/prisma/prisma.service.ts`
- **PostgreSQL**
- [Verification email](https://github.com/lindsey5/expense-tracker-backend/blob/main/src/email/email.service.ts): `src/email/email.service.ts`
- **Brevo email service**

### Background processing

- [Worker subsystem](https://github.com/lindsey5/expense-tracker-backend/blob/main/src/worker/worker.ts): `src/worker/worker.ts`

### Other components

- **API client**

## Connections

- API client → Auth endpoints: submits auth
- API client → User lookup API: looks up user
- API client → Wallet API: manages wallets
- API client → Budget API: manages budgets
- API client → Transaction API: manages transactions
- Auth endpoints → Authentication: dispatches auth
- User lookup API → User operations: dispatches lookup
- Wallet API → Wallet operations: dispatches wallet
- Budget API → Budget operations: dispatches budget
- Transaction API → Transaction operations: dispatches transactions
- Transaction API → Transaction summaries: requests summaries
- JWT guard → Wallet API: guards routes
- JWT guard → Budget API: guards routes
- JWT guard → Transaction API: guards routes
- Authentication → Prisma database access: reads and writes
- Authentication → Verification email: sends codes
- Verification email → Brevo email service: sends email
- Prisma database access → PostgreSQL: accesses database
