How karthik2428/finwiz works
1. System shape
- Finwiz is a two-tier finance app: a React single-page frontend in client/ and an Express/MongoDB backend in server/.
- The main data path is: browser UI → frontend API service → Express routes/controllers → Mongoose models → MongoDB.
2. Frontend shell
- The client is built with React + Vite and styled with Tailwind utilities.
- App.jsx and main.jsx likely define the app shell and route mounting, while AuthContext holds login/session state across the UI.
3. Frontend feature areas
- User-facing pages are split by concern: dashboard, transactions, budget, goals, profile, subscriptions, premium, and onboarding/auth flows such as login, signup, OTP verification, forgot/reset password.
- There is also a separate admin section under client/src/pages/admin, indicating the UI has both consumer and administrative workflows.
4. Frontend layout and reusable components
- Shared layout components (DashboardLayout, Navbar, Sidebar, NotificationCenter, PrivateRoute) define the authenticated app shell and route protection.
- Common primitives like Button, Input, Modal, Table, Card, ProgressBar, and DateInput keep the UI consistent across finance pages.
5. Client-side service layer
- client/src/services/api.js is the primary backend integration point.
- Specialized frontend services for analytics, forecast, and recommendation suggest the UI consumes computed finance insights rather than only raw CRUD data.
6. Backend API organization
- The server is organized by domain with routes/controllers for auth, transactions, budgets, goals, analytics, forecast, recommendations, news, notifications, payments, subscriptions, reports, and user management.
- Admin capabilities are isolated in their own route/controller set: config, funds, logs, news, payments, system, and users.
7. Persistence model
- MongoDB is the core datastore via Mongoose models.
- The schema set shows the app tracks users, transactions, budgets, goals, subscriptions, payments, notifications, OTPs, reports, logs, and admin/configuration objects such as Config, NewsSetting, and FundMetadata.
8. Derived finance intelligence
- The backend contains substantial business logic for computation, not just storage.
- Utility modules such as analyticsMath, forecastMath, goalMath, riskCalculator, categorizer, subscriptionDetector, and mfMath indicate that budgeting, forecasting, categorization, and recommendation features are calculated server-side.
9. External service integrations
- The app integrates with email and payment providers: brevoService for messaging/email and razorpayService for payments.
- pdfService supports document/report generation, and mfService plus news-related services suggest enrichment from external market/news sources.
10. Background processing
- Several cron-oriented services (newsCron, notificationCron, paymentCron, reportCron, logCron, and cronService) show that the backend runs scheduled jobs.
- These jobs likely handle periodic news ingestion, notification delivery, payment/subscription upkeep, reporting, and maintenance/logging.
11. Authentication and user lifecycle
- Authentication is handled by dedicated controllers and middleware, with OTP support via the Otp model and otpGenerator.
- Password reset, verification, and protected-resource access are enforced through auth middleware and the frontend PrivateRoute.
12. Operational boundaries
- Middleware separation is clear: asyncHandler for controller error wrapping, plus request/error logging middleware for observability.
- The existence of both client/vercel.json and server/vercel.json suggests the frontend and backend can be deployed independently.
13. Architecture summary for diagramming
- Model the repository as four major zones: public/auth flows, authenticated finance dashboard, admin console, and backend job/integration layer.
- The central backend domain services are what connect raw user activity to analytics, forecasts, notifications, payments, and reports.
Main entry points: App.jsx App Shell · index.js Server · User.js Domain Models · Dashboard.jsx Finance Pages
Components 19
Client App
React/Vite frontend with authenticated finance and admin workflows.
- Main · Bootstraps the SPA and mounts the app.
client/src/main.jsx - App Shell · Top-level client composition and route wiring.
client/src/App.jsx - Auth State · Holds session and login state across the UI.
client/src/context/AuthContext.jsx - Private Route · Protects authenticated screens in the client router.
client/src/components/layout/PrivateRoute.jsx - Dashboard Layout · Authenticated app shell with navigation and sidebar.
client/src/components/layout/DashboardLayout.jsx - API Client · Primary frontend integration point for backend calls.
client/src/services/api.js - Insights Services · Client-side access to analytics, forecast, and recommendations.
client/src/services/analytics.js - Auth Pages · Login, signup, OTP, and password recovery flows.
client/src/pages/Login.jsx - Finance Pages · Dashboard, transactions, budget, goals, profile, subscriptions, and premium screens.
client/src/pages/Dashboard.jsx - Admin UI · Administrative screens for config, funds, logs, news, payments, system, and users.
client/src/pages/admin/AdminDashboard.jsx
Server API
Express backend with domain routes, business logic, and scheduled jobs.
- Server · Starts the API server and wires middleware, routes, and services.
server/src/index.js - Auth API · Handles login, verification, password reset, and protected access.
server/src/controllers/authController.js - Finance API · Transactions, budgets, goals, user data, and reports endpoints.
server/src/controllers/transactionsController.js - Insight API · Analytics, forecasting, recommendations, and news enrichment endpoints.
server/src/controllers/analyticsController.js - Admin API · Administrative configuration, logs, payments, news, funds, system, and user controls.
server/src/controllers/adminConfigController.js - Job Services · Cron-driven maintenance for news, notifications, payments, reports, and logs.
server/src/services/cronService.js - External Integrations · Email, payments, PDF generation, market data, and news services.
server/src/services/brevoService.js
Persistence
MongoDB-facing Mongoose models that store app state and records.
- Domain Models · Core persisted entities including users, transactions, budgets, goals, and operational records.
server/src/models/User.js - MongoDB · Primary datastore accessed through Mongoose.
server/src/config/db.js
Connections 22
- Main → App Shell: mounts · Entry point renders the application shell.
- App Shell → Auth State: uses · App shell reads session state for routing and UI decisions.
- App Shell → Private Route: protects · Authenticated routes are wrapped by the guard.
- App Shell → Dashboard Layout: composes · Dashboard sections share the common authenticated layout.
- App Shell → Auth Pages: routes to · Public flows cover login, signup, OTP, and recovery.
- App Shell → Finance Pages: routes to · Primary user screens are mounted from the app router.
- App Shell → Admin UI: routes to · Admin screens are exposed as a separate UI area.
- Finance Pages → API Client: calls · Finance pages fetch and mutate backend data through the API service.
- Finance Pages → Insights Services: uses · Dashboard features consume computed analytics and forecasts.
- Admin UI → API Client: calls · Admin operations use the same backend integration layer.
- Server → Auth API: exposes · Authentication endpoints are registered in the API.
- Server → Finance API: exposes · Core finance endpoints handle app data flows.
- Server → Insight API: exposes · Insight endpoints serve analytics and recommendation features.
- Server → Admin API: exposes · Admin routes are mounted separately from consumer APIs.
- Server → Job Services: starts · Background cron jobs run alongside the API server.
- Server → External Integrations: integrates · Server services connect to third-party providers and market/news sources.
- Auth API → Domain Models: reads/writes · Auth logic persists users and OTP-related records.
- Finance API → Domain Models: reads/writes · Finance controllers store transactions, budgets, goals, reports, and notifications.
- Insight API → Domain Models: reads/writes · Insight endpoints rely on stored user and finance data.
- Admin API → Domain Models: reads/writes · Admin controls manage configuration, logs, payments, news settings, and funds metadata.
- Job Services → External Integrations: runs · Scheduled jobs trigger email, payment, reporting, and ingestion services.
- Domain Models → MongoDB: persists to · Mongoose models store data in MongoDB.