How akbarkhant/wealthflow works
1. WealthFlow is a monorepo with three main boundaries: frontend/ for the client UI, backend/ for the API and business logic, and infra/ for deployment/runtime plumbing. The root Docker Compose files and GitHub workflows indicate the system is meant to run as separate services that are packaged and deployed together.
2. The frontend is a React + Vite single-page application. Its architecture is page-driven (src/pages), with shared layouts (src/layouts), reusable UI components (src/components), global state containers (src/context), and feature hooks/services. The src/api layer centralizes all server calls, so the UI does not talk to backend endpoints directly from pages.
3. The frontend also has a progressive-web-app shape: there is a public service worker (public/sw.js) and a public bootstrap script (public/app.js), which suggests offline or installable behavior. Frontend pages are split into business areas like dashboard, transactions, budgets, goals, reports, AI, auth, and admin.
4. The backend is a Node.js API organized by domain modules under src/modules. Each module typically has its own controller, service, repository, routes, and schema files, which creates a clean separation between HTTP handling, business rules, and database access. This is the main architectural pattern to reflect in a diagram.
5. Core transactional finance flows sit in the transactions, budgets, categories, accounts, users, bills, recurring, and goals modules. These modules collectively implement the financial data model and the user-facing CRUD operations behind the dashboard, history, and category-based views.
6. Analytics and reporting are separate subsystems rather than part of basic CRUD. analytics, insights, reports, and search provide read-optimized views, aggregations, filtering, and derived financial summaries. dashboard-style endpoints likely compose these outputs into higher-level overview data for the UI.
7. Authentication and access control are a distinct cross-cutting boundary. The auth module plus middleware such as auth, authorize, validate, rateLimiter, and contextGuard show that routes are protected, input is validated, and certain actions are role- or context-aware. The README’s JWT/password-hashing focus matches this structure.
8. The backend has explicit asynchronous processing infrastructure. src/queues, transaction workers, AI workers/cron files, Redis config, and cron config indicate background jobs are used for delayed or periodic tasks. This is important for a diagram because some work does not happen in the request-response path.
9. The AI subsystem is its own mini-platform inside the backend. It includes a controller, routes, service, cache, queue, gateway, cron, and specialized helpers for receipts, reports, education, safety, and insights. That suggests AI features are invoked through the API, but heavy or repeatable tasks are offloaded to cache/queue/worker layers.
10. Persistence is centered on PostgreSQL, with explicit SQL migrations and seed scripts under backend/db. The presence of schema.sql, multiple numbered migrations, and dev/test environment files shows a migration-driven database lifecycle rather than ad hoc schema changes.
11. Cross-cutting infrastructure services extend the backend beyond data storage. Config files for mailer, web push, Redis, Sentry, logging, and cron show integrations for email, browser notifications, observability, caching, and scheduled jobs. These are supporting services rather than separate business domains.
12. Deployment is containerized and fronted by Nginx. The repo includes Dockerfiles for both frontend and backend, Compose files for local/prod orchestration, and an infra/nginx directory with an Nginx config. That implies the frontend is served separately from the API, with Nginx likely acting as a reverse proxy and static asset server.
13. The main runtime data flow is: browser UI sends requests through the frontend API layer to backend routes; middleware authenticates/validates/logs them; services apply finance rules; repositories read/write PostgreSQL; then dashboards, reports, search, and AI features return derived views. Background workers and cron jobs feed updates back into the same database/cache/notification channels.
14. Testing is split by layer: backend unit and integration tests cover auth, budgets, bills, transactions, goals, and AI; frontend has its own test harness directory. This reinforces the repo’s layered architecture: UI, API, persistence, and async processing are tested and evolved somewhat independently.
Main entry points: modules Domain modules · App.jsx App shell · server.js Server · pages Pages
Components 21
Frontend
React/Vite SPA, page flows, shared UI, and API client.
- App shell · Bootstraps the client application and route composition.
frontend/src/App.jsx - Routes · Defines client-side page routing and protected/public boundaries.
frontend/src/routes/AppRoutes.jsx - Pages · Business-area screens such as dashboard, transactions, budgets, goals, reports, auth, and admin.
frontend/src/pages - Layouts · Shared shells for public and authenticated areas.
frontend/src/layouts - UI components · Reusable widgets, charts, feedback, import, search, and shell components.
frontend/src/components - Context · Global client state for auth, reports, and transactions.
frontend/src/context - Hooks · Reusable client logic for API access, validation, search, notifications, and import flows.
frontend/src/hooks - API client · Centralized request layer for frontend-to-backend communication.
frontend/src/api - PWA assets · Public bootstrap and service worker support for offline/installable behavior.
frontend/public
Backend
Node API, domain modules, persistence, middleware, and async jobs.
- Server · Node runtime entrypoint and application assembly.
backend/server.js - App core · Wires middleware, routes, and shared backend behavior.
backend/src/app.js - Middleware · Authentication, authorization, validation, rate limiting, caching, logging, and error handling.
backend/src/middleware - Domain modules · Business modules for finance, auth, analytics, reports, search, notifications, and user data.
backend/src/modules - Transactions · Core transaction flow with accounting logic, audit, receipts, and workers.
backend/src/modules/transactions - AI stack · AI controller, service, cache, queue, cron, gateway, and domain helpers.
backend/src/modules/ai - Postgres DB · Schema, migrations, and seeds for relational persistence.
backend/db - Queues & jobs · Redis-backed queues, workers, and scheduled tasks.
backend/src/queues - Configs · Database, Redis, mailer, logging, Sentry, web push, and cron configuration.
backend/src/config
Infra
Containerization, reverse proxy, and repository-level deployment plumbing.
- Compose · Multi-service local and production container orchestration.
docker-compose.yml - Nginx · Edge proxy and static serving configuration for the deployed stack.
infra/nginx/nginx.conf - Dockerfiles · Separate container builds for frontend and backend services.
frontend/Dockerfile
Connections 27
- App shell → Routes: uses · App composition is routed through the client route map.
- Routes → Pages: loads · Routes resolve into page-level business screens.
- Routes → Layouts: wraps · Routes are rendered within public and protected layouts.
- Pages → UI components: composes · Pages assemble shared UI and feature widgets.
- Pages → Context: reads state · Pages consume global auth/report/transaction state.
- Pages → Hooks: uses · Pages rely on shared client hooks for behavior.
- Hooks → API client: calls · Hooks route server interactions through the API layer.
- API client → Server: requests · Frontend server calls target the backend service.
- PWA assets → App shell: boots · Public assets support app startup and PWA behavior.
- Server → App core: initializes · Server entrypoint builds the application runtime.
- App core → Middleware: applies · Requests flow through shared middleware layers.
- App core → Domain modules: mounts · Domain modules are exposed as routes and handlers.
- Domain modules → Transactions: contains · Transactions is the central finance domain.
- Domain modules → AI stack: contains · AI is a dedicated subsystem within the backend.
- Domain modules → Postgres DB: persists to · Modules read and write the PostgreSQL-backed schema.
- Domain modules → Queues & jobs: offloads to · Long-running and periodic work is sent to jobs and queues.
- Domain modules → Configs: uses · Modules depend on shared runtime integrations and config.
- Transactions → Queues & jobs: spawns jobs · Recurring transaction processing is handled asynchronously.
- AI stack → Queues & jobs: queues work · AI processing uses cache, queue, and cron layers.
- AI stack → Configs: uses · AI features depend on Redis, mailer, and other integrations.
- Compose → App shell: orchestrates · Compose packages the client service with the rest of the stack.
- Compose → Server: orchestrates · Compose packages the API service with the rest of the stack.
- Compose → Nginx: fronts · Nginx sits at the edge of the composed deployment.
- Dockerfiles → App shell: builds · Frontend container image packages the SPA.
- Dockerfiles → Server: builds · Backend container image packages the API runtime.
- Nginx → App shell: serves · Nginx serves static frontend assets and entry HTML.
- Nginx → Server: proxies · Nginx forwards API traffic to the backend service.