# shadowfiend2504/consumo-servicios-pwa architecture

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

- Interactive diagram: https://gitdiagram.com/shadowfiend2504/consumo-servicios-pwa
- Repository: https://github.com/shadowfiend2504/consumo-servicios-pwa

## Overview

Control de Consumo del Hogar is a PWA for recording household utility bills and monitoring consumption. Users authenticate, enter and manage bills, then review dashboards, period-based analysis and alerts; reports can be exported as CSV or Excel. The app also offers account recovery and offline PWA behavior. The sampled source confirms authentication, dashboard and data-layer behavior; other features are represented from the README, so their internal links are limited to documented relationships.

Main entry points: [`js/firebase-data.js`](https://github.com/shadowfiend2504/consumo-servicios-pwa/blob/main/js/firebase-data.js) (Data service), [`js/auth.js`](https://github.com/shadowfiend2504/consumo-servicios-pwa/blob/main/js/auth.js) (Authentication), [`index.html`](https://github.com/shadowfiend2504/consumo-servicios-pwa/blob/main/index.html) (Web app), [`js/app.js`](https://github.com/shadowfiend2504/consumo-servicios-pwa/blob/main/js/app.js) (Consumption dashboard)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_accounts["Accounts"]
  node_auth["Authentication<br/>[auth.js]"]
  node_recovery["Password recovery"]
  node_reset["Password reset<br/>[reset-password.js]"]
  node_firebase_config["Firebase setup<br/>[firebase-config.js]"]
end

subgraph group_consumption["Consumption"]
  node_app["Web app<br/>[index.html]"]
  node_dashboard["Consumption dashboard<br/>[app.js]"]
  node_bills["Bills and readings<br/>[app.js]"]
  node_profile["Service profile<br/>[app.js]"]
end

subgraph group_insights["Insights"]
  node_analysis["Consumption analysis<br/>[app.js]"]
  node_alerts["Alerts and tracking<br/>[app.js]"]
  node_reports["Report exports<br/>[app.js]"]
end

subgraph group_platform["Data and PWA"]
  node_data_service["Data service<br/>[firebase-data.js]"]
  node_local_store[("Browser storage")]
  node_firestore[("Cloud data")]
  node_pwa["Offline runtime<br/>[sw.js]"]
  node_cache[("Asset cache")]
  node_manifest["Install metadata<br/>[manifest.json]"]
end

node_user(("Household user"))
node_firebase_auth["Firebase Auth"]

node_user -->|"opens"| node_app
node_app -->|"authenticates"| node_auth
node_auth -->|"signs in"| node_firebase_auth
node_firebase_config -->|"initializes"| node_firebase_auth
node_auth -->|"syncs account data"| node_data_service
node_auth -->|"shows dashboard"| node_dashboard
node_user -->|"requests recovery"| node_recovery
node_user -->|"sets password"| node_reset
node_user -->|"records bills"| node_bills
node_user -->|"sets services"| node_profile
node_dashboard -->|"loads records"| node_data_service
node_bills -->|"manages bills"| node_data_service
node_profile -->|"reads and saves"| node_data_service
node_user -->|"reviews trends"| node_analysis
node_user -->|"reviews alerts"| node_alerts
node_user -->|"exports reports"| node_reports
node_analysis -.->|"uses bill data"| node_data_service
node_alerts -->|"reads and updates"| node_data_service
node_reports -.->|"uses bill data"| node_data_service
node_data_service -->|"reads and writes"| node_local_store
node_data_service -->|"syncs records"| node_firestore
node_user -->|"uses offline app"| node_pwa
node_pwa -->|"caches assets"| node_cache
node_user -->|"installs app"| node_manifest

click node_app "https://github.com/shadowfiend2504/consumo-servicios-pwa/blob/main/index.html"
click node_auth "https://github.com/shadowfiend2504/consumo-servicios-pwa/blob/main/js/auth.js"
click node_recovery "https://github.com/shadowfiend2504/consumo-servicios-pwa/blob/main/js/recover-password.js"
click node_reset "https://github.com/shadowfiend2504/consumo-servicios-pwa/blob/main/js/reset-password.js"
click node_firebase_config "https://github.com/shadowfiend2504/consumo-servicios-pwa/blob/main/js/firebase-config.js"
click node_dashboard "https://github.com/shadowfiend2504/consumo-servicios-pwa/blob/main/js/app.js"
click node_bills "https://github.com/shadowfiend2504/consumo-servicios-pwa/blob/main/js/app.js"
click node_profile "https://github.com/shadowfiend2504/consumo-servicios-pwa/blob/main/js/app.js"
click node_analysis "https://github.com/shadowfiend2504/consumo-servicios-pwa/blob/main/js/app.js"
click node_alerts "https://github.com/shadowfiend2504/consumo-servicios-pwa/blob/main/js/app.js"
click node_reports "https://github.com/shadowfiend2504/consumo-servicios-pwa/blob/main/js/app.js"
click node_data_service "https://github.com/shadowfiend2504/consumo-servicios-pwa/blob/main/js/firebase-data.js"
click node_pwa "https://github.com/shadowfiend2504/consumo-servicios-pwa/blob/main/sw.js"
click node_manifest "https://github.com/shadowfiend2504/consumo-servicios-pwa/blob/main/manifest.json"

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,node_recovery,node_reset,node_firebase_config,node_user toneBlue
class node_app,node_dashboard,node_bills,node_profile toneAmber
class node_analysis,node_alerts,node_reports toneMint
class node_data_service,node_local_store,node_firestore,node_pwa,node_cache,node_manifest toneRose
class node_firebase_auth toneIndigo
```

## Components

### Accounts

- [Authentication](https://github.com/shadowfiend2504/consumo-servicios-pwa/blob/main/js/auth.js): `js/auth.js`
- [Password recovery](https://github.com/shadowfiend2504/consumo-servicios-pwa/blob/main/js/recover-password.js): `js/recover-password.js`
- [Password reset](https://github.com/shadowfiend2504/consumo-servicios-pwa/blob/main/js/reset-password.js): `js/reset-password.js`
- [Firebase setup](https://github.com/shadowfiend2504/consumo-servicios-pwa/blob/main/js/firebase-config.js): `js/firebase-config.js`

### Consumption

- [Web app](https://github.com/shadowfiend2504/consumo-servicios-pwa/blob/main/index.html): `index.html`
- [Consumption dashboard](https://github.com/shadowfiend2504/consumo-servicios-pwa/blob/main/js/app.js): `js/app.js`
- [Bills and readings](https://github.com/shadowfiend2504/consumo-servicios-pwa/blob/main/js/app.js): `js/app.js`
- [Service profile](https://github.com/shadowfiend2504/consumo-servicios-pwa/blob/main/js/app.js): `js/app.js`

### Insights

- [Consumption analysis](https://github.com/shadowfiend2504/consumo-servicios-pwa/blob/main/js/app.js): `js/app.js`
- [Alerts and tracking](https://github.com/shadowfiend2504/consumo-servicios-pwa/blob/main/js/app.js): `js/app.js`
- [Report exports](https://github.com/shadowfiend2504/consumo-servicios-pwa/blob/main/js/app.js): `js/app.js`

### Data and PWA

- [Data service](https://github.com/shadowfiend2504/consumo-servicios-pwa/blob/main/js/firebase-data.js): `js/firebase-data.js`
- **Browser storage**
- **Cloud data**
- [Offline runtime](https://github.com/shadowfiend2504/consumo-servicios-pwa/blob/main/sw.js): `sw.js`
- **Asset cache**
- [Install metadata](https://github.com/shadowfiend2504/consumo-servicios-pwa/blob/main/manifest.json): `manifest.json`

### Other components

- **Household user**
- **Firebase Auth**

## Connections

- Household user → Web app: opens (evidence: `README.md`)
- Web app → Authentication: authenticates (evidence: `README.md`)
- Authentication → Firebase Auth: signs in (evidence: `js/auth.js`)
- Firebase setup → Firebase Auth: initializes (evidence: `js/firebase-config.js`)
- Authentication → Data service: syncs account data (evidence: `js/auth.js`)
- Authentication → Consumption dashboard: shows dashboard (evidence: `js/auth.js`)
- Household user → Password recovery: requests recovery (evidence: `README.md`)
- Household user → Password reset: sets password (evidence: `README.md`)
- Household user → Bills and readings: records bills (evidence: `README.md`)
- Household user → Service profile: sets services (evidence: `README.md`)
- Consumption dashboard → Data service: loads records (evidence: `js/app.js`)
- Bills and readings → Data service: manages bills (evidence: `js/app.js`)
- Service profile → Data service: reads and saves (evidence: `js/app.js`)
- Household user → Consumption analysis: reviews trends (evidence: `README.md`)
- Household user → Alerts and tracking: reviews alerts (evidence: `README.md`)
- Household user → Report exports: exports reports (evidence: `README.md`)
- Consumption analysis → Data service: uses bill data
- Alerts and tracking → Data service: reads and updates (evidence: `js/app.js`)
- Report exports → Data service: uses bill data
- Data service → Browser storage: reads and writes (evidence: `js/firebase-data.js`)
- Data service → Cloud data: syncs records (evidence: `js/firebase-data.js`)
- Household user → Offline runtime: uses offline app (evidence: `README.md`)
- Offline runtime → Asset cache: caches assets (evidence: `sw.js`)
- Household user → Install metadata: installs app (evidence: `README.md`)
