Wealthnudge
Business Context
Most personal finance applications focus narrowly on budgeting. WealthNudge was designed as a broader financial control system allowing users to manage wallets, transactions, debts, goals, and advisory interactions within a single coherent architecture.
Two core challenges shaped the system
Designing an intuitive end-to-end architecture enabling users to control their entire financial lifecycle not just expense tracking.
Providing intelligent, AI-driven insights without compromising security or exposing sensitive financial data.
The objective was to build a secure financial operating layer capable of handling real monetary workflows while remaining extensible during active development.
Engineering Architecture
Dual-Backend Design
The system is split into two backend services within a modular repository: Core Financial API (CRUD operations + financial logic) and AI Agent Service (streaming advice and persona-based coaching). This separation allows independent scaling, clearer responsibility boundaries, and prevents AI workloads from impacting transactional performance.
Application-Level Financial Logic
All core financial rules are implemented in structured Node.js service-layer functions rather than database-level stored procedures. This decision simplifies iteration, debugging, and rapid architectural changes during active development while still preserving transactional safety.
Atomic Financial Operations
Critical workflows (transfers, bill payments, balance updates) are executed within controlled transaction blocks to prevent race conditions and ensure balance consistency.
Multi-Tenant Isolation (Row-Level Security)
Row-Level Security policies enforce tenant isolation directly at the database layer. The API passes authenticated context, and PostgreSQL automatically filters rows per user eliminating manual filtering logic and reducing cross-tenant risk.
Mobile Resilience Layer
Implemented an Axios request queue pattern to handle token refresh race conditions. Failed requests during session renewal are queued and replayed after a single successful refresh, preventing logout loops and concurrency bugs.
Time-Aware Budget Algorithm
Designed a lightweight variance-based health scoring model (variance = spend_ratio - time_ratio) computed in under 100ms without heavy AI processing, enabling real-time financial feedback.
Key Trade-offs
Database Enforcement vs Development Agility
Rather than embedding all rules in stored procedures, financial logic lives primarily in structured Node.js services. This increases flexibility and simplifies debugging while the product architecture is evolving.
Security Architecture Vision
The system is designed with strict separation between identity and financial data. The architectural principle is: access to a user identity does not automatically expose financial records, and financial records are never accessible without verified identity context.
AI Scalability vs Core Stability
The AI service is deployed as a separate backend to allow focused scalability and independent performance tuning, ensuring conversational inference workloads do not degrade financial operations.