Skip to content

dfsf5263/finance-tracker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

134 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Finance Tracker

A self-hosted personal finance application for tracking transactions, analyzing spending, and managing household budgets. Own your financial data.

CI CodeQL Semgrep Trivy Coverage License GHCR

Deploy to Render Β Β  Deploy on Railway
One-click managed hosting β€” try for free, no credit card required. Learn more ↓

Next.js React TypeScript PostgreSQL Prisma Tailwind CSS shadcn/ui Better Auth Zod Vitest Playwright

Finance Tracker Dashboard

πŸ“Έ Screenshots
Analytics Breakdown Money Flow
Analytics Breakdown Money Flow
Transaction Management CSV Upload
Transaction Management CSV Upload
Household Budget User Budget
Household Budget User Budget

Why Self-Host?

Your financial data is some of the most sensitive information you have. Finance Tracker is designed to run on your own hardware β€” a home server, a VPS, or anywhere you choose β€” so your transaction history, budgets, and spending patterns never leave your control. No third-party accounts, no data harvesting, no subscriptions. Just a Docker image you can deploy in minutes.

Managed Hosting

Prefer not to manage your own server? Deploy to a fully managed host with automatic updates, SSL, and a built-in PostgreSQL database β€” no server setup required.

Deploy to Render Β Β  Deploy on Railway

Render β€” free tier, no credit card required. Provisions the app and PostgreSQL automatically from render.yaml. The app will auto-update whenever a new version is released.

Warning

Render's free PostgreSQL instances are wiped after 90 days. To retain your data permanently, upgrade the database to the Starter plan ($7/month) in your Render dashboard under the database's Settings β†’ Plan.

Railway β€” usage-based pricing (~$5–10/month). Persistent data with no expiry. Provisions the app and PostgreSQL automatically.

See DOCKER_DEPLOYMENT.md for self-hosted VPS options.

Features

  • 🏠 Multi-Household Support β€” Manage multiple households with role-based member access and invitations
  • πŸ’° Transaction Management β€” Track income, expenses, and transfers with detailed categorization
  • πŸ“Š Analytics & Reporting β€” Visual category breakdowns, Sankey money-flow diagrams, and spending insights
  • πŸ’Έ Budget Management β€” Set and track budgets per household and per user with overage alerts
  • πŸ“ˆ CSV Import/Export β€” Bulk transaction upload with intelligent duplicate detection and deduplication tools
  • πŸ” Authentication & Security β€” Email/password auth with 2FA, email verification, rate limiting, and input validation
  • 🎯 Smart Definitions β€” Customizable accounts, categories, transaction types, and users
  • πŸ“± Responsive UI β€” Clean dashboard with dark/light theme support built on shadcn/ui
  • πŸ“§ Email Notifications β€” Weekly spending summaries and transactional emails via Resend

Tech Stack

Frontend β€” Next.js 15 (App Router), React 19, TypeScript, Tailwind CSS v4, shadcn/ui, Recharts, D3

Backend β€” Next.js API Routes, Prisma ORM 7, PostgreSQL 17, Zod validation

Auth β€” Better Auth (email/password, 2FA, email verification, sessions)

Email β€” Resend for transactional emails and weekly summaries

Testing β€” Vitest + React Testing Library (unit), Playwright (E2E)

DevOps β€” GitHub Actions CI/CD, Docker (GHCR), Biome (formatter/linter)

Getting Started

Prerequisites

  • Node.js 24+ and npm
  • PostgreSQL 12+ (or use Docker)

Quick Start with Docker Compose

The fastest way to run Finance Tracker. Includes PostgreSQL β€” no external database needed.

cp .env.docker .env
# Edit .env with your secrets and email config

docker compose up -d

Open http://localhost:3000 to use the app. Database migrations run automatically on first startup.

πŸ“– Full deployment guide: Docker Deployment Guide

Local Development

  1. Clone and install:

    git clone https://github.com/dfsf5263/finance-tracker.git
    cd finance-tracker
    npm install
  2. Configure environment:

    cp .env.example .env.local
    # Edit .env.local with your database URL and secrets
  3. Set up the database:

    npx prisma migrate dev
    npx prisma db seed
  4. Start the dev server:

    npm run dev

    Open http://localhost:3000.

Environment Variables

