# jricardoss/minha_carteira architecture

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

- Interactive diagram: https://gitdiagram.com/jricardoss/minha_carteira
- Repository: https://github.com/jricardoss/minha_carteira

## Overview

Minha Carteira is a personal-finance app: users register or sign in, manage income and expense transactions, and review filtered lists and dashboard summaries. The React client routes users through authentication and protected finance pages; its API client sends requests to an Express backend, which handles authentication and transaction operations against SQLite. Dashboard charts and summary widgets are distinct presentation capabilities. The excerpts establish frontend calls and backend persistence, but do not show the client/server runtime wiring end to end; that link is marked unverified.

Main entry points: [`frontend/src/services/api.js`](https://github.com/jricardoss/minha_carteira/blob/main/frontend/src/services/api.js) (API client), [`frontend/src/Routes/App.routes.tsx`](https://github.com/jricardoss/minha_carteira/blob/main/frontend/src/Routes/App.routes.tsx) (Route selection), [`frontend/src/Routes/PrivateRoute.tsx`](https://github.com/jricardoss/minha_carteira/blob/main/frontend/src/Routes/PrivateRoute.tsx) (Private routes), [`frontend/src/pages/Dashboard/index.tsx`](https://github.com/jricardoss/minha_carteira/blob/main/frontend/src/pages/Dashboard/index.tsx) (Dashboard)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web client"]
  node_app["App shell<br/>[App.tsx]"]
  node_routes["Route selection<br/>[App.routes.tsx]"]
  node_guard["Private routes<br/>[PrivateRoute.tsx]"]
  node_authui["Login<br/>[index.tsx]"]
  node_register["Registration<br/>[index.tsx]"]
  node_auth["Auth state<br/>[auth.tsx]"]
  node_api["API client<br/>[api.js]"]
end

subgraph group_finance["Finance features"]
  node_dashboard["Dashboard<br/>[index.tsx]"]
  node_charts["Finance charts<br/>[index.tsx]"]
  node_wallet["Wallet summary<br/>[index.tsx]"]
  node_list["Transaction list<br/>[index.tsx]"]
  node_add["Add transaction<br/>[index.tsx]"]
  node_expense_repo["Expense repository<br/>[expenses.ts]"]
  node_gain_repo["Income repository<br/>[gains.ts]"]
end

subgraph group_backend["API and storage"]
  node_server["Express API<br/>[server.js]"]
  node_db[("SQLite database<br/>[database.js]")]
end

node_user(("User"))
node_google{{"Google identity"}}

node_user -->|"signs in"| node_authui
node_user -->|"creates account"| node_register
node_app -->|"provides auth"| node_auth
node_app -->|"renders routes"| node_routes
node_routes -->|"routes to"| node_authui
node_routes -->|"routes to"| node_register
node_routes -->|"protects pages"| node_guard
node_guard -->|"checks session"| node_auth
node_authui -->|"calls login"| node_auth
node_authui -.->|"obtains credential"| node_google
node_auth -->|"sends auth requests"| node_api
node_register -->|"posts registration"| node_api
node_api -.->|"calls HTTP API"| node_server
node_server -->|"queries and writes"| node_db
node_guard -->|"routes to"| node_dashboard
node_guard -->|"routes to"| node_list
node_dashboard -->|"fetches transactions"| node_api
node_dashboard -->|"renders summaries"| node_wallet
node_dashboard -->|"renders history"| node_charts
node_list -->|"loads and edits"| node_api
node_add -->|"submits transaction"| node_api

click node_app "https://github.com/jricardoss/minha_carteira/blob/main/frontend/src/App.tsx"
click node_routes "https://github.com/jricardoss/minha_carteira/blob/main/frontend/src/Routes/App.routes.tsx"
click node_guard "https://github.com/jricardoss/minha_carteira/blob/main/frontend/src/Routes/PrivateRoute.tsx"
click node_authui "https://github.com/jricardoss/minha_carteira/blob/main/frontend/src/pages/Login/index.tsx"
click node_register "https://github.com/jricardoss/minha_carteira/blob/main/frontend/src/pages/Register/index.tsx"
click node_auth "https://github.com/jricardoss/minha_carteira/blob/main/frontend/src/Hooks/auth.tsx"
click node_api "https://github.com/jricardoss/minha_carteira/blob/main/frontend/src/services/api.js"
click node_dashboard "https://github.com/jricardoss/minha_carteira/blob/main/frontend/src/pages/Dashboard/index.tsx"
click node_charts "https://github.com/jricardoss/minha_carteira/blob/main/frontend/src/components/HistoryBox/index.tsx"
click node_wallet "https://github.com/jricardoss/minha_carteira/blob/main/frontend/src/components/WalletBox/index.tsx"
click node_list "https://github.com/jricardoss/minha_carteira/blob/main/frontend/src/pages/List/index.tsx"
click node_add "https://github.com/jricardoss/minha_carteira/blob/main/frontend/src/components/AddTransaction/index.tsx"
click node_expense_repo "https://github.com/jricardoss/minha_carteira/blob/main/frontend/src/repositories/expenses.ts"
click node_gain_repo "https://github.com/jricardoss/minha_carteira/blob/main/frontend/src/repositories/gains.ts"
click node_server "https://github.com/jricardoss/minha_carteira/blob/main/backend/server.js"
click node_db "https://github.com/jricardoss/minha_carteira/blob/main/backend/database.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_app,node_routes,node_guard,node_authui,node_register,node_auth,node_api,node_user toneBlue
class node_dashboard,node_charts,node_wallet,node_list,node_add,node_expense_repo,node_gain_repo toneAmber
class node_server,node_db toneMint
class node_google toneIndigo
```

## Components

### Web client

- [App shell](https://github.com/jricardoss/minha_carteira/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Route selection](https://github.com/jricardoss/minha_carteira/blob/main/frontend/src/Routes/App.routes.tsx): `frontend/src/Routes/App.routes.tsx`
- [Private routes](https://github.com/jricardoss/minha_carteira/blob/main/frontend/src/Routes/PrivateRoute.tsx): `frontend/src/Routes/PrivateRoute.tsx`
- [Login](https://github.com/jricardoss/minha_carteira/blob/main/frontend/src/pages/Login/index.tsx): `frontend/src/pages/Login/index.tsx`
- [Registration](https://github.com/jricardoss/minha_carteira/blob/main/frontend/src/pages/Register/index.tsx): `frontend/src/pages/Register/index.tsx`
- [Auth state](https://github.com/jricardoss/minha_carteira/blob/main/frontend/src/Hooks/auth.tsx): `frontend/src/Hooks/auth.tsx`
- [API client](https://github.com/jricardoss/minha_carteira/blob/main/frontend/src/services/api.js): `frontend/src/services/api.js`

### Finance features

- [Dashboard](https://github.com/jricardoss/minha_carteira/blob/main/frontend/src/pages/Dashboard/index.tsx): `frontend/src/pages/Dashboard/index.tsx`
- [Finance charts](https://github.com/jricardoss/minha_carteira/blob/main/frontend/src/components/HistoryBox/index.tsx): `frontend/src/components/HistoryBox/index.tsx`
- [Wallet summary](https://github.com/jricardoss/minha_carteira/blob/main/frontend/src/components/WalletBox/index.tsx): `frontend/src/components/WalletBox/index.tsx`
- [Transaction list](https://github.com/jricardoss/minha_carteira/blob/main/frontend/src/pages/List/index.tsx): `frontend/src/pages/List/index.tsx`
- [Add transaction](https://github.com/jricardoss/minha_carteira/blob/main/frontend/src/components/AddTransaction/index.tsx): `frontend/src/components/AddTransaction/index.tsx`
- [Expense repository](https://github.com/jricardoss/minha_carteira/blob/main/frontend/src/repositories/expenses.ts): `frontend/src/repositories/expenses.ts`
- [Income repository](https://github.com/jricardoss/minha_carteira/blob/main/frontend/src/repositories/gains.ts): `frontend/src/repositories/gains.ts`

### API and storage

- [Express API](https://github.com/jricardoss/minha_carteira/blob/main/backend/server.js): `backend/server.js`
- [SQLite database](https://github.com/jricardoss/minha_carteira/blob/main/backend/database.js): `backend/database.js`

### Other components

- **User**
- **Google identity**

## Connections

- User → Login: signs in (evidence: `frontend/src/pages/Login/index.tsx`)
- User → Registration: creates account (evidence: `frontend/src/pages/Register/index.tsx`)
- App shell → Auth state: provides auth (evidence: `frontend/src/App.tsx`)
- App shell → Route selection: renders routes (evidence: `frontend/src/App.tsx`)
- Route selection → Login: routes to (evidence: `frontend/src/Routes/App.routes.tsx`)
- Route selection → Registration: routes to (evidence: `frontend/src/Routes/App.routes.tsx`)
- Route selection → Private routes: protects pages (evidence: `frontend/src/Routes/App.routes.tsx`)
- Private routes → Auth state: checks session (evidence: `frontend/src/Routes/PrivateRoute.tsx`)
- Login → Auth state: calls login (evidence: `frontend/src/pages/Login/index.tsx`)
- Login → Google identity: obtains credential
- Auth state → API client: sends auth requests (evidence: `frontend/src/Hooks/auth.tsx`)
- Registration → API client: posts registration (evidence: `frontend/src/pages/Register/index.tsx`)
- API client → Express API: calls HTTP API
- Express API → SQLite database: queries and writes (evidence: `backend/server.js`)
- Private routes → Dashboard: routes to (evidence: `frontend/src/Routes/App.routes.tsx`)
- Private routes → Transaction list: routes to (evidence: `frontend/src/Routes/App.routes.tsx`)
- Dashboard → API client: fetches transactions (evidence: `frontend/src/pages/Dashboard/index.tsx`)
- Dashboard → Wallet summary: renders summaries (evidence: `frontend/src/pages/Dashboard/index.tsx`)
- Dashboard → Finance charts: renders history (evidence: `frontend/src/pages/Dashboard/index.tsx`)
- Transaction list → API client: loads and edits (evidence: `frontend/src/pages/List/index.tsx`)
- Add transaction → API client: submits transaction (evidence: `frontend/src/components/AddTransaction/index.tsx`)
