How urvashi73/expense-tracker-clean works
Project type and purpose
• This is a full-stack web application (“FinTrack”) built on Next.js.
• It provides users with transaction management (CRUD), AI-powered receipt scanning, budget tracking, dynamic charts, and automated email alerts/reports.
File structure
• Top-level directories:
• expense/app – Next.js “app” router with subfolders for (auth) and (main) routes
• expense/app/api – serverless functions (Inngest workflows, seed endpoints)
• expense/components – reusable UI components and primitives
• expense/lib – shared libraries (Prisma client, Inngest client, auth checks, utilities)
• expense/prisma – schema & migrations for database
• expense/emails – JSX email templates
• expense/actions – domain logic used by UI & API
• Config & build files: next.config.mjs, tsconfig/jsconfig, eslint, postcss, package.json
• Background job runner using Inngest (expense/app/api/inngest/route.js & expense/lib/inngest)
Insights from the README
• Tech stack: Next.js (React + server components), Prisma (ORM), Inngest (background tasks), AI receipt scanner, email notifications.
• Key features: transaction CRUD, charts (Pie/Bar), budget alerts, monthly reports.
Main components and their relationships
a. Frontend (Next.js “app” router)
• Renders pages under expense/app/(auth) & expense/app/(main)
• Uses React components (expense/components & expense/app/**/_components)
• Invokes client-side hooks (use-fetch) to call internal APIs
b. API Layer (Next.js serverless routes)
• expense/app/api/* – handles HTTP requests, calls actions and lib functions
• Inngest workflow endpoints handle background tasks (send-email, seed)
c. Business Logic (expense/actions & expense/lib)
• Encapsulates transaction, account, budget, dashboard data processing
• Shared by both API handlers and client actions
d. Database (PostgreSQL or MySQL via Prisma)
• Schema defined in expense/prisma/schema.prisma
• Accessed via expense/lib/prisma.js
e. Background Worker (Inngest)
• Orchestrates async tasks: budget-alert emails, monthly report emails, receipt OCR processing
• Invoked by scheduled events or API triggers
f. External Services
• Email provider (SMTP or transactional service)
• AI/OCR service for receipt scanning (could be a third-party API)
Architectural patterns and design principles
• Separation of concerns: clear split between UI, API, business logic, and data layers
• Serverless functions for on-demand and scheduled workloads (Inngest)
• Prisma ORM for type-safe, centralized data access
• React Server Components (Next.js app router) for SEO and performance
• Shared “actions” directory enabling DRY logic reuse between frontend and backend