How anshraz27/aifinancialassistant works
1. Overall shape
- FinScope is split into two main deployable parts: a frontend SPA and a backend API.
- The frontend handles the user experience for landing, auth, dashboards, and finance management; the backend owns authentication, business logic, persistence, and notifications.
2. Frontend boundary
- The frontend is a React app built with Vite and styled with Tailwind CSS.
- It has a public marketing/landing experience (LandingPage, HeroSection, FeaturesSection, etc.) and a private app experience (DashboardPage, BudgetPage, TransactionsPage, InvestmentsPage, ReportsPage, settings/profile pages).
3. Authenticated UI flow
- ProtectedRoute is the main client-side boundary between public and logged-in areas.
- LoginPage and SignupPage feed user credentials into the backend, after which the authenticated pages consume API data through the frontend’s API client.
4. Frontend data access
- frontend/services/api.js is the central HTTP boundary from UI to backend.
- This layer is where the SPA likely attaches auth tokens and calls the REST endpoints used by dashboard, transaction, budget, report, and investment screens.
5. Backend entry and application wiring
- backend/server.js appears to be the process entrypoint, while backend/server/app.js is the Express application setup.
- This separation usually means server.js starts the process and app.js configures middleware, route registration, and database connectivity.
6. Backend API surface
- The backend is organized around feature-based controllers and routes: auth, budget, dashboard, investment, report, and transaction.
- This structure suggests a REST API where each domain has its own request handling and URL namespace.
7. Domain model and persistence
- The data model layer is centered on four MongoDB-backed entities: User, Transaction, Budget, and Investment.
- These models are the core persistence boundary for the app’s finance data and support the dashboard and reporting aggregates.
8. Authentication and security
- Authentication is implemented with JWT-based auth, supported by authController, authRoute, authentication.js, and middleware in auth.js / authMiddleware.js.
- The likely flow is: user logs in or signs up, backend issues a token, frontend stores/sends it, and protected routes validate it before allowing access.
9. Financial workflows
- Transactions are the primary write path for income and expenses, budgets represent category limits, investments are tracked separately, and dashboards/reports are read-heavy aggregation layers.
- dashboardController and reportController likely summarize stored transactions and budgets into user-facing metrics like balance, monthly totals, and progress indicators.
10. Notifications and external services
- backend/server/utils/emailService.js is the explicit integration point for email alerts, and the README says it is used for budget threshold notifications.
- This makes email the main external service boundary in the repository; MongoDB is the persistence dependency implied by the Mongoose-style model layout.
11. Feature alignment with the UI
- The page structure mirrors the backend domains closely: transaction pages map to transaction APIs, budget pages to budget APIs, and reports/dashboard pages to aggregate endpoints.
- This one-to-one mapping makes the architecture easy to diagram as “UI screens → API controllers/routes → models/database.”
12. Notable implementation gap
- The README advertises AI receipt scanning / OCR, but there is no dedicated OCR or AI module visible in the file tree.
- For an architecture diagram, treat OCR as a product feature mentioned in documentation, but not as a clearly isolated subsystem in the current codebase snapshot.
Main entry points: app.js App Setup · User.js Mongo Models · api.js API Client · main.jsx SPA
Components 18
Frontend
React SPA with public marketing pages and authenticated finance workflows.
- SPA · Client application shell and routing for the user-facing product.
frontend/src/main.jsx - Landing · Public landing experience with hero, features, benefits, testimonials, and CTA sections.
frontend/src/components/LandingPage.jsx - Auth Pages · Credential entry screens for login and account creation.
frontend/src/pages/LoginPage.jsx - Protected Route · Client-side boundary separating public pages from the authenticated app.
frontend/src/components/ProtectedRoute.jsx - App Views · Private dashboard, budget, transactions, investments, reports, profile, and settings screens.
frontend/src/pages/DashboardPage.jsx - Income/Expense/Investments · Dedicated forms for creating financial records that feed the main app views.
frontend/src/pages/AddExpensePage.jsx - API Client · Central frontend boundary for calling backend REST endpoints and handling auth-aware requests.
frontend/services/api.js
Backend
Express API with auth, domain controllers, persistence, and notifications.
- Server Entry · Process startup entry that launches the backend runtime.
backend/server.js - App Setup · Express application wiring for middleware, routes, and core server configuration.
backend/server/app.js - Auth API · JWT-based signup, login, and token validation flow.
backend/server/controllers/authController.js - Budget API · Budget CRUD and threshold-related domain handling.
backend/server/controllers/budgetController.js - Dashboard API · Read-heavy summary endpoints for balances, trends, and progress metrics.
backend/server/controllers/dashboardController.js - Investment API · Investment tracking endpoints and related domain logic.
backend/server/controllers/investmentController.js - Report API · Reporting and analytics endpoints derived from stored finance data.
backend/server/controllers/reportController.js - Transaction API · Primary income and expense write path plus transaction retrieval.
backend/server/controllers/transactionController.js - Mongo Models · Core persistence entities for users, transactions, budgets, and investments.
backend/server/models/User.js - Auth Middleware · Request protection and token verification for secured backend routes.
backend/server/middleware/authMiddleware.js - Email Alerts · Outbound email integration used for budget threshold notifications.
backend/server/utils/emailService.js
Connections 22
- SPA → Landing: renders · Public shell renders landing and marketing content.
- SPA → Auth Pages: routes to · Handles login and signup entry points.
- SPA → Protected Route: guards · Separates authenticated screens from public pages.
- Protected Route → App Views: allows access · Unlocked users reach private finance views.
- App Views → API Client: fetches data · Authenticated pages consume backend data through the shared client.
- Income/Expense/Investments → API Client: submits · Entry forms create transactions, budgets, and investments through the API client.
- Auth Pages → API Client: authenticates via · Login and signup calls flow through the HTTP client.
- API Client → App Setup: calls · SPA reaches backend REST endpoints through the application server.
- Server Entry → App Setup: starts · Process entry boots the Express app.
- App Setup → Auth API: registers · App wiring mounts auth routes and controllers.
- App Setup → Budget API: registers · Budget API is mounted under its route namespace.
- App Setup → Dashboard API: registers · Dashboard summary endpoints are exposed by the app.
- App Setup → Investment API: registers · Investment routes and handlers are mounted.
- App Setup → Report API: registers · Report endpoints are exposed by the backend.
- App Setup → Transaction API: registers · Transaction routes are wired into the Express app.
- Auth API → Auth Middleware: protects with · JWT validation middleware secures authenticated paths.
- Budget API → Mongo Models: persists with · Budget operations read and write MongoDB-backed models.
- Dashboard API → Mongo Models: aggregates · Dashboard summaries are computed from stored finance entities.
- Investment API → Mongo Models: persists with · Investment operations use the data model layer.
- Report API → Mongo Models: analyzes · Reports derive metrics from persisted records.
- Transaction API → Mongo Models: persists with · Transactions are the primary write path into the database models.
- Budget API → Email Alerts: triggers · Budget threshold events send email alerts.