Skip to content

kaiserxvii/kainance

Repository files navigation

Kainance

A personal finance management app built with Next.js. Track your net worth, plan monthly budgets, and get AI-powered financial guidance—all with your data stored locally in your browser.

Note: This is a personal project I put together for fun. It's not intended for serious financial planning or production use.

Features

  • Net Worth Tracking - Monitor all your accounts (bank accounts, investments, credit cards, loans) in one place with automatic net worth calculations
  • Budget Planning - Create monthly budgets with income, bills, debt payments, and savings goals. Track expected vs actual amounts
  • Historical Snapshots - Save monthly snapshots to track your financial progress over time
  • Budget Trends - Visualize how your income, expenses, and savings change month-over-month
  • AI Advisor - Get personalized financial guidance based on your budget and net worth data (requires OpenAI API key)
  • Privacy-First - All data is stored locally in your browser using IndexedDB. Nothing is sent to external servers except AI chat messages

Tech Stack

Getting Started

Prerequisites

  • Node.js 18+ or Bun
  • OpenAI API key (optional, for AI Advisor feature)

Installation

  1. Clone the repository:

    git clone https://github.com/yourusername/kainance.git
    cd kainance
  2. Install dependencies:

    npm install
    # or
    bun install
  3. Create a .env.local file for the AI Advisor (optional):

    OPENAI_API_KEY=your_api_key_here
  4. Start the development server:

    npm run dev
    # or
    bun dev
  5. Open http://localhost:3000 in your browser

Project Structure

kainance/
├── app/                    # Next.js App Router pages
│   ├── accounts/           # Account management pages
│   ├── ai/                 # AI Advisor page
│   ├── api/                # API routes
│   ├── budget/             # Budget planner page
│   └── ...
├── components/
│   ├── budget/             # Budget-related components
│   └── ui/                 # Reusable UI components
├── lib/
│   ├── db/                 # Database configuration (Dexie)
│   ├── hooks/              # React hooks
│   ├── types/              # TypeScript types and constants
│   └── utils/              # Utility functions
└── ...

Key Concepts

Amounts in Cents

All monetary amounts are stored as integers in cents to avoid floating-point precision issues. Use the formatting utilities to display amounts:

import { formatCurrency } from '@/lib/utils/format';

formatCurrency(150000); // "$1,500.00"

Month Keys

Months are identified by keys in "YYYY-MM" format (e.g., "2025-01"). Use the month key utilities:

import { getMonthKey, formatMonthLabel } from '@/lib/utils/month-key';

getMonthKey(new Date()); // "2025-01"
formatMonthLabel('2025-01'); // "January 2025"

Account Types

Accounts are categorized as either assets or liabilities. The category is automatically determined based on the account type:

  • Assets: Checking, Savings, Cash, Brokerage, 401(k), IRA, HSA, Crypto, Real Estate, Vehicle
  • Liabilities: Credit Card, Loan, Mortgage, Student Loan, Auto Loan, 401(k) Loan

Scripts

npm run dev      # Start development server
npm run build    # Build for production
npm run start    # Start production server
npm run lint     # Run ESLint

License

MIT

About

A personal finance app for tracking net worth and planning budgets. Built with Next.js, data stored locally in your browser.

Topics

Resources

License

Stars

Watchers

Forks

Contributors