Skip to content

About

Privacy-minded, mobile-first debt tracker that syncs with Firebase. Manage cards, visualize utilization, and optimize balance transfers.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

74 Commits

Folders and files

Repository files navigation

Personal Debt Tracker

Track estimated credit-card balances from limit and available credit, inspect balance history and Progress charts, compare hypothetical interest costs, simulate payoff timelines, and plan 0% balance transfers — in a clean, mobile-first web app where your data is end-to-end encrypted in the browser before it ever reaches Firestore.

A lightweight, privacy-first planner to manage credit cards, visualize utilization, and optimize payoff. No bank linking, no tracking, no ads.

Firebase Tailwind E2EE PWA GitHub Pages

Live demo

⚠️ Disclaimer: For educational purposes. Not financial advice.


✨ Features

🔒 Privacy & security

  • Lock Mode — client-side end-to-end encryption. Card data is encrypted in your browser with an AES-GCM key derived from your passphrase (PBKDF2). Only ciphertext is ever stored in Firestore — unreadable even by the project owner without your passphrase.
  • Zero-knowledge, per-session unlock. The key lives in memory only and is cleared on sign-out/refresh; the passphrase is never sent anywhere. No bank linking, no tracking, no ads.

💳 Accounts

  • Google sign-in + Firestore sync (offline-first via IndexedDB).
  • Inline edit in place (row expands to full-width inputs; Enter to save, Esc to cancel) with field-level validation.
  • Quick ±$50 balance adjustments on each card, with encrypted history.
  • Available-credit entry: estimated balance is limit minus available credit; direct entry remains available for legacy and over-limit exceptions.
  • Dated history and corrections, archive/restore, issuer status, and freshness filters.
  • Search / filter accounts by name; undo delete (8-second toast).
  • Sort by Name / APR / Balance / Utilization / Monthly Interest / Monthly Interest per $100 (preference persisted).

📊 Insight & visuals

  • KPI tiles: Total Debt, Total Credit, Monthly Interest, and a prominent Yearly Interest (Est.) figure, plus an overall utilization bar.
  • Per-card utilization as bar or donut (toggle), risk badges (Healthy / Watch / Medium / High), and 0% APR chips.
  • Utilization targets: per-card payment amounts below the progress bar, with customizable planning targets. Each saved target also creates an overall utilization/payment KPI. These are not promised credit-score breakpoints.
  • Progress page: overall/per-account balance trends, comparison KPIs, milestones, accessible observation tables, and utilization/limit charts.
  • Manual statement/promotion references: dates, optional payment/transfer records, and in-app reminders. No minimum-payment tracking or exact interest-start claims.

🧮 Planning tools

  • Payoff strategies: Debt Avalanche (highest APR) and Debt Snowball (lowest balance), alongside an estimated monthly interest ranking by account.
  • Payoff Plan: compare Avalanche and Snowball side by side using one combined monthly budget, or estimate the monthly amount needed for a target number of months. Optional per-account baseline payments are planning inputs, not bank minimums. See projected interest, total paid, first payoff, timelines and charts. Each strategy includes a monthly per-account payment plan with month 1 expanded, baseline/priority allocations, estimated interest and remaining balances, and a CSV download. Zero baselines require review before displaying predictions.
  • Balance-Transfer Optimizer: pick a 0% target card, optionally cap its utilization, and get a move list with monthly + intro-period net savings vs. fees.

🧰 Quality of life

  • Three views: Accounts for current balances, Payoff Plan for hypothetical outcomes, and Progress for recorded history. Import/export live in Settings & data.
  • Dark mode (persisted, no flash of wrong theme).
  • Import legacy CSV/JSON and full backups; Export snapshot/history CSV or full JSON backups retaining account IDs, history, and settings.
  • PWA: installable, offline-friendly (network-first service worker; Firestore queues writes offline and syncs when back online).
  • Accessibility: keyboard support, focus rings, ARIA labels, aria-live announcements, accessible modal (focus trap + Escape/backdrop close), and redundant text labels alongside color-coded chips.
  • Mobile-first responsive layout with a floating add-account button.