Variable Required Description
DATABASE_URL βœ… PostgreSQL connection string
BETTER_AUTH_SECRET βœ… Session signing secret (32+ characters)
APP_URL βœ… Application URL for auth callbacks and emails
RESEND_API_KEY Resend API key β€” required for email features (verification, weekly summaries)
RESEND_FROM_EMAIL Sender email address β€” required if RESEND_API_KEY is set
RESEND_REPLY_TO_EMAIL Reply-to email for support
SKIP_MIGRATIONS Set to true to skip auto-migration on Docker startup
ENABLE_SEEDING Set to true to seed default data on Docker startup

See .env.example for a complete template.

Testing

Finance Tracker has a comprehensive 3-tier testing strategy:

Unit Tests

npm run test              # Run unit tests
npm run test:watch        # Watch mode
npm run test:coverage     # Run with coverage report

Powered by Vitest with React Testing Library and vitest-mock-extended.

End-to-End Tests

# Start the E2E database
npm run db:e2e:up

# Reset and seed the E2E database
npm run db:e2e:reset

# Run E2E tests
npm run test:e2e

# Run with browser UI
npm run test:e2e:ui

# Shut down the E2E database
npm run db:e2e:down

Powered by Playwright running Chromium against a real PostgreSQL database.

CI/CD Pipeline

The project uses GitHub Actions with two workflows:

CI (ci.yml) β€” Runs on every push and pull request to main:

  1. Lint, Format & Typecheck β€” npm run check (Biome + TypeScript)
  2. Unit Tests β€” npm run test (runs in parallel with step 1)
  3. E2E Tests β€” Playwright against a PostgreSQL service container (runs after steps 1 & 2 pass)

Release (release.yml) β€” Builds multi-arch Docker images (amd64 + arm64) and pushes to GitHub Container Registry:

  • Push to main β†’ nightly build: :nightly, :nightly-YYYYMMDD, :nightly-sha-<commit>
  • Tag push (v*) β†’ stable release: :latest, :<version>, :sha-<commit> + GitHub Release with auto-generated notes
  • Version tags are immutable β€” the build fails if the version already exists in GHCR

See Releasing for the full release process.

Project Structure

src/
β”œβ”€β”€ app/
β”‚   β”œβ”€β”€ (auth)/              # Auth pages (sign-in, sign-up, forgot-password, 2FA)
β”‚   β”œβ”€β”€ api/                 # API routes (transactions, budgets, analytics, auth)
β”‚   └── dashboard/
β”‚       β”œβ”€β”€ analytics/       # Breakdown charts, Sankey money-flow
β”‚       β”œβ”€β”€ transactions/    # Manage & CSV upload
β”‚       β”œβ”€β”€ budgeting/       # Household & user budgets
β”‚       β”œβ”€β”€ definitions/     # Accounts, categories, types, users, households
β”‚       β”œβ”€β”€ settings/        # Profile, security, household, email subscriptions
β”‚       └── utility/         # Duplicate detection & deduplication
β”œβ”€β”€ components/              # Reusable React components + shadcn/ui
β”œβ”€β”€ contexts/                # React contexts (household multi-tenancy)
β”œβ”€β”€ hooks/                   # Custom hooks (CRUD, active month, entity counts)
β”œβ”€β”€ lib/                     # Business logic, validation, auth, analytics, email
└── types/                   # TypeScript type definitions
prisma/
β”œβ”€β”€ schema.prisma            # Database schema
β”œβ”€β”€ seed.ts                  # Database seeding script
└── migrations/              # Prisma migrations
tests/
└── e2e/                     # Playwright E2E test specs

Deployment

Docker (Self-Hosted)

Multi-arch images (amd64 + arm64) are published to GitHub Container Registry:

docker pull ghcr.io/dfsf5263/finance-tracker:latest

The container automatically runs database migrations on startup (skip with SKIP_MIGRATIONS=true).

See the Docker Deployment Guide for Docker Compose quick deploy, reverse proxy setup, monitoring, backups, and troubleshooting.

Development Commands

npm run dev              # Start dev server (Turbopack)
npm run build            # Production build
npm run check            # Lint + format check + typecheck
npm run format           # Format with Biome
npm run test             # Unit tests
npm run test:e2e         # E2E tests
npx prisma studio        # Database GUI
npx prisma migrate dev   # Create a new migration

Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Make your changes
  4. Run checks: npm run format && npm run check
  5. Commit and push
  6. Open a Pull Request

License

This project is licensed under the MIT License β€” see the LICENSE file for details.

About

Personal finance tracker

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages