# raj2201641540078/finaura-finance-management-system architecture

> Architecture diagram of the GitHub repository raj2201641540078/finaura-finance-management-system, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-11-20). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/raj2201641540078/finaura-finance-management-system
- Repository: https://github.com/raj2201641540078/finaura-finance-management-system

## Overview

##### Project type and purpose
- This is a full-stack, server-rendered React application built on Next.js (App Router).
- It implements a personal finance/dashboard tool: user sign-in/up, account overviews, transaction tracking, budget progress, receipt scanning, and email notifications.

##### File structure
- **app/** – Next.js App Router folder containing route-based React components:
- `(auth)` for authentication pages
- `(main)` for protected routes: dashboard, account details, transactions
- `api/inngest/route.js` – serverless API route for Inngest webhook
- `lib/schema.js` – Zod or similar schema definitions
- **actions/** – server-side “action” handlers invoked from the front end or Inngest functions (accounts, budget, dashboard, send-email, transaction, seed)
- **components/** & **components/ui/** – reusable React UI components (buttons, tables, drawers, etc.)
- **lib/** – shared utility modules:
- `prisma.js` – Prisma client setup
- `inngest/` – Inngest client and function definitions
- `arcjet.js`, `checkUser.js`, `utils.js`
- **prisma/** – database schema and migration scripts (models for User, Account, Transaction, Budget, etc.)
- **emails/** – JSX templates for transactional emails
- **hooks/** – custom React hooks (e.g., data fetching)
- **middleware.js** – Next.js middleware for auth/session checks
- **next.config.mjs**, **postcss.config.mjs**, **eslint.config.mjs** – project configuration

##### README for additional insights
- Confirms a standard Next.js app with SSR/ISR and optimized font loading.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Frontend Layer
    subgraph "Frontend Layer"
        direction TB
        Browser["Browser Client"]:::frontend
        subgraph "Authentication Pages"
            direction TB
            SignInPage["Sign-In Page"]:::frontend
            SignUpPage["Sign-Up Page"]:::frontend
        end
        subgraph "Protected Main Routes"
            direction TB
            DashboardPage["Dashboard Page"]:::frontend
            AccountPage["Account Details Page"]:::frontend
            TransactionPage["Transaction Create Page"]:::frontend
        end
    end

    %% Backend Layer
    subgraph "Next.js Server (Serverless Functions)" 
        direction TB
        Server["Next.js Server"]:::backend
        Middleware["Auth Middleware"]:::utility
        subgraph "API Routes & Actions"
            direction TB
            APIInngest["Inngest Webhook Route"]:::backend
            accountsAction["Accounts Action"]:::backend
            budgetAction["Budget Action"]:::backend
            dashboardAction["Dashboard Action"]:::backend
            transactionAction["Transaction Action"]:::backend
            sendEmailAction["Send-Email Action"]:::backend
            seedAction["Seed Action"]:::backend
        end
        Schema["Zod Schemas"]:::utility
        PrismaClient["Prisma Client"]:::backend
        subgraph "Lib Utilities"
            direction TB
            InngestClient["Inngest Client"]:::backend
            InngestFunctions["Inngest Functions"]:::backend
            Arcjet["arcjet.js"]:::utility
            CheckUser["checkUser.js"]:::utility
            Utils["utils.js"]:::utility
        end
        ComponentsUI["UI Components"]:::frontend
        Components["Misc Components"]:::frontend
        HookUseFetch["use-fetch Hook"]:::frontend
    end

    %% Background Worker
    subgraph "Background Processing"
        direction TB
        Worker["Inngest Worker"]:::worker
    end

    %% Data Layer
    subgraph "Database Layer"
        direction TB
        Database["Database (PostgreSQL/MySQL)"]:::database
        PrismaSchema["prisma/schema.prisma"]:::database
        Migrations["prisma/migrations"]:::database
    end

    %% External Services
    subgraph "External Services"
        direction TB
        EmailService["Email Service"]:::external
        Storage["Receipt Storage (optional)"]:::external
    end

    %% Flows
    Browser -->|"GET/POST pages & API calls"| Server
    Server -->|uses Middleware| Middleware
    Server -->|"Prisma queries"| Database
    Server -->|"Enqueue job"| Worker
    Worker -->|"Execute task & send email"| EmailService
    Worker -->|"Store images"| Storage

    %% Click Events
    click SignInPage "https://github.com/raj2201641540078/finaura-finance-management-system/blob/main/app/(auth)/sign-in/[[...sign-in]]/page.jsx"
    click SignUpPage "https://github.com/raj2201641540078/finaura-finance-management-system/blob/main/app/(auth)/sign-up/[[...sign-up]]/page.jsx"
    click DashboardPage "https://github.com/raj2201641540078/finaura-finance-management-system/blob/main/app/(main)/dashboard/page.jsx"
    click AccountPage "https://github.com/raj2201641540078/finaura-finance-management-system/blob/main/app/(main)/account/[id]/page.jsx"
    click TransactionPage "https://github.com/raj2201641540078/finaura-finance-management-system/blob/main/app/(main)/transaction/create/page.jsx"
    click APIInngest "https://github.com/raj2201641540078/finaura-finance-management-system/blob/main/app/api/inngest/route.js"
    click accountsAction "https://github.com/raj2201641540078/finaura-finance-management-system/blob/main/actions/accounts.js"
    click budgetAction "https://github.com/raj2201641540078/finaura-finance-management-system/blob/main/actions/budget.js"
    click dashboardAction "https://github.com/raj2201641540078/finaura-finance-management-system/blob/main/actions/dashboard.js"
    click transactionAction "https://github.com/raj2201641540078/finaura-finance-management-system/blob/main/actions/transaction.js"
    click sendEmailAction "https://github.com/raj2201641540078/finaura-finance-management-system/blob/main/actions/send-email.js"
    click seedAction "https://github.com/raj2201641540078/finaura-finance-management-system/blob/main/actions/seed.js"
    click Schema "https://github.com/raj2201641540078/finaura-finance-management-system/blob/main/app/lib/schema.js"
    click PrismaClient "https://github.com/raj2201641540078/finaura-finance-management-system/blob/main/lib/prisma.js"
    click InngestClient "https://github.com/raj2201641540078/finaura-finance-management-system/blob/main/lib/inngest/client.js"
    click InngestFunctions "https://github.com/raj2201641540078/finaura-finance-management-system/blob/main/lib/inngest/functions.js"
    click Arcjet "https://github.com/raj2201641540078/finaura-finance-management-system/blob/main/lib/arcjet.js"
    click CheckUser "https://github.com/raj2201641540078/finaura-finance-management-system/blob/main/lib/checkUser.js"
    click Utils "https://github.com/raj2201641540078/finaura-finance-management-system/blob/main/lib/utils.js"
    click HookUseFetch "https://github.com/raj2201641540078/finaura-finance-management-system/blob/main/hooks/use-fetch.jsx"
    click ComponentsUI "https://github.com/raj2201641540078/finaura-finance-management-system/tree/main/components/ui"
    click Components "https://github.com/raj2201641540078/finaura-finance-management-system/tree/main/components"
    click PrismaSchema "https://github.com/raj2201641540078/finaura-finance-management-system/blob/main/prisma/schema.prisma"
    click Migrations "https://github.com/raj2201641540078/finaura-finance-management-system/tree/main/prisma/migrations"
    click EmailService "https://github.com/raj2201641540078/finaura-finance-management-system/blob/main/emails/template.jsx"
    click Middleware "https://github.com/raj2201641540078/finaura-finance-management-system/blob/main/middleware.js"

    %% Styles
    classDef frontend fill:#cce5ff,stroke:#4682b4,stroke-width:1px
    classDef backend fill:#d4edda,stroke:#28a745,stroke-width:1px
    classDef worker fill:#ffe5b4,stroke:#ff8c00,stroke-width:1px
    classDef database fill:#f0f0f0,stroke:#6c757d,stroke-width:1px
    classDef external fill:#e2e3e5,stroke:#6c757d,stroke-width:1px
    classDef utility fill:#fef9c3,stroke:#d4b106,stroke-width:1px
```
