How arabindakabiraj/moneyflow works
1. What the repo is
- MoneyFlow V.2 is a single-page React application built with Vite and styled with Tailwind CSS.
- Architecturally, it is a client-heavy finance dashboard backed by Supabase for auth, data, and policy enforcement, with a few external services for AI and OTP verification.
2. Top-level runtime boundaries
- The browser app is the main runtime.
- Supabase provides the durable backend: Postgres, Auth, RLS, triggers, and realtime/data APIs.
- Additional external services are implied by the UI: an LLM endpoint for finance chat/smart parsing and a separate OTP service for sensitive verification flows.
- The app also ships as a PWA and has Capacitor support for mobile packaging.
3. App shell and navigation
- src/main.jsx mounts App.jsx, which acts as the layout/router shell.
- The visible shell is composed of Header, BottomNav, DesktopSidebar, SplashScreen, OnboardingModal, and ErrorBoundary.
- The UI is organized for mobile-first finance workflows, with alternate desktop navigation.
4. Global state and shared concerns
- context/AppContext.jsx is the central state hub for finance data, UI state, and CRUD coordination.
- context/ThemeContext.jsx manages the theme system, which is driven by CSS variables and HSL-based palettes.
- Hooks such as useNetwork, useNotifications, and useInstallPrompt provide app-wide concerns: connectivity awareness, local notifications, and PWA install behavior.
5. Data access layer
- src/supabase.js is the primary client boundary for all persisted data operations.
- authUtils.js handles client-side auth-related hashing/derivation logic before interacting with Supabase-based auth flows.
- The app appears to keep most domain logic on the frontend, while Supabase enforces persistence and access control.
6. Core finance domains
- The app is centered around transaction and portfolio management components:
- Accounts, AddTransaction, Transactions, Ledger
- Dashboard, Charts, BudgetVsActual, CashFlow, NetWorthTracker
- SavingsGoals, DebtTracker, BillReminders, RecurringTransactions
- These screens all consume the same underlying user financial state but present it in different operational views.
7. AI and automation pipeline
- AIChat.jsx is the conversational assistant surface.
- SmartAdd.jsx is the transaction entry automation path: natural language or voice-like input is transformed into structured transaction data.
- Utilities such as autoCategory.js and spendingPredictor.js support automated categorization and forecast-style insights.
- The data flow is: user text/context → parser/LLM helper → normalized transaction/insight → state update → Supabase persistence.
8. Import, cleanup, and statement generation
- SMSImport.jsx plus utils/smsParser.js handle pasted bank/SMS transaction ingestion.
- csvExport.js and pdfExport.js generate downloadable reporting artifacts from transaction history.
- This is a distinct reporting/export boundary: raw financial events are transformed into user-shareable documents rather than only being displayed in-app.
9. Shared finance and collaboration features
- FamilyMode.jsx and GroupExpenses.jsx implement the multi-user/collaborative financial layer.
- DebtTracker, RecurringTransactions, and the family-linking UI imply multiple shared bookkeeping models:
- linked household finances
- group expense settlement
- individual debts and recurring obligations
- These features depend on database rules that allow selective visibility across linked users.
10. Security and access control
- Authentication and protected actions are surfaced through AuthScreen, AppLock, and OtpGuardModal.
- The repository and README indicate layered security: local app lock, account auth, and secondary OTP verification for sensitive operations.
- The important architectural point is that security is not just UI-level; it is backed by database rules and server-side Supabase auth.
11. Supabase schema and policy boundary
- The schema lives in supabase/migrations/ and is the authoritative backend model.
- Core tables include profiles, settings, transactions, debts, goals, bills, recurring, groups, family_links, and phone_index.
- Row Level Security is central: users can usually only access their own records, with special read access for linked family members where intended.
- Triggers provision new users and keep the phone lookup index synchronized.
12. Offline/PWA/mobile delivery
- public/manifest.json, public/sw.js, and useInstallPrompt.js show the app is designed as a PWA.
- The app can be installed like a mobile app, and the service worker provides the offline caching boundary.
- Capacitor-related support and vercel.json indicate multiple deployment targets: web hosting plus mobile packaging.
13. Build and operational tooling
- The frontend build stack is standard modern web tooling: Vite, PostCSS, Tailwind, ESLint, Prettier.
- The repo also includes Supabase local dev configuration and migrations for reproducible backend setup.
- There are Firebase configuration files present, but the main architecture in the codebase is centered on React + Supabase, not Firebase.
14. How the main data flow works
- User authenticates → app shell loads global state → Supabase queries hydrate accounts/transactions/settings → dashboard and analytics render.
- User actions like adding transactions, splitting bills, or updating goals go through context/state handlers and then persist to Supabase.
- AI, import, export, and notification features all sit on top of that same core financial data model.
Main entry points: AppContext.jsx App state · App.jsx App shell · supabase.js Supabase client · AIChat.jsx AI assistant
Components 21
Frontend app
Browser-facing React SPA, shell, state, and UI surfaces.
- main.jsx · Bootstraps the React app.
src/main.jsx - App shell · Top-level layout, routing, and app composition.
src/App.jsx - App state · Central finance and UI state coordination.
src/context/AppContext.jsx - Theme context · Theme and color system management.
src/context/ThemeContext.jsx - Shell UI · Header, navigation, onboarding, splash, and error handling surfaces.
- Access guard · Auth, app lock, and OTP gating for protected actions.
Finance domains
Primary finance workflows and dashboards exposed in the app.
- Dashboard · High-level financial summary and KPIs.
src/components/Dashboard.jsx - Accounts · Account balances and linked financial sources.
src/components/Accounts.jsx - Transactions · Transaction browsing, editing, and bookkeeping.
src/components/Transactions.jsx - Add transaction · Manual transaction creation and update flow.
src/components/AddTransaction.jsx - Planning · Budget, cash flow, net worth, goals, debt, and bills.
- Shared finance · Family and group expense coordination.
src/components/FamilyMode.jsx
Automation
AI-assisted entry, import, export, and forecasting helpers.
- AI assistant · Conversational finance helper and smart entry surface.
src/components/AIChat.jsx - Smart add · Turns natural language into structured transactions.
src/components/SmartAdd.jsx - Import/export · SMS ingestion and report generation.
- Forecasting · Categorization and spending prediction helpers.
src/utils/spendingPredictor.js
Backend boundary
Supabase persistence, auth, schema, and policy layer.
- Supabase client · Primary client boundary for persistence and auth.
src/supabase.js - Schema & RLS · Migrations, tables, triggers, and row-level security policies.
supabase/migrations/20260524000000_schema.sql - Chat messages · Supabase chat message storage.
supabase/migrations/20260524000001_chat_messages.sql
Delivery
PWA and mobile packaging support.
- PWA layer · Manifest, service worker, and install prompt support.
public/manifest.json - Mobile packaging · Capacitor and hosting configuration for app delivery.
vercel.json
Connections 24
- main.jsx → App shell: mounts · Entry point renders the application shell.
- App shell → Shell UI: composes · The shell assembles header, nav, onboarding, splash, and error surfaces.
- App shell → Access guard: protects · Auth and lock gating wrap sensitive app flows.
- App shell → App state: hydrates · Shell depends on global finance and UI state.
- App shell → Theme context: themes · App uses shared theme state for styling.
- App state → Supabase client: syncs · Central state reads and writes persisted finance data.
- Access guard → Supabase client: authenticates · Protected flows depend on Supabase auth and verification.
- Supabase client → Schema & RLS: persists to · Client operates against the Supabase schema and RLS boundary.
- Supabase client → Chat messages: stores · Chat-related data uses a dedicated backend table.
- Schema & RLS → Chat messages: extends · Chat messages are part of the backend data model.
- App state → Dashboard: feeds · Global state powers dashboard summaries.
- App state → Accounts: feeds · Account views consume shared finance state.
- App state → Transactions: feeds · Ledger and transaction screens consume shared transaction state.
- App state → Add transaction: updates · Entry flow writes new or edited transactions into state.
- App state → Planning: feeds · Budgeting and goals features reuse the same financial model.
- App state → Shared finance: coordinates · Family and group finance features coordinate through shared state.
- AI assistant → Smart add: drives · Assistant and smart entry form the AI-assisted input path.
- Smart add → App state: writes · Structured transaction output updates global state.
- AI assistant → Supabase client: persists · AI-assisted actions eventually save through the data client.
- Import/export → Transactions: transforms · Imports and exports operate on transaction history.
- Import/export → App state: reads · Reporting and ingestion use shared app data.
- Forecasting → App state: analyzes · Forecasting and categorization derive insights from app state.
- PWA layer → App shell: supports · Manifest, service worker, and install behavior support the shell.
- Mobile packaging → PWA layer: packages · Delivery configuration enables web and mobile distribution.