🧱 Tech Stack

  • Frontend: HTML + vanilla JS (ES modules) + compiled TailwindCSS (static styles.css, no runtime CDN).
  • Encryption: Web Crypto API — AES-GCM-256 + PBKDF2 (SHA-256).
  • State/Sync: Firebase Auth + Firestore (with IndexedDB persistence).
  • PWA: service worker (network-first) + web manifest.
  • CI/CD: GitHub Actions → GitHub Pages (served via Cloudflare at pdt.avijitroy.com).
  • Secrets: injected at build time via Actions — no keys committed.

📦 Data Model

artifacts/{projectId}/users/{uid}/cards/{cardId}
artifacts/{projectId}/users/{uid}/cards/{cardId}/events/{revision}
artifacts/{projectId}/users/{uid}/cards/{cardId}/restored/{eventId}

New encrypted account snapshots:

{ "v": 2, "iv": "<base64>", "data": "<base64-ciphertext>", "revision": "<id>", "purging": false }

Legacy {v:1,iv,data} snapshots remain readable. New writes pair a version-2 snapshot with an immutable encrypted event. Financial fields remain encrypted; revision/purge flags, record counts, and update-order identifiers are operational metadata. Malformed or unsupported records produce an incomplete-data warning.

Per-user crypto metadata:

artifacts/{projectId}/users/{uid}/meta/crypto
{ "v": 1, "salt": "<base64>", "verifier": { "iv": "<base64>", "data": "<base64>" } }
  • The salt (non-secret) derives the key via PBKDF2; the verifier is an encrypted known token used to detect a wrong passphrase on unlock.
  • Decrypted card fields (name, balance, apr, creditLimit) exist only in memory; all derived metrics (utilization, interest, per-$100 cost) are computed client-side.

🔐 Lock Mode (client-side E2EE)

Goal: data is encrypted in the browser before hitting Firestore, so even project admins / server backups cannot read card details.

  • Key derivation: AES-GCM-256 key from your passphrase + a per-user random salt via PBKDF2 (SHA-256, 210k iterations).
  • Session model: unlock once per session; key held in memory, cleared on sign-out/refresh.
  • First run: set a passphrase (with an unrecoverable-if-lost warning). Returning: enter your passphrase to unlock.
  • Encrypt-everything-by-default — every card is stored as ciphertext.

Threat model

  • ✅ Protects against server-side reads (console, backups) and cross-user access.
  • ❌ Does not protect a device compromised while unlocked.
  • ⚠️ No recovery if the passphrase is lost — export a JSON backup as your safety net.

