Skip to main content
Why I Built a Personal Finance Tracker in Vue 3: Reactivity and Local State

Why I Built a Personal Finance Tracker in Vue 3: Reactivity and Local State

November 4, 2024 2 min read Vue.js, Vue 3, Pinia, JavaScript, Finance, Frontend

Why I Built a Personal Finance Tracker in Vue 3: Reactivity and Local State is a Developer Journal article by Ancel Ajanga on https://ancel.co.ke. A deep dive into building a responsive personal finance management tool using Vue 3 Composition API, Pinia state management, and Chart.js for real-time budget forecasting. It focuses on: Personal budgeting applications often suffer from cluttered interfaces, delayed recalculations when updating ledger entries, and over-complicated server sync requirements. Ancel Ajanga…

A deep dive into building a responsive personal finance management tool using Vue 3 Composition API, Pinia state management, and Chart.js for real-time budget forecasting.

Who this is for

Frontend developers evaluating Vue 3 and Pinia for reactive dashboards, data visualization, and predictable client-side financial calculations.

Problem

Personal budgeting applications often suffer from cluttered interfaces, delayed recalculations when updating ledger entries, and over-complicated server sync requirements.

Business outcome

A lightning-fast, reactive personal budgeting dashboard that visualizes expense distributions, monthly spending trajectories, and savings goals in real time.

Metrics

  • Reactive state with the Vue 3 Composition API
  • Modular, typed store architecture using Pinia
  • Spending breakdown charts via Chart.js

Managing personal finances requires instant feedback. When you adjust an expense category or log a recurring subscription, you want to see your monthly projected balance update immediately without waiting for an HTTP roundtrip or a clunky chart animation.

I built this Personal Finance Tracker to explore **Vue 3's Composition API and Pinia**, testing how modern fine-grained reactivity handles complex financial computations directly in the browser.

The Problem: Friction in Personal Budgeting

Most personal finance apps fall into one of two traps: 1. They are bloated SaaS platforms that demand full bank integration, take five seconds to launch, and overwhelm users with enterprise accounting jargon. 2. They are static spreadsheets that lack visual forecasting, require manual formula maintenance, and render poorly on mobile screens.

The sweet spot is a responsive, client-first web dashboard that lets a user log income and expense items, categorize spending, and immediately visualize how their cash flow behaves throughout the month.

Why Vue 3 and Pinia?

While I build extensively with React and Next.js, Vue 3 has distinct architectural advantages for calculation-intensive dashboards:

- **Proxy-Based Fine-Grained Reactivity**: Vue 3's reactivity system tracks property access automatically. When a single expense amount changes in a list of 200 items, only the dependent computed summaries and chart data recalculate. There is no need for manual dependency arrays like React's `useMemo` or `useCallback`. - **Pinia Stores**: Pinia provides a clean, modular state architecture with complete TypeScript support, zero boilerplate, and effortless store composition. - **Single File Components (SFCs)**: Having template, reactive script logic, and scoped styles in a single cohesive unit accelerates iteration on data widgets.

Technical Depth: Reactive Financial Calculations

The core store manages an array of transaction records:

ypescript
export interface Transaction {
  id: string;
  title: string;
  amount: number;
  category: string;
  type: 'INCOME' | 'EXPENSE';
  date: string;
}

Using Vue's `computed`, we derive spending breakdowns and savings metrics reactively:

ypescript
const totalIncome = computed(() => 
  transactions.value
    .filter(t => t.type === 'INCOME')
    .reduce((sum, t) => sum + t.amount, 0)
);

const totalExpenses = computed(() => 
  transactions.value
    .filter(t => t.type === 'EXPENSE')
    .reduce((sum, t) => sum + t.amount, 0)
);

const netSavings = computed(() => totalIncome.value - totalExpenses.value);

const expensesByCategory = computed(() => {
  const map: Record<string, number> = {};
  transactions.value
    .filter(t => t.type === 'EXPENSE')
    .forEach(t => {
      map[t.category] = (map[t.category] || 0) + t.amount;
    });
  return map;
});

Because these computed getters are lazily evaluated and cached based on their reactive dependencies, feeding them into Chart.js instances results in silky-smooth updates without frame drops.

Key Engineering Takeaways

1. **Reactivity Matters for Dashboards**: Fine-grained reactive dependencies make state-heavy UI design straightforward and significantly reduce manual memoization bugs. 2. **Client-Side Calculations Keep Users Focused**: Performing budget calculations locally keeps the UI responsive, so financial tracking feels like a native tool rather than a slow website. 3. **Choose the Right Tool for the Job**: Exploring diverse frontend paradigms strengthens your overall architectural instincts across all frameworks.

Check out the Personal Finance Tracker Project or view my other [frontend and full-stack projects](/projects).

Trade-offs

Chose Vue 3 over React for this specific project to take advantage of its intuitive fine-grained reactivity and concise Single File Component (SFC) architecture; focused on client-side computational speed.

Challenges faced

Managing complex computed properties for dynamic recurring transaction amortization without triggering unnecessary chart re-renders.