How mahender8559/2.2-coinbuddy works
Purpose and Entry Points
CoinBuddy is a client-side personal-finance application for accounts, transactions, budgets/affordability, loans, goals, recurring payments, shared finances, and planning insights. The browser app starts at src/main.tsx, renders the application shell in src/App.tsx, and is styled through src/index.css and versioned UI CSS such as src/v35.css.
Application State and UI Shell
src/context/AppContext.tsx is the central application-state boundary, supplying finance data and mutations to page-level components. src/App.tsx coordinates navigation, modal/page composition, onboarding, lock/exit behavior, and major service components. The primary user-facing workspaces are implemented in components including:
• src/components/Dashboard.tsx
• src/components/ManageFinances.tsx
• src/components/Settings.tsx
The component layer also contains dedicated account, category, transaction-detail, goal, activity, and insight views under the V35 UI (src/components/V35AccountsPanel.tsx, src/components/V35TransactionDetail.tsx, src/components/V35Insights.tsx).
Persistence and Finance Data Boundary
Persistence is abstracted behind a database client/repository layer rather than being distributed across UI components. src/db/dbClient.ts and src/db/dbClientCore.ts provide the main storage interface and lifecycle operations; src/db/sqliteSchema.ts defines the persisted schema. Shared-finance-specific persistence is separated in src/db/sharedFinanceRepository.ts.
UI mutations flow through application context into this data layer; persisted records are then used by dashboards, planners, schedules, and exports. This boundary is important for durable CRUD, clear/reset behavior, account initialization, and data integrity.
Ledger, Accounts, and Transaction Workflows
Account and transaction interaction is organized around modals, management screens, and ledger rules:
• src/components/AddAccountModal.tsx
• src/components/AddTransactionModal.tsx
• src/components/ReconcileWizard.tsx
Domain rules in src/domain/ledgerRules.ts and src/domain/ledgerSafety.ts protect ledger semantics, while src/utils/balanceManager.ts derives or updates balances. Transaction search/import/export-related behavior is supported by src/utils/transactionSearch.ts, src/utils/ledgerSchema.ts, and src/utils/exportExcel.ts.
Planning and Financial Domain Engine
Pure domain modules separate financial calculations from rendering. Affordability is a principal planning subsystem, combining settings, goals, category limits, irregular/normal spending, and upcoming money:
• src/domain/affordability.ts
• src/domain/affordabilityPlanner.ts
• src/domain/affordabilitySettings.ts
Its UI surfaces are src/components/AffordabilityPlanner.tsx, src/components/CategoryAffordabilityReview.tsx, and src/components/SmarterPlanningDashboard.tsx. Related projection engines cover savings goals (src/domain/savingsGoals.ts), loans (src/domain/loanRevisionProjection.ts), credit-card statements (src/domain/creditCardStatements.ts), and recurring schedules (src/domain/recurring.ts).
Automation, Backup, and External Google Services
The app includes local backup management and automated backup UX through src/utils/backupManager.ts and src/components/BackupAutomationService.tsx. Backup security/warnings are surfaced by src/components/BackupSecurity.tsx and src/components/BackupWarningBanner.tsx.
Google authentication and Google Drive backup are implemented as serverless API routes, suitable for Vercel deployment:
• api/auth/google/connect.js
• api/auth/google/callback.js
• api/google-drive/backup.js
api/_googleDrive.js is the shared Drive integration boundary; routes also expose connection status, backup listing, and deletion. The frontend connection/backup flow is therefore separated from OAuth token and Drive API handling.
Runtime and Deployment
The frontend is a TypeScript React application built with Vite (vite.config.ts, package.json). API endpoints are deployed as Vercel functions, configured by vercel.json. Browser-facing PWA/mobile metadata resides in public/manifest.json, while Google Drive credentials/environment expectations are represented by .env.example and google-drive-vercel.env.template.
Main entry points: App.tsx Application shell · AppContext.tsx App state · AddTransactionModal.tsx Ledger workflows · AffordabilityPlanner.tsx Planning workspaces
Components 19
Browser application
- Vite entry
src/main.tsx - Application shell
src/App.tsx - App state · Supplies finance data and mutations to page components.
src/context/AppContext.tsx - Finance workspaces
src/components/Dashboard.tsx - Ledger workflows
src/components/AddTransactionModal.tsx - Planning workspaces
src/components/AffordabilityPlanner.tsx
Finance domain
- Ledger rules & safety
src/domain/ledgerRules.ts - Balance manager
src/utils/balanceManager.ts - Affordability engine · Combines spending, goals, settings, limits, and upcoming money.
src/domain/affordability.ts - Financial projections
src/domain/savingsGoals.ts
Persistence
- Database client · Owns storage lifecycle and durable CRUD.
src/db/dbClient.ts - Database core
src/db/dbClientCore.ts - SQLite schema
src/db/sqliteSchema.ts - Shared-finance repository
src/db/sharedFinanceRepository.ts
Backup & Google services
- Local backup manager
src/utils/backupManager.ts - Backup automation UI
src/components/BackupAutomationService.tsx - Google API routes · Handles OAuth connection and Drive backup operations.
api/auth/google/connect.js - Google Drive integration
api/_googleDrive.js - Vercel deployment
vercel.json
Connections 20
- Vite entry → Application shell: renders
- Application shell → App state: composes
- Application shell → Finance workspaces: routes to
- Application shell → Ledger workflows: opens
- Application shell → Planning workspaces: opens
- Finance workspaces → App state: reads and mutates
- Ledger workflows → App state: submits mutations
- Planning workspaces → App state: uses finance data
- App state → Database client: persists through
- Database client → Database core: delegates to
- Database core → SQLite schema: uses
- Database client → Shared-finance repository: separates shared finance
- Ledger workflows → Ledger rules & safety: enforces
- Ledger rules & safety → Balance manager: protects updates
- Planning workspaces → Affordability engine: calculates with
- Affordability engine → Financial projections: uses projections
- Backup automation UI → Local backup manager: automates
- Backup automation UI → Google API routes: connects and backs up
- Google API routes → Google Drive integration: calls
- Vercel deployment → Google API routes: deploys