# vigneshpillai2004/ai-finance-platform-main architecture

> Architecture diagram of the GitHub repository vigneshpillai2004/ai-finance-platform-main, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-04). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/vigneshpillai2004/ai-finance-platform-main
- Repository: https://github.com/vigneshpillai2004/ai-finance-platform-main

## Overview

##### Main Components
- Client / Browser – End-users interact via a web browser.
- Frontend Application (Next.js):
- Uses the "app" directory that includes routes and layouts for (auth) and (main) sections.
- Contains UI components (in the "components" folder) and styling (tailwind.config.js, globals.css) to build the user interface.
- Business Logic Layer:
- The "actions" folder includes files like account.js, budget.js, dashboard.js, pdftransaction.js, etc. These files encapsulate key business use cases such as user account management, budget handling, dashboard information, tax calculations, and email sending.
- The "hooks" support client-side data fetching (e.g., use-fetch.js).
- API Endpoints:
- Located under the "app/api" directory (with routes for seed operations and integration with Inngest), they serve as server-side entry points for asynchronous tasks.
- Database Layer:
- The "prisma" folder and related migration files indicate usage of Prisma ORM to manage the database schema and migrations.
- External Services & Utilities:
- Email templates in the "emails" folder serve for email notifications.
- Integration libraries under "lib/inngest", "lib/prisma.js", and other utility scripts indicate connections to external services (like transactional email and Inngest for serverless function orchestration).

##### Out Relationships and Data Flow
- A directional flow starting from the Client (browser) sending requests to the Next.js frontend (handling authentication, navigation, and user interactions).
- From the UI, the front-end components can call API endpoints or trigger actions (via the "actions" files).
- These actions implement core business logic and interact with the database (Prisma) as well as external APIs (for email sending or event handling).
- API endpoints (e.g., for seeding and Inngest events) are another layer that triggers similar backend processes while handling asynchronous tasks.

##### Architectural Patterns and Key Technologies
- Full-Stack Next.js Architecture:
- Client-side and server-side rendering with built-in routing.
- Clear separation between authentication routes (handled in the (auth) directory) and main application routes.
- Modular Design:
- Clearly segmented folders for actions, API endpoints, and UI components promote separation of concerns.
- Integration with Third-Party Tools:
- Inngest integration for orchestrating event-driven functions.
- Prisma for database ORM.
- UI Component Reusability:
- A dedicated "components/ui" folder suggests a custom UI library with standardized alert, button, card, etc.

##### Final Detailed Implementation
- Next.js client and server aspects under one umbrella but clearly show the boundary between the UI (components in the "app" directory) and backend processing (actions and API files).
- That the Prisma-managed database underpins dynamic data handling.
- Every file group (e.g., actions, API routes, prisma migrations) is noted and connected appropriately, capturing dependencies and data movement.

## Diagram (Mermaid)

```mermaid
graph TD
    Client["Client (Browser)"]:::client

    subgraph "Frontend Layer"
        FE_App["Frontend Application (Next.js App)"]:::frontend
        Auth["Authentication Routes"]:::frontend
        MainRoutes["Main Application Routes"]:::frontend
        UI["UI Components"]:::frontend
        UI_Ext["UI Components (ui)"]:::frontend
    end

    subgraph "Business Logic & API Layer"
        Actions["Business Logic (Actions)"]:::business
        Hooks["Client-Side Data Fetching Hooks"]:::business
        API["API Endpoints (Inngest & Seed)"]:::api
    end

    subgraph "Data & External Services"
        DB["Prisma ORM Database"]:::database
        Email["External Email Templates"]:::external
        Inngest["Inngest Service"]:::external
        PrismaUtil["Prisma Utility"]:::external
    end

    Client -->|"sendsRequest"| FE_App
    FE_App -->|"authRoutes"| Auth
    FE_App -->|"mainRoutes"| MainRoutes
    FE_App -->|"rendersUI"| UI
    UI -->|"fetchData"| Hooks
    FE_App -->|"triggersActions"| Actions
    FE_App -->|"callsAPI"| API
    Actions -->|"dbOps"| DB
    API -->|"dbOps"| DB
    Actions -->|"sendsEmail"| Email
    Actions -->|"orchestratesEvents"| Inngest
    Actions -->|"usesUtils"| PrismaUtil

    click FE_App "https://github.com/vigneshpillai2004/ai-finance-platform-main/tree/main/ai-finance-platform-main/app"
    click Auth "https://github.com/vigneshpillai2004/ai-finance-platform-main/tree/main/ai-finance-platform-main/app/(auth)"
    click MainRoutes "https://github.com/vigneshpillai2004/ai-finance-platform-main/tree/main/ai-finance-platform-main/app/(main)"
    click UI "https://github.com/vigneshpillai2004/ai-finance-platform-main/tree/main/ai-finance-platform-main/components"
    click UI_Ext "https://github.com/vigneshpillai2004/ai-finance-platform-main/tree/main/ai-finance-platform-main/components/ui"
    click Actions "https://github.com/vigneshpillai2004/ai-finance-platform-main/tree/main/ai-finance-platform-main/actions"
    click Hooks "https://github.com/vigneshpillai2004/ai-finance-platform-main/tree/main/ai-finance-platform-main/hooks"
    click API "https://github.com/vigneshpillai2004/ai-finance-platform-main/tree/main/ai-finance-platform-main/app/api"
    click DB "https://github.com/vigneshpillai2004/ai-finance-platform-main/tree/main/ai-finance-platform-main/prisma"
    click Email "https://github.com/vigneshpillai2004/ai-finance-platform-main/tree/main/ai-finance-platform-main/emails"
    click Inngest "https://github.com/vigneshpillai2004/ai-finance-platform-main/tree/main/ai-finance-platform-main/lib/inngest"
    click PrismaUtil "https://github.com/vigneshpillai2004/ai-finance-platform-main/blob/main/ai-finance-platform-main/lib/prisma.js"

    classDef client fill:#ececec,stroke:#333,stroke-width:2px;
    classDef frontend fill:#ccf,stroke:#333,stroke-width:2px;
    classDef business fill:#cfc,stroke:#333,stroke-width:2px;
    classDef api fill:#fcf,stroke:#333,stroke-width:2px;
    classDef database fill:#fdc,stroke:#333,stroke-width:2px;
    classDef external fill:#f9c,stroke:#333,stroke-width:2px;
```
