# jsamaniego-umbraltech/manejo-gasto architecture

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

- Interactive diagram: https://gitdiagram.com/jsamaniego-umbraltech/manejo-gasto
- Repository: https://github.com/jsamaniego-umbraltech/manejo-gasto

## Overview

Manejo de Gastos is a household-finance web app: users sign in, choose or create a household, then manage expenses, income, recurring bills, cards, vehicles, reports, and household members. The browser routes users to feature screens; shared query and API clients communicate with FastAPI, whose routers enforce session, household, and role checks before operating on PostgreSQL. Separate capabilities include Google login, invitations, audit history, platform administration, and scheduled email notices. The graph follows explicit imports, routing, and documented behavior; several feature-router internals were not sampled, so their downstream links are omitted.

Main entry points: [`backend/app/main.py`](https://github.com/jsamaniego-umbraltech/manejo-gasto/blob/main/backend/app/main.py) (API application), [`backend/app/models.py`](https://github.com/jsamaniego-umbraltech/manejo-gasto/blob/main/backend/app/models.py) (Domain models), [`backend/app/services/avisos.py`](https://github.com/jsamaniego-umbraltech/manejo-gasto/blob/main/backend/app/services/avisos.py) (Email notices), [`backend/app/routers/auth.py`](https://github.com/jsamaniego-umbraltech/manejo-gasto/blob/main/backend/app/routers/auth.py) (Login routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web application"]
  node_browser["Routes and shell<br/>[main.tsx]"]
  node_screens["Finance screens<br/>[Quincena.tsx]"]
  node_adminui["Admin screen<br/>[Admin.tsx]"]
  node_queries["Shared queries<br/>[consultas.ts]"]
  node_client["Typed API client<br/>[client.ts]"]
end

subgraph group_api["API and access"]
  node_authroutes["Login routes<br/>[auth.py]"]
  node_household["Household routes<br/>[hogar.py]"]
  node_access["Session and access<br/>[seguridad.py]"]
  node_entry["API application<br/>[main.py]"]
  node_authsvc["Auth service<br/>[auth.py]"]
end

subgraph group_finance["Household finance"]
  node_models["Domain models<br/>[models.py]"]
  node_database[("PostgreSQL<br/>[db.py]")]
  node_activity["Payments and income<br/>[pago.py]"]
  node_setup["Household setup<br/>[categoria.py]"]
  node_fleet["Vehicles and fuel<br/>[vehiculo.py]"]
  node_cards["Cards<br/>[tarjeta.py]"]
  node_reports["Reports<br/>[reportes.py]"]
end

subgraph group_support["Platform services"]
  node_invitations["Invitations<br/>[invitacion.py]"]
  node_audit["Audit history<br/>[bitacora.py]"]
  node_noticejobs["Email notices<br/>[avisos.py]"]
  node_mail["Mail delivery<br/>[correo.py]"]
  node_templates["Email templates<br/>[plantillas.py]"]
  node_config["Runtime settings<br/>[config.py]"]
  node_calendar["Date calculations<br/>[fechas.py]"]
end

node_user(("Household user"))

node_user -->|"uses"| node_browser
node_browser -->|"routes to"| node_screens
node_browser -->|"routes to"| node_adminui
node_screens -->|"loads data"| node_queries
node_queries -->|"calls"| node_client
node_client -.->|"HTTP requests"| node_entry
node_entry -->|"mounts"| node_authroutes
node_entry -->|"mounts"| node_household
node_entry -->|"mounts"| node_activity
node_entry -->|"mounts"| node_setup
node_entry -->|"mounts"| node_fleet
node_entry -->|"mounts"| node_cards
node_entry -->|"mounts"| node_reports
node_entry -->|"mounts"| node_invitations
node_entry -->|"mounts"| node_audit
node_authroutes -->|"calls"| node_authsvc
node_authroutes -->|"uses"| node_access
node_access -->|"validates sessions"| node_authsvc
node_authroutes -->|"queries"| node_database
node_household -->|"queries"| node_models
node_activity -->|"reads and writes"| node_models
node_activity -->|"checks permissions"| node_access
node_setup -.->|"queries"| node_models
node_fleet -.->|"queries"| node_models
node_cards -.->|"queries"| node_models
node_reports -->|"queries"| node_models
node_database -->|"reads settings"| node_config
node_invitations -->|"renders"| node_templates
node_invitations -->|"sends email"| node_mail
node_noticejobs -->|"sends email"| node_mail
node_noticejobs -->|"renders"| node_templates
node_noticejobs -->|"calculates dates"| node_calendar
node_noticejobs -->|"reads settings"| node_config

click node_browser "https://github.com/jsamaniego-umbraltech/manejo-gasto/blob/main/frontend/src/main.tsx"
click node_screens "https://github.com/jsamaniego-umbraltech/manejo-gasto/blob/main/frontend/src/pages/Quincena.tsx"
click node_adminui "https://github.com/jsamaniego-umbraltech/manejo-gasto/blob/main/frontend/src/pages/Admin.tsx"
click node_queries "https://github.com/jsamaniego-umbraltech/manejo-gasto/blob/main/frontend/src/api/consultas.ts"
click node_client "https://github.com/jsamaniego-umbraltech/manejo-gasto/blob/main/frontend/src/api/client.ts"
click node_authroutes "https://github.com/jsamaniego-umbraltech/manejo-gasto/blob/main/backend/app/routers/auth.py"
click node_household "https://github.com/jsamaniego-umbraltech/manejo-gasto/blob/main/backend/app/routers/hogar.py"
click node_access "https://github.com/jsamaniego-umbraltech/manejo-gasto/blob/main/backend/app/seguridad.py"
click node_entry "https://github.com/jsamaniego-umbraltech/manejo-gasto/blob/main/backend/app/main.py"
click node_authsvc "https://github.com/jsamaniego-umbraltech/manejo-gasto/blob/main/backend/app/services/auth.py"
click node_models "https://github.com/jsamaniego-umbraltech/manejo-gasto/blob/main/backend/app/models.py"
click node_database "https://github.com/jsamaniego-umbraltech/manejo-gasto/blob/main/backend/app/db.py"
click node_activity "https://github.com/jsamaniego-umbraltech/manejo-gasto/blob/main/backend/app/routers/pago.py"
click node_setup "https://github.com/jsamaniego-umbraltech/manejo-gasto/blob/main/backend/app/routers/categoria.py"
click node_fleet "https://github.com/jsamaniego-umbraltech/manejo-gasto/blob/main/backend/app/routers/vehiculo.py"
click node_cards "https://github.com/jsamaniego-umbraltech/manejo-gasto/blob/main/backend/app/routers/tarjeta.py"
click node_reports "https://github.com/jsamaniego-umbraltech/manejo-gasto/blob/main/backend/app/services/reportes.py"
click node_invitations "https://github.com/jsamaniego-umbraltech/manejo-gasto/blob/main/backend/app/routers/invitacion.py"
click node_audit "https://github.com/jsamaniego-umbraltech/manejo-gasto/blob/main/backend/app/routers/bitacora.py"
click node_noticejobs "https://github.com/jsamaniego-umbraltech/manejo-gasto/blob/main/backend/app/services/avisos.py"
click node_mail "https://github.com/jsamaniego-umbraltech/manejo-gasto/blob/main/backend/app/services/correo.py"
click node_templates "https://github.com/jsamaniego-umbraltech/manejo-gasto/blob/main/backend/app/services/plantillas.py"
click node_config "https://github.com/jsamaniego-umbraltech/manejo-gasto/blob/main/backend/app/config.py"
click node_calendar "https://github.com/jsamaniego-umbraltech/manejo-gasto/blob/main/backend/app/services/fechas.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_browser,node_screens,node_adminui,node_queries,node_client,node_user toneBlue
class node_authroutes,node_household,node_access,node_entry,node_authsvc toneAmber
class node_models,node_database,node_activity,node_setup,node_fleet,node_cards,node_reports toneMint
class node_invitations,node_audit,node_noticejobs,node_mail,node_templates,node_config,node_calendar toneRose
```

## Components

### Web application

- [Routes and shell](https://github.com/jsamaniego-umbraltech/manejo-gasto/blob/main/frontend/src/main.tsx): `frontend/src/main.tsx`
- [Finance screens](https://github.com/jsamaniego-umbraltech/manejo-gasto/blob/main/frontend/src/pages/Quincena.tsx): `frontend/src/pages/Quincena.tsx`
- [Admin screen](https://github.com/jsamaniego-umbraltech/manejo-gasto/blob/main/frontend/src/pages/Admin.tsx): `frontend/src/pages/Admin.tsx`
- [Shared queries](https://github.com/jsamaniego-umbraltech/manejo-gasto/blob/main/frontend/src/api/consultas.ts): `frontend/src/api/consultas.ts`
- [Typed API client](https://github.com/jsamaniego-umbraltech/manejo-gasto/blob/main/frontend/src/api/client.ts): `frontend/src/api/client.ts`

### API and access

- [Login routes](https://github.com/jsamaniego-umbraltech/manejo-gasto/blob/main/backend/app/routers/auth.py): `backend/app/routers/auth.py`
- [Household routes](https://github.com/jsamaniego-umbraltech/manejo-gasto/blob/main/backend/app/routers/hogar.py): `backend/app/routers/hogar.py`
- [Session and access](https://github.com/jsamaniego-umbraltech/manejo-gasto/blob/main/backend/app/seguridad.py): `backend/app/seguridad.py`
- [API application](https://github.com/jsamaniego-umbraltech/manejo-gasto/blob/main/backend/app/main.py): `backend/app/main.py`
- [Auth service](https://github.com/jsamaniego-umbraltech/manejo-gasto/blob/main/backend/app/services/auth.py): `backend/app/services/auth.py`

### Household finance

- [Domain models](https://github.com/jsamaniego-umbraltech/manejo-gasto/blob/main/backend/app/models.py): `backend/app/models.py`
- [PostgreSQL](https://github.com/jsamaniego-umbraltech/manejo-gasto/blob/main/backend/app/db.py): `backend/app/db.py`
- [Payments and income](https://github.com/jsamaniego-umbraltech/manejo-gasto/blob/main/backend/app/routers/pago.py): `backend/app/routers/pago.py`
- [Household setup](https://github.com/jsamaniego-umbraltech/manejo-gasto/blob/main/backend/app/routers/categoria.py): `backend/app/routers/categoria.py`
- [Vehicles and fuel](https://github.com/jsamaniego-umbraltech/manejo-gasto/blob/main/backend/app/routers/vehiculo.py): `backend/app/routers/vehiculo.py`
- [Cards](https://github.com/jsamaniego-umbraltech/manejo-gasto/blob/main/backend/app/routers/tarjeta.py): `backend/app/routers/tarjeta.py`
- [Reports](https://github.com/jsamaniego-umbraltech/manejo-gasto/blob/main/backend/app/services/reportes.py): `backend/app/services/reportes.py`

### Platform services

- [Invitations](https://github.com/jsamaniego-umbraltech/manejo-gasto/blob/main/backend/app/routers/invitacion.py): `backend/app/routers/invitacion.py`
- [Audit history](https://github.com/jsamaniego-umbraltech/manejo-gasto/blob/main/backend/app/routers/bitacora.py): `backend/app/routers/bitacora.py`
- [Email notices](https://github.com/jsamaniego-umbraltech/manejo-gasto/blob/main/backend/app/services/avisos.py): `backend/app/services/avisos.py`
- [Mail delivery](https://github.com/jsamaniego-umbraltech/manejo-gasto/blob/main/backend/app/services/correo.py): `backend/app/services/correo.py`
- [Email templates](https://github.com/jsamaniego-umbraltech/manejo-gasto/blob/main/backend/app/services/plantillas.py): `backend/app/services/plantillas.py`
- [Runtime settings](https://github.com/jsamaniego-umbraltech/manejo-gasto/blob/main/backend/app/config.py): `backend/app/config.py`
- [Date calculations](https://github.com/jsamaniego-umbraltech/manejo-gasto/blob/main/backend/app/services/fechas.py): `backend/app/services/fechas.py`

### Other components

- **Household user**

## Connections

- Household user → Routes and shell: uses (evidence: `frontend/src/main.tsx`)
- Routes and shell → Finance screens: routes to (evidence: `frontend/src/main.tsx`)
- Routes and shell → Admin screen: routes to (evidence: `frontend/src/main.tsx`)
- Finance screens → Shared queries: loads data (evidence: `frontend/src/api/consultas.ts`)
- Shared queries → Typed API client: calls (evidence: `frontend/src/api/consultas.ts`)
- Typed API client → API application: HTTP requests
- API application → Login routes: mounts (evidence: `backend/app/main.py`)
- API application → Household routes: mounts (evidence: `backend/app/main.py`)
- API application → Payments and income: mounts (evidence: `backend/app/main.py`)
- API application → Household setup: mounts (evidence: `backend/app/main.py`)
- API application → Vehicles and fuel: mounts (evidence: `backend/app/main.py`)
- API application → Cards: mounts (evidence: `backend/app/main.py`)
- API application → Reports: mounts (evidence: `backend/app/main.py`)
- API application → Invitations: mounts (evidence: `backend/app/main.py`)
- API application → Audit history: mounts (evidence: `backend/app/main.py`)
- Login routes → Auth service: calls (evidence: `backend/app/routers/auth.py`)
- Login routes → Session and access: uses (evidence: `backend/app/routers/auth.py`)
- Session and access → Auth service: validates sessions (evidence: `backend/app/seguridad.py`)
- Login routes → PostgreSQL: queries (evidence: `backend/app/routers/auth.py`)
- Household routes → Domain models: queries (evidence: `backend/app/routers/hogar.py`)
- Payments and income → Domain models: reads and writes (evidence: `backend/app/routers/pago.py`)
- Payments and income → Session and access: checks permissions (evidence: `backend/app/main.py`)
- Household setup → Domain models: queries
- Vehicles and fuel → Domain models: queries
- Cards → Domain models: queries
- Reports → Domain models: queries (evidence: `backend/app/services/reportes.py`)
- PostgreSQL → Runtime settings: reads settings (evidence: `backend/app/db.py`)
- Invitations → Email templates: renders (evidence: `backend/app/routers/invitacion.py`)
- Invitations → Mail delivery: sends email (evidence: `backend/app/routers/invitacion.py`)
- Email notices → Mail delivery: sends email (evidence: `backend/app/services/avisos.py`)
- Email notices → Email templates: renders (evidence: `backend/app/services/avisos.py`)
- Email notices → Date calculations: calculates dates (evidence: `backend/app/services/avisos.py`)
- Email notices → Runtime settings: reads settings (evidence: `backend/app/services/avisos.py`)
