Skip to content

Sagargupta16/ledger-sync

Repository files navigation

Ledger Sync -- Your Personal Finance Dashboard

See where every rupee goes. Import your bank statements, get instant insights, and finally understand your money -- all from a single, self-hosted dashboard you actually own.

No subscriptions. No data harvesting. Just 24 pages of analytics built from your own Excel exports, running on your own infrastructure.

Version License Python React TypeScript

Live: sagargupta.online/ledger-sync | Demo: Try it now | API: ledger-sync-api.vercel.app

Features

Demo Mode

  • Try before you sign up - Click "Try Demo" on the landing page or visit /demo directly
  • Explore the full dashboard with ~500 realistic sample transactions (Indian household model)
  • All 23 pages render with pre-computed analytics data, zero backend calls
  • Floating banner with quick sign-up and exit options
  • Mutations (upload, settings, budgets, goals) are gracefully blocked with toast notifications

Smart Upload & Sync

  • Drag-and-drop Excel (.xlsx, .xls) and CSV uploads with beautiful hero UI
  • Client-side parsing via SheetJS -- files never leave your browser, only structured data is sent to the server
  • Browser-native SHA-256 hashing for intelligent duplicate detection
  • Idempotent syncing -- re-upload anytime without duplicates
  • Four-phase upload UX: Parsing (client) -> Processing (server) -> Uploading -> Computing Analytics
  • Real-time toast notifications for upload status

Spending Analysis

  • 50/30/20 Budget Rule - Track Needs (50%), Wants (30%), and Savings (20%)
  • Category and subcategory breakdown with treemaps
  • Year-over-year spending comparisons
  • Recurring transaction detection

Investment Portfolio

  • 4 Investment Categories: FD/Bonds, Mutual Funds, PPF/EPF, Stocks
  • Track both inflows (investments) and outflows (redemptions)
  • Net investment calculations per category
  • Asset allocation visualization

Cash Flow Visualization

  • Interactive Sankey diagrams showing money flow
  • Income to Expenses/Savings breakdown
  • Monthly and yearly views

Tax & Retirement Planning

  • India FY tax estimation -- old vs new regime comparison, slab breakdown, surcharge, cess
  • Salary-based projections -- input your CTC structure, RSU grants, and growth assumptions to project multi-year tax liability
  • FIRE Calculator -- compute FIRE number, Coast FIRE, years to FIRE, and savings rate from your actual spending data; Lean/Standard/Fat FIRE variants with adjustable SWR, real return, and retirement horizon
  • Retirement corpus calculator -- inflation-adjusted corpus, monthly SIP needed, lump-sum alternative, with projection chart

Analytics & Insights

  • Financial Health Score with 8 metrics across 4 pillars (Spend, Save, Borrow, Plan)
  • Income vs Expense trends and forecasting
  • Net Worth tracking across all accounts
  • Anomaly detection and review
  • Budget tracking and goals

Multi-Currency Display

  • 15 supported currencies -- USD, EUR, GBP, JPY, CAD, AUD, CHF, SGD, AED, and more
  • Live exchange rates from the European Central Bank (via frankfurter.app), cached 24 hours
  • Quick-switch currency from the sidebar or set a default in Settings
  • All amounts convert instantly across every page -- no reload needed
  • Auto-derives number format, symbol, and symbol position from your currency choice

Smart Defaults

  • Account classification - Automatically categorizes accounts by keyword (EPF/PPF/MF/FD/Stocks to Investments, HDFC/SBI/ICICI to Bank Accounts, etc.)
  • Income classification - Auto-assigns Salary/Freelance to Taxable, Dividends/Interest to Investment Returns, Cashbacks to Non-taxable
  • Investment mapping - Auto-maps investment accounts to types (Groww MF to Mutual Funds, PPF Account to PPF/EPF, etc.)

Tech Stack

Layer Technology
Frontend React 19, TypeScript 5.9, Vite 7, Tailwind CSS 4, Recharts 3, Framer Motion 12
Auth OAuth 2.0 (Google, GitHub), JWT tokens (PyJWT)
Backend Python 3.11+, FastAPI, SQLAlchemy 2, Alembic
Database SQLite (dev), Neon PostgreSQL 17 (prod)
State TanStack Query 5, Zustand 5
Deployment GitHub Pages (frontend), Vercel (backend), Neon (database)
CI/CD GitHub Actions (lint, type-check, build, deploy)
Package Mgmt pnpm 10 (frontend), uv (backend)

Architecture

System Overview

System Architecture

Upload & Sync Pipeline

Upload Pipeline

Authentication Flow

Authentication Flow

Backend Layer Architecture

Backend Layers

View Mermaid source (for editing)

Diagrams generated from .mmd files in docs/images/ using:

npx -y @mermaid-js/mermaid-cli -i docs/images/<name>.mmd -o docs/images/<name>.svg -b transparent

For detailed architecture docs, see docs/architecture.md.

Quick Start

# Clone the repository
git clone https://github.com/Sagargupta16/ledger-sync.git
cd ledger-sync

# Install root dependencies
pnpm install

# Setup backend + frontend in parallel
pnpm run setup

# Start both servers
pnpm run dev

Access the app:

Project Structure

ledger-sync/
├── backend/                # Python FastAPI backend
│   ├── src/ledger_sync/    # Main application
│   │   ├── api/            # REST endpoints
│   │   ├── core/           # Business logic (reconciler, sync, analytics)
│   │   ├── db/             # Database models & session
│   │   ├── ingest/         # Excel/CSV processing (CLI path; web uploads parsed client-side)
│   │   └── schemas/        # Pydantic request/response models
│   └── tests/              # pytest tests
├── frontend/               # React + TypeScript frontend
│   └── src/
│       ├── pages/          # 23 page components (split into subdirectories)
│       │   ├── settings/       # Settings sections (21 files, incl. SalaryStructureSection)
│       │   ├── goals/          # Goals sub-components (13 files)
│       │   ├── comparison/     # Comparison sub-components (13 files)
│       │   └── subscription-tracker/  # Subscription sub-components (3 files)
│       ├── components/     # UI & analytics components (60+)
│       ├── hooks/          # React Query hooks & custom hooks
│       ├── constants/      # Colors, chart tokens, animations, column mappings
│       ├── store/          # Zustand global stores
│       ├── services/       # API client (Axios)
│       ├── lib/            # Utility functions (file parser, formatters, tax/projection calculators)
│       │   └── demo/          # Demo mode (data generators, cache seeder)
│       └── types/          # Shared TypeScript types
├── .github/workflows/      # CI pipeline
└── CHANGELOG.md            # Version history

Pages

Page Description
Home Landing page
Dashboard Overview with KPIs, sparklines, and quick insights
Upload & Sync Drag-and-drop upload with sample format preview
Transactions Full transaction list with filters and search
Spending Analysis 50/30/20 rule, treemap, top merchants, subcategories
Income Analysis Income sources, growth tracking, breakdown
Comparison Period-over-period financial comparison
Trends & Forecasts Trend lines, rolling averages, cash flow forecast
Cash Flow Sankey diagram of money flow
Investment Analytics Portfolio across 4 categories
Mutual Fund Projection SIP calculator and projections
Returns Analysis Investment returns tracking
Tax Planning India FY tax estimation with salary-based projections
Indirect Tax (GST) GST estimation by slab rate, monthly trends, category breakdown
FIRE Calculator FIRE number, Coast FIRE, retirement corpus planner
Net Worth Assets, liabilities, and credit card health
Budget Budget tracking and monitoring
Goals Financial goal setting and progress
Insights Advanced analytics (velocity, stability, milestones)
Anomaly Review Flag and review unusual transactions
Year in Review Annual financial summary
Subscription Tracker Recurring expense detection, confirm/add manually
Bill Calendar Monthly calendar view of upcoming bills
Settings Preferences, account mappings, categories

Deployment

The app is deployed for free using three services:

Service Platform Details
Frontend GitHub Pages Auto-deploys on push via GitHub Actions
Backend Vercel (serverless) FastAPI via Mangum adapter, zero cold starts
Database Neon PostgreSQL Free tier, 0.5 GB, Singapore region (Vercel integration)

See Deployment Guide for full setup instructions.

Authentication

Ledger Sync uses OAuth 2.0 for authentication - no passwords to manage.

  • Google Sign-In and GitHub Sign-In buttons on the login page
  • Backend exchanges OAuth codes for user info, then issues JWT tokens
  • OAuth providers are configurable via environment variables
  • Buttons only appear for providers that are configured

Setting Up OAuth (Local Dev)

  1. Create OAuth apps at Google Cloud Console and/or GitHub Developer Settings
  2. Set redirect URIs to http://localhost:5173/auth/callback/google and http://localhost:5173/auth/callback/github
  3. Add credentials to backend/.env:
LEDGER_SYNC_GOOGLE_CLIENT_ID=your-google-client-id
LEDGER_SYNC_GOOGLE_CLIENT_SECRET=your-google-secret
LEDGER_SYNC_GITHUB_CLIENT_ID=your-github-client-id
LEDGER_SYNC_GITHUB_CLIENT_SECRET=your-github-secret
LEDGER_SYNC_FRONTEND_URL=http://localhost:5173

Configuration

Backend Environment (backend/.env)

LEDGER_SYNC_DATABASE_URL=sqlite:///./ledger_sync.db    # Local dev (SQLite)
LEDGER_SYNC_ENVIRONMENT=development                     # development | production
LEDGER_SYNC_GOOGLE_CLIENT_ID=...                        # OAuth (optional)
LEDGER_SYNC_GOOGLE_CLIENT_SECRET=...
LEDGER_SYNC_GITHUB_CLIENT_ID=...
LEDGER_SYNC_GITHUB_CLIENT_SECRET=...
LEDGER_SYNC_FRONTEND_URL=http://localhost:5173          # OAuth redirect base URL

Frontend Environment

VITE_API_BASE_URL=http://localhost:8000                # Set in GitHub Actions variable for production

Documentation

Contributing

Contributions are welcome! Please read the Development Guide first.

License

MIT License - see LICENSE for details.

About

Personal finance dashboard -- turn messy Excel bank statements into 23 pages of beautiful analytics. Self-hosted, multi-currency, zero subscriptions.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors