Skip to content

Repository files navigation

Personal Finance Tracker & Budgeting Suite — Production Documentation

A secure, high-performance, and client-side personal finance manager built with React, Vite, TypeScript, Tailwind CSS, and Firebase. This application provides robust expense auditing, category pacing, interactive budget limits, and complete local/offline persistence.


📖 Table of Contents

  1. Architectural Overview
  2. Core Product Features
  3. Production Directory Structure
  4. Environment Configuration
  5. Local Development Setup
  6. Security Rules & Data Privacy
  7. Production Build & Deployment
  8. CSV Export Utility Architecture

🏗️ Architectural Overview

The application utilizes a highly decoupled, modern SPA (Single Page Application) frontend paired with Firebase Serverless Backends.

┌────────────────────────────────────────────────────────┐
│                      Client-Side                       │
│  [ React / Vite ] ──► [ Local Cache / Multi-Tab Sync ] │
└───────────────────────────┬────────────────────────────┘
                            │ (Secure Channels)
                            ▼
┌────────────────────────────────────────────────────────┐
│                   Firebase Services                    │
│      [ Firestore ]      [ Authentication ]    [ RTDB ] │
└────────────────────────────────────────────────────────┘
  • Runtime & Compilation: Compiled using Vite 5 and TypeScript, producing optimized static chunks.
  • Client-Side State: Driven by native React hooks (useState, useEffect, useMemo) for instant rendering, with transactional boundaries managed via Firebase Firestore listeners.
  • Data Persistence Strategy: Uses Firestore with dynamic local cache enabled (persistentLocalCache and persistentMultipleTabManager), ensuring the application works fully offline and seamlessly synchronizes when network connection is restored.
  • Realtime Database Event Logger: Configured with a dedicated Realtime Database helper for presence tracking and action stream synchronization.

🌟 Core Product Features

1. Robust Authentication & Security

  • Fully implemented authentication flows including Secure Registration, Sign In, and Forgot Password Recovery.
  • Auth state persistence configured globally via the AuthContext React Provider.

2. Live Dashboard & Budget Pacing

  • Dynamic statistics summarizing Net Balances, Total Income, and Total Expenses at a glance.
  • Interactive monthly budget progress bars with real-time feedback (warning banners trigger when exceeding predefined safety targets).
  • Advanced visualizations outlining top spending categories and distribution ratios.

3. Detailed Transaction Ledger

  • Multi-dimensional filtering framework (search by keyword, filter by type, sort by date or amount descending/ascending).
  • Dynamic modal dialogues with automatic input validation and clean touch targets (designed with 44px+ guidelines).

4. CSV Transaction Spreadsheet Exporter

  • Robust local utility that extracts and parses active transaction collections on-the-fly.
  • Translates nested key-value pairs, sanitizes text inputs against CSV injection attacks, and prompts instant, secure downloads.

📁 Production Directory Structure

├── .env.example               # Template documenting required environment variables
├── firestore.rules            # Security criteria securing Firestore reading/writing
├── package.json               # Package declarations and script definitions
├── tsconfig.json              # Compiler options enforcing strict type checking
├── vite.config.ts             # Bundler settings
└── src/
    ├── App.tsx                # Main Application entry point & routing switchboard
    ├── main.tsx               # Orchestrates root element rendering
    ├── index.css              # Global styling importing Tailwind CSS rules
    ├── types.ts               # Rigid, shared TypeScript contracts and interfaces
    ├── components/            # Reusable UI widgets
    │   ├── Layout.tsx         # Responsive navbar, sidebar wrapper and footer
    │   ├── AddTransactionModal.tsx # Form modal handling income/expense entries
    │   └── ui/                # Custom Atomic UI Design tokens
    │       ├── Button.tsx
    │       ├── Card.tsx
    │       ├── Input.tsx
    │       ├── Modal.tsx
    │       ├── Select.tsx
    │       └── Table.tsx
    ├── contexts/              # Global application states
    │   └── AuthContext.tsx    # Firebase authentication context
    ├── lib/                   # Integrations and utilities
    │   ├── firebase.ts        # Direct initialization of Firebase Auth, Firestore, and RTDB
    │   └── rtdbService.ts     # Event tracking and presence syncing protocols
    └── pages/                 # Full screen layout structures
        ├── ForgotPassword.tsx
        ├── Login.tsx
        └── Register.tsx

⚠️ Security Warning: Never commit actual production API keys or credentials to public Git repositories. Ensure .gitignore explicitly filters out .env files.


🚀 Local Development Setup

To initialize, run, and test the workspace locally:

  1. Install Base Dependencies:

    npm install
  2. Run Development Server:

    npm run dev

    The dev server binds to host 0.0.0.0 on port 3000 as required by cloud network mapping overlays.

  3. Validate Code Integrity (Linter):

    npm run lint

    Ensures type safety across all TypeScript modules and verifies imports are correctly declared at the top-level.


🛡️ Security Rules & Data Privacy

To guarantee secure data containment, ensure your Firestore Security Rules (firestore.rules) enforce scoped user validation. No individual can query or write transactions belonging to another UID.

rules_version = '2';
service cloud.firestore {
  match /databases/{database}/documents {
    match /transactions/{transactionId} {
      allow read, write: if request.auth != null && request.auth.uid == resource.data.userId;
      allow create: if request.auth != null && request.auth.uid == request.resource.data.userId;
    }
    match /users/{userId} {
      allow read, write: if request.auth != null && request.auth.uid == userId;
    }
  }
}

📦 Production Build & Deployment

To bundle the application into an optimized static distribution structure ready for enterprise-ready CDNs (Firebase Hosting, Cloud Run, Vercel, or Netlify):

  1. Trigger Compilation:
    npm run build
  2. Review Output: The command executes the Vite compiler which bundles assets, minifies files, and generates index routing files within the ./dist folder.
  3. Containerization: The static folder ./dist can be served by NGINX or static web services inside the production hosting layer.

📊 CSV Export Utility Architecture

The CSV export function is written directly inside /src/App.tsx and works without any external rendering dependencies, reducing production load weights.

Safe Formatting Protocol

  • Automatically wraps fields containing commas, carriage returns, or quotations inside double quotes to protect spreadsheet parsing.
  • Translates database-stored category keys to human-friendly display titles using a static mapper.
  • Dynamically generates and cleans up Blob URLs to prevent browser memory leaks on client machines.

About

The Personal Finance Tracker is a secure, high-performance, and client-side budgeting application built using React, Vite, TypeScript, Tailwind CSS, and Firebase. It provides users with a comprehensive suite of tools to log, track, audit, and analyze their personal financial transactions in real-time.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages