FinTracker React is a personal finance web application for managing accounts, transactions, reminders, and data import or export. The frontend is built with React and Vite, and it communicates with a REST-style backend backed by Cloudflare D1.
The app is designed for individual users who want a simple finance tracker with charts, CSV import, reminder automation, and account-level transaction tracking.
- React 19
- Vite 6
- React Router DOM 7
- Recharts for dashboards and charts
- CSS with a custom design system in
src/index.css
- Cloudflare D1-backed API accessed through REST endpoints
- Fetch-based client in
src/db/database.js - Session restoration through browser
localStorage - Auth-related request tokens stored in browser cookies
- Cloudflare Turnstile on the authentication page
- Honeypot field to block simple automated form submissions
- Client-side SHA-256 password hashing before submission
- Secure cookies with
sameSite: 'strict'andsecure: truefor token persistence
- Node.js and npm
- Vite dev server and production build pipeline
- Lazy-loaded route-level bundles for better initial load performance
Users can register and sign in from a dedicated authentication screen.
Implemented behavior:
- Registration with name, email, and password
- Login with email and password
- Session restoration after refresh using
localStorage - Terms and Privacy acceptance gate before auth submission
- Cloudflare Turnstile verification before form submission
- Honeypot-based bot filtering
Files involved:
src/components/AuthPage.jsxsrc/context/AuthContext.jsxsrc/db/database.js
The dashboard summarizes a user’s financial position and renders visual analytics.
Included metrics:
- Net balance
- Total income
- Total expense
- Total credit
- Total debit
- Pending payments from reminders
- Pending receivables from reminders
- Income to expense ratio
Visualizations:
- Monthly trend chart
- Transaction breakdown pie chart
- Expense by category bar chart
The dashboard filters data by account and date range.
Users can create and manage multiple financial accounts such as:
- Savings
- Checking
- Credit card
- Cash
- Investment
- Loan
- Other custom account types supported by the UI list
Per-account behavior:
- Add account with opening balance
- Edit account details
- Delete account
- Show computed live balance based on opening balance plus transactions
- Show transaction count per account
Users can maintain a transaction ledger linked to their accounts.
Supported transaction types:
- Income
- Expense
- Transfer
- Credit
- Debit
Features:
- Add transaction
- Edit transaction
- Delete transaction
- Filter by type
- Filter by account
- Search by description, category, or reference
- Mobile-friendly transaction card layout
- Transfer flow creates paired outgoing and incoming entries
Reminders help users track upcoming payments and receivables.
Features:
- Add payment reminders
- Add receivable reminders
- Edit and delete reminders
- Filter by active, payment, receivable, overdue, and completed
- Mark reminder as completed or undo completion
- Optional account linkage
- Optional recurring schedule
Recurring options:
- One-time
- Weekly
- Monthly
- Quarterly
- Yearly
Automation behavior:
- Completing an account-linked reminder can auto-create a transaction
- Undoing a completed linked reminder removes the generated transaction
- Completing a recurring reminder generates the next reminder occurrence
- Undoing a recurring completed reminder removes the generated next reminder
The app supports moving data in and out of the system.
Import capabilities:
- CSV upload for transaction imports
- Drag and drop CSV support
- Auto-detection of common column names
- Manual mapping for date, amount, description, type, category, and reference
- Import into a selected account
- Preview of the first five rows before import
Export capabilities:
- Full JSON export including accounts, transactions, reminders, and export timestamp
- CSV export of transactions
The app now includes route-level lazy loading so that heavy screens are loaded on demand instead of in the first bundle.
Implemented performance improvements:
- Lazy-loaded page components in
src/App.jsx - Skeleton loading states on major pages
- Reduced initial JavaScript bundle size by splitting route chunks
- Mobile-responsive transaction and reminder layouts to reduce rendering issues on smaller screens
.
|-- index.html
|-- package.json
|-- vite.config.js
|-- public/
`-- src/
|-- App.jsx
|-- main.jsx
|-- index.css
|-- assets/
|-- components/
| |-- Accounts.jsx
| |-- AuthPage.jsx
| |-- Dashboard.jsx
| |-- ImportExport.jsx
| |-- Layout.jsx
| |-- PrivacyPolicy.jsx
| |-- Reminders.jsx
| |-- TermsOfService.jsx
| `-- Transactions.jsx
|-- context/
| `-- AuthContext.jsx
`-- db/
`-- database.js
- Node.js 18 or newer recommended
- npm
- A running backend that exposes the expected D1 API endpoints
npm installCreate a .env file in the project root.
Example:
VITE_D1_API_URL=https://your-api.example.com
VITE_D1_API_TOKEN=your-api-token
VITE_TURNSTILE_SITE_KEY=your-turnstile-site-keyVariable usage:
VITE_D1_API_URL: Base URL for the REST API used by the frontendVITE_D1_API_TOKEN: Static API authorization token sent as a bearer tokenVITE_TURNSTILE_SITE_KEY: Cloudflare Turnstile site key for the auth form
npm run devnpm run buildnpm run previewnpm run dev: Start the Vite development servernpm run build: Create a production buildnpm run preview: Preview the production build locallynpm run lint: Run ESLint if linting is configured in the environment
The frontend assumes the backend exposes endpoints for:
- User registration and login
- User lookup by ID or email
- Accounts CRUD
- Transactions CRUD
- Reminders CRUD
- Query endpoint for bulk or relational operations
Examples visible in the frontend data layer:
/rest/register/rest/login/rest/getuser/:id/rest/accounts/rest/transactions/rest/reminders/query
This section describes the current implementation as it exists in the codebase.
Passwords are hashed with SHA-256 in src/db/database.js before being sent to the API.
What this does:
- Avoids sending raw plain-text passwords from the UI layer
What to know:
- This is not a replacement for strong server-side password hashing
- The backend should still hash credentials again with a password-specific algorithm such as Argon2, scrypt, or bcrypt with salt
The auth screen uses Cloudflare Turnstile to reduce automated abuse.
Current flow:
- The user must complete the challenge
- Form submission is blocked unless Turnstile succeeds
- A hidden honeypot field adds a simple bot trap
The app currently uses two client-side persistence mechanisms:
localStoragestores the app session reference (userId)- Browser cookies store
tokenandtokenKey
Cookie flags currently set in the frontend:
secure: truesameSite: 'strict'path: '/'
Important limitation:
- Because cookies are created from frontend JavaScript, they cannot be
HttpOnly - If XSS is introduced elsewhere in the app, browser-accessible tokens are at risk
Most fetch operations include the current userId in request parameters so the UI only requests that user’s data.
Important limitation:
- Real authorization must still be enforced by the backend
- Frontend filtering alone is not a security boundary
If you are deploying this project for real users, the following improvements are strongly recommended:
- Move authentication and token issuance fully server-side.
- Use
HttpOnly, secure, same-site cookies issued by the server. - Replace client-side SHA-256-only credential protection with server-side Argon2, scrypt, or bcrypt.
- Ensure every API endpoint validates the authenticated user independently of request query params.
- Add rate limiting on auth and sensitive endpoints.
- Add CSRF protection if cookie-based auth is used across origins.
- Add Content Security Policy headers to reduce XSS risk.
- Audit any backend endpoint that accepts raw SQL-like query input.
- Rotate and protect the API token used by the frontend.
- Avoid storing highly sensitive banking secrets, PINs, OTPs, or full account credentials.
High-level user journey:
- The user registers or logs in.
- Auth state is restored from local storage on later visits.
- The user creates accounts.
- The user adds transactions or imports them from CSV.
- The dashboard aggregates transactions and reminders into summary cards and charts.
- The user creates reminders for future payments or receivables.
- The user exports data when needed as JSON or CSV.
- The frontend assumes a compatible backend is already available.
- Security strength depends heavily on backend enforcement, not only on UI checks.
- Browser-side token handling is practical for a prototype or controlled deployment, but not ideal for a hardened production environment.
- Main data access logic lives in
src/db/database.js. - Auth state is managed in
src/context/AuthContext.jsx. - Layout and navigation are handled in
src/components/Layout.jsx. - Page-level code splitting is configured in
src/App.jsxthroughReact.lazy(). - Global styling and responsive behavior live in
src/index.css.
This project is licensed under the MIT License.
Files updated for licensing:
LICENSEpackage.json
The MIT license allows commercial and private use, modification, distribution, and sublicensing, provided the original copyright and license notice remain included.