How manan145/financius works
Project Type and Purpose
• This is a full-stack web application built with Next.js and React, using Prisma + PostgreSQL for persistence, Clerk for authentication, Inngest for background jobs, Arcjet for request protection, and external AI (Gemini API) and email (Resend) services.
• The app consolidates account and transaction data, provides budgeting tools, AI-driven receipt scanning and coaching, and real-time alerts.
Main Architectural Components
a. Client (Browser)
• Next.js App Router pages and React components under app/ and components/
• UI library: Tailwind CSS + shadcn/ui + Recharts for charts
• Sign-in / Sign-up flows via Clerk’s front-end SDK
b. Server (Next.js Node Runtime)
• Server Actions in actions/ for data mutations and reads
• API Routes in app/api/ for coach-chat, receipt scanning, seeding, background triggers
• Middleware (middleware.js) integrating Arcjet for request protection
• Background job handlers (Inngest functions) in lib/inngest/ and invoked by API or scheduled events
c. Data Access Layer
• Prisma ORM (prisma/schema.prisma, migrations)
• Shared client in lib/prisma.js
d. Persistence
• PostgreSQL database, accessed via Prisma
e. Authentication & Authorization
• Clerk as the identity provider (SSR and client-side tokens)
f. External Services
• Gemini API for AI features (coach, receipt OCR)
• Resend API for email alerts
• Inngest for durable background job scheduling and execution
• Arcjet for malicious request protection
Relationships and Data Flows
• User → Next.js Frontend: UI rendering, form inputs, navigations
• Frontend → Server Actions / API Routes: fetch or mutate data (accounts, transactions, budgets, alerts, AI requests)
• Server → Prisma → PostgreSQL: CRUD operations on Users, Accounts, Transactions, Budgets, AlertSettings
• Server → External AI / Email APIs:
• Send receipt image to Gemini OCR endpoint
• Send user chat context to Gemini chat endpoint
• Send alert emails via Resend
• Server → Inngest: enqueue or trigger background jobs (e.g., recurring transactions, scheduled budgets alert)
• Inngest Worker → Prisma / External APIs: process jobs asynchronously
Architectural Patterns and Principles
• Layered Architecture: UI Layer (Next.js pages/components), Business Logic Layer (server actions, API routes), Data Layer (Prisma), Infrastructure Layer (DB, external services)
• Component-Driven UI: reusable UI primitives under components/ui/ and domain widgets in dashboard/account/transaction folders
• Server-Side Rendering & Server Actions: fetch data close to UI for performance and security
• Progressive Disclosure: advanced settings available via on-demand UI components
• Background Processing: Inngest decouples long-running jobs from request/response cycle
Final Checklist
• All major components (UI, Server Actions, API Routes, DB, Background Jobs, External Services) included
• Clear separation of sync vs. async flows