🛠️ Getting Started (Local)

  1. Firebase Console

    • Create a web app and enable the Google auth provider.
    • Auth → Authorized domains: add localhost and 127.0.0.1.
    • Firestore → publish the rules from firestore.rules.
  2. Create env.js locally (ignored by git):

    // env.js (local only; NOT committed)
    window.__FIREBASE_CONFIG = {
      apiKey: "…",
      authDomain: "your-project.firebaseapp.com",
      projectId: "your-project",
      storageBucket: "your-project.firebasestorage.app",
      messagingSenderId: "…",
      appId: "…",
      measurementId: "G-…"
    };
  3. Serve over HTTP (not file://, so ES modules + the service worker work):

    npm start

Rebuilding the CSS

Tailwind is precompiled to a static styles.css (committed to the repo). Rebuild it whenever you change markup or class names in index.html / app.js:

npm run build:css

The content scanner reads index.html, app.js, and runtime modules in src/, so any class used there is included. (The old Tailwind Play CDN was removed — it isn't production-grade and broke behind Cloudflare Rocket Loader.)

Development checks

Use Node.js 22 or newer. Install local development tools once:

npm.cmd ci
npm.cmd test
npm.cmd run check

On macOS/Linux, use npm test and npm run check (not run on those platforms). The tests cover money calculations, account-schema compatibility, AES-GCM round-trips/tamper rejection, session boundaries, and public-asset caching. They do not replace authenticated browser or Firestore security-rule tests.

Run npm.cmd run test:rules with Java 21+ available to verify owner isolation, atomic snapshot/history writes, stale revisions, immutable history, and purge permissions against the local demo Firestore emulator. This never deploys rules.

The next implementation stages are tracked in implementation-plan.md. Available-credit forms, encrypted history, and Progress page are implemented on the feature branch. Production rollout still requires the compatible rules and application deployment.


🔐 Security Rules

The authoritative rules live in firestore.rules (version controlled). They enforce owner-only access (request.auth.uid == uid) across each user's subtree and strictly validate the encrypted card envelope and the meta/crypto doc (exact keys, types, and size bounds); everything else — including any other /meta doc or the user container doc — is denied by default.

Deploy: Firebase Console → Firestore → Rules → paste firestore.rules → Publish (or firebase deploy --only firestore:rules with the Firebase CLI).


🌐 Deploying to GitHub Pages (no keys in repo)

Why: keeps config out of version control.

  1. Add GitHub Actions secrets (repo → Settings → Secrets and variables → Actions):

    FIREBASE_API_KEY
    FIREBASE_AUTH_DOMAIN
    FIREBASE_PROJECT_ID
    FIREBASE_STORAGE_BUCKET
    FIREBASE_MESSAGING_SENDER_ID
    FIREBASE_APP_ID
    FIREBASE_MEASUREMENT_ID
    
  2. env.js is gitignored and generated at build time by .github/workflows/static.yml, which rsyncs the repo into dist/, writes dist/env.js from the secrets, and deploys to Pages.

  3. Settings → Pages → build with GitHub Actions.

styles.css is committed, so no build step runs in CI — the workflow just copies files. Rebuild the CSS locally (see above) and commit it when needed.


🔄 Switching Firebase Projects

To repoint the app at a new Firebase project (e.g. a different owner account):

  1. Export JSON from the current app (your migration payload / backup).
  2. Create the new project → add a Web app → enable Google auth → create Firestore → publish firestore.rules → add authorized domains (localhost, 127.0.0.1, pdt.avijitroy.com).
  3. Update config: local env.js and the GitHub Actions secrets above.
  4. Sign in with the account you'll use going forward, set your Lock Mode passphrase, then Import the JSON.
  5. Verify, then decommission the old project.

Test locally against the new project before updating the production secrets.


🧭 Usage Notes

  • Sort by Name / APR / Balance / Utilization / Monthly Interest / Monthly Interest per $100 (persisted).
  • Utilization View: switch Bar ↔ Donut in the controls.
  • Inline edit: click ✏️ → fields expand; Enter saves, Esc cancels.
  • Quick pay: ±$50 buttons for fast balance updates; Undo delete toast.
  • Payoff Plan: compare Avalanche and Snowball using one combined monthly budget, or estimate each strategy's budget for a target number of months. Optional planned baseline payments are simulation inputs, not bank minimums.
  • Optimizer: pick the 0% target card, optionally cap its utilization → move list + net savings (intro vs. fees).
  • Import/Export: CSV or JSON from the header's Settings & data menu.

📱 PWA & Offline

  • Installable; works offline for most flows. The service worker is network-first (always serves the latest deploy, falls back to cache offline), and Firestore queues writes offline and syncs when reconnected.
  • To reset cache (dev): DevTools → Application → Clear storage, then hard-reload.

🧭 Roadmap

See project-plan.md for the full phased plan and project-status.md for a dated change log.

  • Lock Mode (client-side E2EE)
  • Payoff schedule simulator
  • CSV / JSON import
  • Dark mode
  • Guest / local-only mode (try before sign-in)
  • Firebase App Check (reCAPTCHA v3)
  • Multi-currency support
  • Automated calculation/crypto/session tests and CI gates

For the current tracking implementation and rollout requirements, see implementation-plan.md and docs/tracking-release.md.


🧩 Troubleshooting

  • Google popup blocked — falls back to redirect; ensure Authorized domains includes localhost / 127.0.0.1.
  • Nothing happens — check that env.js loads before app.js (Network tab).
  • Forgot passphrase — data is unrecoverable by design; re-import a JSON backup, or reset by deleting the meta/crypto doc and your cards.
  • "Permission denied" — recheck the deployed Firestore rules.
  • Stale UI — the network-first SW self-heals on reload; if needed, clear storage and hard-reload.

📄 License

MIT


Built with ❤️ by Avijit Roy. Questions or ideas? Open an issue.

About

Privacy-minded, mobile-first debt tracker that syncs with Firebase. Manage cards, visualize utilization, and optimize balance transfers.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages