# alehbarushka/captain-america architecture

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

- Interactive diagram: https://gitdiagram.com/alehbarushka/captain-america
- Repository: https://github.com/alehbarushka/captain-america

## Overview

This is a browser-based mortgage repayment scheduler. Users edit loan terms and monthly payment status or extras; the app recalculates the schedule and updates its table and card views, while saving schedule state to Firestore when configured. A service worker caches the application shell and serves cached resources when offline. The README is empty, and source excerpts are partial, so the graph omits unverified initialization and calculation details.

Main entry points: [`js/app.js`](https://github.com/alehbarushka/captain-america/blob/master/js/app.js) (Scheduler app), [`sw.js`](https://github.com/alehbarushka/captain-america/blob/master/sw.js) (Service worker), [`index.html`](https://github.com/alehbarushka/captain-america/blob/master/index.html) (App shell files)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_scheduler["Loan scheduler"]
  node_app["Scheduler app<br/>[app.js]"]
  node_calculation["Schedule calculation<br/>[app.js]"]
  node_schedule_views["Schedule views<br/>[app.js]"]
  node_payment_tracking["Payment tracking<br/>[app.js]"]
end

subgraph group_persistence["Cloud persistence"]
  node_firestore_sync["Firestore sync<br/>[app.js]"]
  node_firestore[("Firestore")]
end

subgraph group_offline["Offline support"]
  node_service_worker["Service worker<br/>[sw.js]"]
  node_cache[("Browser cache")]
  node_app_shell["App shell files<br/>[index.html]"]
end

node_user(("User"))

node_user -->|"edits inputs"| node_app
node_app -->|"recalculates schedule"| node_calculation
node_app -->|"renders schedule"| node_schedule_views
node_payment_tracking -->|"triggers recalculation"| node_app
node_payment_tracking -->|"saves changes"| node_firestore_sync
node_firestore_sync -->|"writes schedule"| node_firestore
node_service_worker -->|"stores responses"| node_cache
node_service_worker -->|"precaches shell"| node_app_shell
node_service_worker -->|"serves cached files"| node_cache

click node_app "https://github.com/alehbarushka/captain-america/blob/master/js/app.js"
click node_calculation "https://github.com/alehbarushka/captain-america/blob/master/js/app.js"
click node_schedule_views "https://github.com/alehbarushka/captain-america/blob/master/js/app.js"
click node_payment_tracking "https://github.com/alehbarushka/captain-america/blob/master/js/app.js"
click node_firestore_sync "https://github.com/alehbarushka/captain-america/blob/master/js/app.js"
click node_service_worker "https://github.com/alehbarushka/captain-america/blob/master/sw.js"
click node_app_shell "https://github.com/alehbarushka/captain-america/blob/master/index.html"

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_calculation,node_schedule_views,node_payment_tracking,node_user toneBlue
class node_firestore_sync,node_firestore toneAmber
class node_service_worker,node_cache,node_app_shell toneMint
```

## Components

### Loan scheduler

- [Scheduler app](https://github.com/alehbarushka/captain-america/blob/master/js/app.js): `js/app.js`
- [Schedule calculation](https://github.com/alehbarushka/captain-america/blob/master/js/app.js): `js/app.js`
- [Schedule views](https://github.com/alehbarushka/captain-america/blob/master/js/app.js): `js/app.js`
- [Payment tracking](https://github.com/alehbarushka/captain-america/blob/master/js/app.js): `js/app.js`

### Cloud persistence

- [Firestore sync](https://github.com/alehbarushka/captain-america/blob/master/js/app.js): `js/app.js`
- **Firestore**

### Offline support

- [Service worker](https://github.com/alehbarushka/captain-america/blob/master/sw.js): `sw.js`
- **Browser cache**
- [App shell files](https://github.com/alehbarushka/captain-america/blob/master/index.html): `index.html`

### Other components

- **User**

## Connections

- User → Scheduler app: edits inputs (evidence: `js/app.js`)
- Scheduler app → Schedule calculation: recalculates schedule (evidence: `js/app.js`)
- Scheduler app → Schedule views: renders schedule (evidence: `js/app.js`)
- Payment tracking → Scheduler app: triggers recalculation (evidence: `js/app.js`)
- Payment tracking → Firestore sync: saves changes (evidence: `js/app.js`)
- Firestore sync → Firestore: writes schedule (evidence: `js/app.js`)
- Service worker → Browser cache: stores responses (evidence: `sw.js`)
- Service worker → App shell files: precaches shell (evidence: `sw.js`)
- Service worker → Browser cache: serves cached files (evidence: `sw.js`)
