A full-stack personal finance tracker with multi-currency support, investment portfolio monitoring, and real-time market data integration.
Finance Manager is a modern, privacy-focused personal finance application that helps you track your net worth, manage multiple accounts, monitor investments, and analyze spending patterns. Built on Cloudflare's edge network for global performance and security.
cd api
npx wrangler d1 execute finance-db --remote --file=schema.sql
npm run deploycd client
npm run build
npx wrangler pages deploy dist --project-name=finance-clientUse the deployment script to deploy everything at once:
./deploy.sh finance-clientThis script handles:
- Database schema updates β Applies migrations to your D1 database
- API deployment β Deploys backend to Cloudflare Workers
- Client build & deploy β Builds React app and deploys to Cloudflare Pages
Backend
- Runtime: Cloudflare Workers (serverless, edge-deployed)
- Framework: Hono (lightweight web framework)
- Database: Cloudflare D1 (SQLite at the edge)
- Market Data: Yahoo Finance API v2
Frontend
- Framework: React 19 with TypeScript
- Build Tool: Vite 7
- Styling: Tailwind CSS 4 with custom design system
- Charts: Recharts for data visualization
- Icons: Lucide React
- State: React Context API (Privacy, Settings)
finance/
βββ api/ # Backend (Cloudflare Workers)
β βββ src/
β β βββ index.ts # API routes & business logic
β βββ schema.sql # Database schema
β βββ wrangler.toml # Cloudflare Workers config
β βββ package.json
β
βββ client/ # Frontend (React + Vite)
β βββ src/
β β βββ components/ # React components
β β β βββ AccountList.tsx
β β β βββ TransactionList.tsx
β β β βββ Investments.tsx
β β β βββ InvestmentChart.tsx
β β β βββ Analytics.tsx
β β β βββ TransferForm.tsx
β β β βββ Settings.tsx
β β β βββ ui/ # Reusable UI components
β β βββ context/
β β β βββ PrivacyContext.tsx
β β βββ lib/
β β β βββ utils.ts # Helper functions
β β βββ App.tsx # Main application
β β βββ config.ts # API configuration
β β βββ main.tsx # Entry point
β βββ package.json
β
βββ deploy.sh # Automated deployment script
βββ package.json # Workspace root
β¨ Multi-Account Management
- Cash accounts (checking, savings, wallet)
- Investment accounts (stocks, crypto, manual assets)
- Multi-currency support with real-time conversion
π Transaction Tracking
- Categorized income & expenses
- Recurring transactions
- Linked transfers between accounts
- Custom categories with emoji icons
π Investment Portfolio
- Real-time stock/crypto prices via Yahoo Finance
- Portfolio value tracking
- Transaction history (buy/sell)
- Performance charts and analytics
π Privacy Mode
- Toggle to hide sensitive financial data
- Persistent user preference (cookie-based)
- Quick eye icon toggle in header
π Analytics Dashboard
- Net worth overview
- Income vs. expenses
- Category breakdown charts
- Monthly trends and patterns
π Global Deployment
- Edge-deployed on Cloudflare network
- Sub-50ms response times worldwide
- Automatic HTTPS and DDoS protection
The application supports two types of accounts:
-
Cash Accounts β Traditional bank accounts, wallets
- Direct balance management
- Currency-specific
-
Investment Accounts β Asset holdings
- Stock/Crypto: Auto-updates price from Yahoo Finance
- Manual: User-defined assets without market data
- Balance calculated from:
transactions Γ current_price
Every financial action is recorded as a transaction:
User Action β Transaction Record β Account Balance Update
Example: Transfer $100 from Checking to Savings
- Creates 2 linked transactions:
- Transaction A: Checking -$100 (expense)
- Transaction B: Savings +$100 (income)
- Both transactions share a
linked_transaction_id - Account balances update atomically
Investment Transactions are tracked via regular transactions with a price field:
- Buy: Negative amount, increases holdings
- Sell: Positive amount, decreases holdings
Investment accounts use a transaction-based approach:
- User buys 10 shares of AAPL at $150/share
- System creates transaction:
-$1500amount,price: 150,quantity: 10 - Current balance =
SUM(transactions.amount / price) Γ current_market_price
Auto-refresh runs on:
- Page load
- Manual refresh button
- Every 5 minutes (in dashboard view)
Privacy mode uses a React Context to globally mask sensitive data:
// When enabled, transforms:
"$12,345.67" β "β’β’β’β’β’β’"
"150 shares" β "β’β’β’"- Preference saved in localStorage + cookie
- Survives page refresh
- Applies to: balances, amounts, quantities, charts
Three-Layer Security Model:
-
Cloudflare Access (Frontend)
- Email-based authentication
- Only authorized users can view the app
- 24-hour session duration
-
API Key Authentication (Backend)
- Every API request requires
X-API-Keyheader - Key stored in environment variables
- Validates on every request
- Every API request requires
-
CORS Protection (Backend)
- Origin whitelist validation
- Rejects unauthorized domains
- Configurable via
ALLOWED_ORIGINSenv var
Environment Secrets:
API_SECRETβ Backend API keyALLOWED_ORIGINSβ Comma-separated allowed domainsVITE_API_KEYβ Client-side API key (injected at build time)
- Node.js 18+ and npm
- Cloudflare account with Workers + D1 access
- Wrangler CLI (installed via npm)
-
Clone and install dependencies:
git clone <repo-url> cd finance npm install
-
Configure the API:
cd api cp wrangler.toml.example wrangler.toml # Edit wrangler.toml: # - Set database_id (create D1 database first) # - Configure API_SECRET and ALLOWED_ORIGINS
-
Initialize database:
npx wrangler d1 execute finance-db --local --file=schema.sql
-
Configure the client:
cd ../client # Create .env.local file: echo "VITE_API_KEY=your-api-key-here" > .env.local echo "VITE_API_DOMAIN=localhost:8787" >> .env.local
-
Run development servers:
cd .. npm run dev # API: http://localhost:8787 # Client: http://localhost:5173
API (wrangler.toml secrets):
[vars]
API_SECRET = "your-secret-key"
ALLOWED_ORIGINS = "http://localhost:5173,https://finance.yourdomain.com"Client (.env.local):
VITE_API_KEY=your-secret-key
VITE_API_DOMAIN=localhost:8787 # or api.yourdomain.com for prodBase URL: https://api.finance.yourdomain.com
Authentication: Include X-API-Key header in all requests.
| Method | Endpoint | Description |
|---|---|---|
GET |
/ |
Health check |
GET |
/version |
API version |
GET |
/accounts |
List all accounts |
POST |
/accounts |
Create account |
PUT |
/accounts/:id |
Update account |
DELETE |
/accounts/:id |
Delete account |
GET |
/transactions |
List transactions |
POST |
/transactions |
Create transaction |
DELETE |
/transactions/:id |
Delete transaction |
GET |
/categories |
List categories |
POST |
/categories |
Create category |
GET |
/dashboard/net-worth |
Calculate net worth |
GET |
/market/quote/:symbol |
Get stock/crypto price |
POST |
/market/refresh-investments |
Refresh all investment prices |
Example Request:
curl -H "X-API-Key: your-key" \
https://api.finance.yourdomain.com/accountsVersion: 0.8.5 (Client) | 1.0.1 (API)
License: MIT
Maintained by: apptrackit