# gitjoao/my-finance architecture

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

- Interactive diagram: https://gitdiagram.com/gitjoao/my-finance
- Repository: https://github.com/gitjoao/my-finance

## Overview

This is an Express personal-finance API. Clients authenticate, then use protected endpoints to manage transactions and categories, inspect budgets and reports, and access dashboard routes. Transaction handling covers filtering, summaries, fixed-expense presets, and credit-card bill payment. Controllers delegate to services and, where evidenced, repositories backed by Prisma and PostgreSQL. The README is empty; feature scope comes from the route and module names. Some connections rely on SOURCE INDEX references rather than full source excerpts, so uncertain runtime wiring is omitted.

Main entry points: [`src/routes/index.ts`](https://github.com/gitjoao/my-finance/blob/master/src/routes/index.ts) (Route registry), [`src/modules/transactions/controller.ts`](https://github.com/gitjoao/my-finance/blob/master/src/modules/transactions/controller.ts) (Transaction controller), [`src/modules/transactions/repository.ts`](https://github.com/gitjoao/my-finance/blob/master/src/modules/transactions/repository.ts) (Transaction repository), [`src/modules/categories`](https://github.com/gitjoao/my-finance/tree/master/src/modules/categories) (Category management)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API and security"]
  node_routes["Route registry<br/>[index.ts]"]
  node_app["Express app<br/>[app.ts]"]
  node_authmw["Auth middleware<br/>[auth.ts]"]
  node_rate["Login limiter<br/>[rateLimit.ts]"]
  node_validate["Request validation<br/>[validate.ts]"]
end

subgraph group_identity["Identity"]
  node_authroutes["Auth routes<br/>[routes.ts]"]
  node_authctrl["Auth controller<br/>[controller.ts]"]
  node_authsvc["Auth service<br/>[service.ts]"]
  node_users["User management"]
end

subgraph group_finance["Finance operations"]
  node_txroutes["Transaction routes<br/>[routes.ts]"]
  node_txctrl["Transaction controller<br/>[controller.ts]"]
  node_txsvc["Transaction service<br/>[service.ts]"]
  node_txrepo["Transaction repository<br/>[repository.ts]"]
  node_fixed["Fixed-expense presets<br/>[fixedExpenses.ts]"]
  node_categories["Category management"]
  node_strings["Text normalization<br/>[string.ts]"]
end

subgraph group_insights["Finance insights"]
  node_budgets["Budget views"]
  node_reports["Reports"]
  node_dashboard["Dashboard routes<br/>[routes.ts]"]
end

subgraph group_data["Persistence"]
  node_prisma["Prisma client<br/>[prisma.ts]"]
  node_postgres[("PostgreSQL")]
end

node_client(("API client"))

node_client -->|"sends requests"| node_app
node_app -->|"mounts routes"| node_routes
node_routes -->|"protects endpoints"| node_authmw
node_routes -->|"limits login"| node_rate
node_routes -->|"mounts auth"| node_authroutes
node_routes -->|"mounts transactions"| node_txroutes
node_routes -->|"mounts categories"| node_categories
node_routes -->|"mounts budgets"| node_budgets
node_routes -->|"mounts reports"| node_reports
node_routes -->|"mounts users"| node_users
node_routes -->|"mounts dashboard"| node_dashboard
node_authroutes -->|"uses validation"| node_validate
node_authroutes -->|"dispatches to"| node_authctrl
node_authctrl -->|"calls"| node_authsvc
node_authsvc -->|"looks up users"| node_users
node_txroutes -->|"uses validation"| node_validate
node_txroutes -->|"dispatches to"| node_txctrl
node_txctrl -->|"calls"| node_txsvc
node_txctrl -->|"normalizes text"| node_strings
node_txsvc -->|"uses repository"| node_txrepo
node_txsvc -->|"uses presets"| node_fixed
node_txrepo -->|"queries through"| node_prisma
node_categories -->|"persists categories"| node_prisma
node_budgets -->|"reads category data"| node_categories
node_budgets -->|"reads transactions"| node_txrepo
node_reports -->|"reads category data"| node_categories
node_reports -->|"reads transactions"| node_txrepo
node_prisma -->|"connects to"| node_postgres
node_dashboard -->|"references controller"| node_txctrl

click node_routes "https://github.com/gitjoao/my-finance/blob/master/src/routes/index.ts"
click node_app "https://github.com/gitjoao/my-finance/blob/master/src/app.ts"
click node_authmw "https://github.com/gitjoao/my-finance/blob/master/src/middlewares/auth.ts"
click node_rate "https://github.com/gitjoao/my-finance/blob/master/src/middlewares/rateLimit.ts"
click node_validate "https://github.com/gitjoao/my-finance/blob/master/src/middlewares/validate.ts"
click node_authroutes "https://github.com/gitjoao/my-finance/blob/master/src/modules/auth/routes.ts"
click node_authctrl "https://github.com/gitjoao/my-finance/blob/master/src/modules/auth/controller.ts"
click node_authsvc "https://github.com/gitjoao/my-finance/blob/master/src/modules/auth/service.ts"
click node_users "https://github.com/gitjoao/my-finance/tree/master/src/modules/users"
click node_txroutes "https://github.com/gitjoao/my-finance/blob/master/src/modules/transactions/routes.ts"
click node_txctrl "https://github.com/gitjoao/my-finance/blob/master/src/modules/transactions/controller.ts"
click node_txsvc "https://github.com/gitjoao/my-finance/blob/master/src/modules/transactions/service.ts"
click node_txrepo "https://github.com/gitjoao/my-finance/blob/master/src/modules/transactions/repository.ts"
click node_fixed "https://github.com/gitjoao/my-finance/blob/master/src/modules/transactions/preset/fixedExpenses.ts"
click node_categories "https://github.com/gitjoao/my-finance/tree/master/src/modules/categories"
click node_budgets "https://github.com/gitjoao/my-finance/tree/master/src/modules/budgets"
click node_reports "https://github.com/gitjoao/my-finance/tree/master/src/modules/reports"
click node_dashboard "https://github.com/gitjoao/my-finance/blob/master/src/modules/dashboard/routes.ts"
click node_strings "https://github.com/gitjoao/my-finance/blob/master/src/utils/string.ts"
click node_prisma "https://github.com/gitjoao/my-finance/blob/master/src/lib/prisma.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_routes,node_app,node_authmw,node_rate,node_validate,node_client toneBlue
class node_authroutes,node_authctrl,node_authsvc,node_users toneAmber
class node_txroutes,node_txctrl,node_txsvc,node_txrepo,node_fixed,node_categories,node_strings toneMint
class node_budgets,node_reports,node_dashboard toneRose
class node_prisma,node_postgres toneIndigo
```

## Components

### API and security

- [Route registry](https://github.com/gitjoao/my-finance/blob/master/src/routes/index.ts): `src/routes/index.ts`
- [Express app](https://github.com/gitjoao/my-finance/blob/master/src/app.ts): `src/app.ts`
- [Auth middleware](https://github.com/gitjoao/my-finance/blob/master/src/middlewares/auth.ts): `src/middlewares/auth.ts`
- [Login limiter](https://github.com/gitjoao/my-finance/blob/master/src/middlewares/rateLimit.ts): `src/middlewares/rateLimit.ts`
- [Request validation](https://github.com/gitjoao/my-finance/blob/master/src/middlewares/validate.ts): `src/middlewares/validate.ts`

### Identity

- [Auth routes](https://github.com/gitjoao/my-finance/blob/master/src/modules/auth/routes.ts): `src/modules/auth/routes.ts`
- [Auth controller](https://github.com/gitjoao/my-finance/blob/master/src/modules/auth/controller.ts): `src/modules/auth/controller.ts`
- [Auth service](https://github.com/gitjoao/my-finance/blob/master/src/modules/auth/service.ts): `src/modules/auth/service.ts`
- [User management](https://github.com/gitjoao/my-finance/tree/master/src/modules/users): `src/modules/users`

### Finance operations

- [Transaction routes](https://github.com/gitjoao/my-finance/blob/master/src/modules/transactions/routes.ts): `src/modules/transactions/routes.ts`
- [Transaction controller](https://github.com/gitjoao/my-finance/blob/master/src/modules/transactions/controller.ts): `src/modules/transactions/controller.ts`
- [Transaction service](https://github.com/gitjoao/my-finance/blob/master/src/modules/transactions/service.ts): `src/modules/transactions/service.ts`
- [Transaction repository](https://github.com/gitjoao/my-finance/blob/master/src/modules/transactions/repository.ts): `src/modules/transactions/repository.ts`
- [Fixed-expense presets](https://github.com/gitjoao/my-finance/blob/master/src/modules/transactions/preset/fixedExpenses.ts): `src/modules/transactions/preset/fixedExpenses.ts`
- [Category management](https://github.com/gitjoao/my-finance/tree/master/src/modules/categories): `src/modules/categories`
- [Text normalization](https://github.com/gitjoao/my-finance/blob/master/src/utils/string.ts): `src/utils/string.ts`

### Finance insights

- [Budget views](https://github.com/gitjoao/my-finance/tree/master/src/modules/budgets): `src/modules/budgets`
- [Reports](https://github.com/gitjoao/my-finance/tree/master/src/modules/reports): `src/modules/reports`
- [Dashboard routes](https://github.com/gitjoao/my-finance/blob/master/src/modules/dashboard/routes.ts): `src/modules/dashboard/routes.ts`

### Persistence

- [Prisma client](https://github.com/gitjoao/my-finance/blob/master/src/lib/prisma.ts): `src/lib/prisma.ts`
- **PostgreSQL**

### Other components

- **API client**

## Connections

- API client → Express app: sends requests
- Express app → Route registry: mounts routes (evidence: `src/app.ts`)
- Route registry → Auth middleware: protects endpoints (evidence: `src/routes/index.ts`)
- Route registry → Login limiter: limits login (evidence: `src/routes/index.ts`)
- Route registry → Auth routes: mounts auth (evidence: `src/routes/index.ts`)
- Route registry → Transaction routes: mounts transactions (evidence: `src/routes/index.ts`)
- Route registry → Category management: mounts categories (evidence: `src/routes/index.ts`)
- Route registry → Budget views: mounts budgets (evidence: `src/routes/index.ts`)
- Route registry → Reports: mounts reports (evidence: `src/routes/index.ts`)
- Route registry → User management: mounts users (evidence: `src/routes/index.ts`)
- Route registry → Dashboard routes: mounts dashboard (evidence: `src/routes/index.ts`)
- Auth routes → Request validation: uses validation (evidence: `src/modules/auth/routes.ts`)
- Auth routes → Auth controller: dispatches to (evidence: `src/modules/auth/routes.ts`)
- Auth controller → Auth service: calls (evidence: `src/modules/auth/controller.ts`)
- Auth service → User management: looks up users (evidence: `src/modules/auth/service.ts`)
- Transaction routes → Request validation: uses validation (evidence: `src/modules/transactions/routes.ts`)
- Transaction routes → Transaction controller: dispatches to (evidence: `src/modules/transactions/routes.ts`)
- Transaction controller → Transaction service: calls (evidence: `src/modules/transactions/controller.ts`)
- Transaction controller → Text normalization: normalizes text (evidence: `src/modules/transactions/controller.ts`)
- Transaction service → Transaction repository: uses repository (evidence: `src/modules/transactions/service.ts`)
- Transaction service → Fixed-expense presets: uses presets (evidence: `src/modules/transactions/service.ts`)
- Transaction repository → Prisma client: queries through (evidence: `src/modules/transactions/repository.ts`)
- Category management → Prisma client: persists categories (evidence: `src/modules/categories/repository.ts`)
- Budget views → Category management: reads category data (evidence: `src/modules/budgets/service.ts`)
- Budget views → Transaction repository: reads transactions (evidence: `src/modules/budgets/service.ts`)
- Reports → Category management: reads category data (evidence: `src/modules/reports/service.ts`)
- Reports → Transaction repository: reads transactions (evidence: `src/modules/reports/service.ts`)
- Prisma client → PostgreSQL: connects to (evidence: `src/lib/prisma.ts`)
- Dashboard routes → Transaction controller: references controller (evidence: `src/modules/dashboard/routes.ts`)
