How swayam-thecoder/spendwise works
SpendWise is a personal-finance application for managing expenses, categories, monthly budgets, and dashboard analytics, with account, session, and email-verification workflows. The main flow is a user using the frontend to submit authenticated requests to the API; route handlers validate and dispatch domain operations, which read or write PostgreSQL through Prisma. The README is empty, so capabilities are inferred from the source index and tree. Frontend-to-API wiring and unsampled service relationships are not shown; those links are omitted rather than assumed.
Main entry points: prisma.js Prisma client · app.js Express API · auth.middleware.js Auth middleware · auth.service.js Account and sessions
Components 26
Web application
- Finance screens
frontend/src/app/(dashboard)/dashboard/page.tsx - Sign-in screens
frontend/src/app/(auth)/login/page.tsx - API client
frontend/src/lib/api/client.ts - Domain clients
frontend/src/services/expense.service.ts
API and access
- Express API
backend/app.js - Auth routes
backend/routes/auth.routes.js - Expense routes
backend/routes/expense.routes.js - Category routes
backend/routes/category.routes.js - Budget routes
backend/routes/budget.routes.js - Dashboard routes
backend/routes/dashboard.routes.js - Auth middleware
backend/middleware/auth.middleware.js
Finance domains
- Expense handlers
backend/controllers/expense.controller.js - Expense operations
backend/services/expense.service.js - Category handlers
backend/controllers/category.controller.js - Category operations
backend/services/category.service.js - Budget handlers
backend/controllers/budget.controller.js - Budget calculations
backend/services/budget.service.js - Dashboard handlers
backend/controllers/dashboard.controller.js - Analytics summaries
backend/services/dashboard.service.js
Identity services
- Auth handlers
backend/controllers/auth.controller.js - Account and sessions
backend/services/auth.service.js - Email delivery
backend/services/email.service.js - Token utilities
backend/utils/token.js
Persistence
- Prisma client
backend/config/prisma.js - PostgreSQL
Other components
- Finance user
Connections 35
- Finance user → Finance screens: uses
- Finance user → Sign-in screens: signs in
- Finance screens → API client: requests
- Sign-in screens → API client: authenticates
- Domain clients → API client: uses
- Express API → Auth routes: mounts
backend/app.js - Express API → Expense routes: mounts
backend/app.js - Express API → Category routes: mounts
backend/app.js - Express API → Budget routes: mounts
backend/app.js - Express API → Dashboard routes: mounts
backend/app.js - Auth routes → Auth handlers: dispatches
backend/routes/auth.routes.js - Auth routes → Auth middleware: applies
backend/routes/auth.routes.js - Expense routes → Auth middleware: applies
backend/routes/expense.routes.js - Category routes → Auth middleware: applies
backend/routes/category.routes.js - Budget routes → Auth middleware: applies
backend/routes/budget.routes.js - Dashboard routes → Auth middleware: applies
backend/routes/dashboard.routes.js - Expense routes → Expense handlers: dispatches
backend/routes/expense.routes.js - Category routes → Category handlers: dispatches
backend/routes/category.routes.js - Budget routes → Budget handlers: dispatches
backend/routes/budget.routes.js - Dashboard routes → Dashboard handlers: dispatches
backend/routes/dashboard.routes.js - Auth handlers → Account and sessions: calls
backend/controllers/auth.controller.js - Auth handlers → Token utilities: generates tokens
backend/controllers/auth.controller.js - Account and sessions → Token utilities: uses
backend/services/auth.service.js - Account and sessions → Email delivery: sends mail
backend/services/auth.service.js - Expense handlers → Expense operations: calls
backend/controllers/expense.controller.js - Category handlers → Category operations: calls
backend/controllers/category.controller.js - Budget handlers → Budget calculations: calls
backend/controllers/budget.controller.js - Dashboard handlers → Analytics summaries: calls
backend/controllers/dashboard.controller.js - Account and sessions → Prisma client: queries
backend/services/auth.service.js - Expense handlers → Prisma client: queries
- Expense operations → Prisma client: queries
backend/services/expense.service.js - Category operations → Prisma client: queries
backend/services/category.service.js - Budget calculations → Prisma client: queries
backend/services/budget.service.js - Analytics summaries → Prisma client: queries
backend/services/dashboard.service.js - Prisma client → PostgreSQL: reads and writes