# vedantshuklaaa/fundora architecture

> Architecture diagram of the GitHub repository vedantshuklaaa/fundora, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-17). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/vedantshuklaaa/fundora
- Repository: https://github.com/vedantshuklaaa/fundora

## Overview

##### Project Type and Purpose
- This is a monolithic full-stack web application built with Next.js (App Router) and Prisma ORM.
- Purpose: a user-centric dashboard for signup/login, viewing balances, sending/receiving transactions, and other user-specific pages.
- Key indicators:
- `app/` folder with React Server and Client Components
- `app/api/` folder with route handlers (login, signup, transactions, dashboard/*)
- `prisma/` folder and `lib/generated/prisma` for DB schema and migrations

##### High-Level Architecture Components
a. Client Browser (React Components)
- Code under `app/` (pages and layouts) and `components/` (UI primitives).
- Tailwind CSS + custom globals for styling.
- Interacts with Next.js Server via page requests and API calls (fetch).
b. Next.js Server
- Routes under `app/page.tsx`, `app/auth/*`, `app/user/*` serve Server/Client Components.
- API routes under `app/api/*` become serverless functions or Node handlers.
- Authentication logic in `lib/auth.ts`.
c. Business Logic & Utilities
- `lib/utils.ts` for shared helper functions.
d. ORM Layer & Database
- Prisma client in `lib/generated/prisma` abstracts SQL.
- `prisma/schema.prisma` defines data models; migrations under `prisma/migrations/`.
- Underlying relational database (e.g., PostgreSQL, MySQL).
e. Deployment & Infra
- Next.js + API routes deployed (e.g., Vercel serverless functions).
- Static assets in `public/`.
- Configs: `next.config.ts`, `tailwind.config.ts`, `postcss.config.mjs`.

##### Relationships and Data Flows
- Browser → Next.js Page Routes: SSR/SSG or RSC requests for UI.
- Browser → Next.js API Routes: fetch/POST for login, signup, transactions, user data.
- API Handlers → lib/auth.ts for JWT/session management.
- API Handlers → Prisma Client → Database for CRUD operations.
- Next.js Server → Static assets (CSS, fonts, images) from `public/`.
- Deployment platform (e.g., Vercel) orchestrates serverless functions and static hosting.

##### Architectural Patterns & Design Principles
- Separation of Concerns:
- UI (React/Server Components) vs. API (Route Handlers) vs. Data (ORM).
- Server Components (Next.js App Router) + Client Components for interactivity.
- API-centric design: each logical feature (signup, login, dashboard/balance) has its own route.
- Infrastructure as Code: Prisma migrations for evolving DB schema.
- Component-driven UI under `components/ui` for reusability.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Client Layer
    subgraph "Client - React UI"
      direction TB
      AL["app/layout.tsx"]:::frontend
      AP["app/page.tsx"]:::frontend
      subgraph "Auth Pages"
        direction TB
        A_L["app/auth/layout.tsx"]:::frontend
        A_LOGIN["app/auth/login/page.tsx"]:::frontend
        A_SIGNUP["app/auth/signup/page.tsx"]:::frontend
      end
      subgraph "User Pages"
        direction TB
        U_L["app/user/layout.tsx"]:::frontend
        U_DASH["app/user/dashboard/page.tsx"]:::frontend
        U_TXN["app/user/transactions/page.tsx"]:::frontend
      end
      subgraph "Main UI Components"
        direction TB
        M_NAV["app/mains/navbar/navbar.tsx"]:::frontend
        M_DASH["app/mains/dashboard/dashboard.tsx"]:::frontend
        M_TXN["app/mains/transactions/transactions.tsx"]:::frontend
      end
      subgraph "UI Primitives"
        direction TB
        UI_DIR["components/ui/"]:::frontend
      end
    end

    %% Static Assets & Styles
    subgraph "Public & Styles"
      direction TB
      STATIC["public/"]:::static
      GLOBALS["app/globals.css"]:::static
      CONFIGS["next.config.ts<br/>tailwind.config.ts<br/>postcss.config.mjs<br/>tsconfig.json"]:::static
    end

    %% Next.js Server Layer
    subgraph "Next.js Server" 
      direction TB
      SERVER_PAGES["Pages (Server & Client Components)"]:::server
      subgraph "API Routes"
        direction TB
        API_LOGIN["app/api/login/route.ts"]:::server
        API_SIGNUP["app/api/signup/route.ts"]:::server
        API_SEND["app/api/sendRecieve/route.ts"]:::server
        API_TXNS["app/api/transactions/route.ts"]:::server
        API_BAL["app/api/dashboard/balance/route.ts"]:::server
        API_PAN["app/api/dashboard/pan/route.ts"]:::server
        API_USER["app/api/user/route.ts"]:::server
        API_UF["app/api/userFetch/route.ts"]:::server
      end
      AUTH["lib/auth.ts"]:::server
      UTILS["lib/utils.ts<br/>lib/db.ts"]:::server
    end

    %% ORM & Database Layer
    subgraph "ORM & Database"
      direction TB
      PRISMA_CLIENT["Prisma Client (lib/generated/prisma)"]:::database
      SCHEMA["prisma/schema.prisma"]:::database
      MIGR["prisma/migrations/"]:::database
      DB["Relational DB"]:::database
    end

    %% Connections
    AL -->|"renders"| SERVER_PAGES
    AP -->|"renders"| SERVER_PAGES
    A_L -->|"renders"| SERVER_PAGES
    U_L -->|"renders"| SERVER_PAGES
    SERVER_PAGES -->|"fetch/Post"| API_LOGIN
    SERVER_PAGES -->|"fetch/Post"| API_SIGNUP
    SERVER_PAGES -->|"fetch/Get"| API_TXNS
    SERVER_PAGES -->|"fetch/Get"| API_BAL
    SERVER_PAGES -->|"fetch/Get"| API_PAN
    SERVER_PAGES -->|"fetch/Get"| API_USER
    API_LOGIN -->|"auth check"| AUTH
    API_SIGNUP -->|"auth check"| AUTH
    API_SEND -->|"auth check"| AUTH
    API_TXNS -->|"auth check"| AUTH
    API_BAL -->|"auth check"| AUTH
    API_PAN -->|"auth check"| AUTH
    API_USER -->|"auth check"| AUTH
    API_UF -->|"auth check"| AUTH
    API_LOGIN -->|"DB ops"| PRISMA_CLIENT
    API_SIGNUP -->|"DB ops"| PRISMA_CLIENT
    API_SEND -->|"DB ops"| PRISMA_CLIENT
    API_TXNS -->|"DB ops"| PRISMA_CLIENT
    API_BAL -->|"DB ops"| PRISMA_CLIENT
    API_PAN -->|"DB ops"| PRISMA_CLIENT
    API_USER -->|"DB ops"| PRISMA_CLIENT
    AUTH -->|"uses"| UTILS
    UTILS -->|"uses"| PRISMA_CLIENT
    PRISMA_CLIENT -->|"runs migrations"| MIGR
    PRISMA_CLIENT -->|"queries"| DB
    STATIC -->|"served by"| SERVER_PAGES

    %% Click events
    click AL "https://github.com/vedantshuklaaa/fundora/blob/main/app/layout.tsx"
    click AP "https://github.com/vedantshuklaaa/fundora/blob/main/app/page.tsx"
    click A_L "https://github.com/vedantshuklaaa/fundora/blob/main/app/auth/layout.tsx"
    click A_LOGIN "https://github.com/vedantshuklaaa/fundora/blob/main/app/auth/login/page.tsx"
    click A_SIGNUP "https://github.com/vedantshuklaaa/fundora/blob/main/app/auth/signup/page.tsx"
    click U_L "https://github.com/vedantshuklaaa/fundora/blob/main/app/user/layout.tsx"
    click U_DASH "https://github.com/vedantshuklaaa/fundora/blob/main/app/user/dashboard/page.tsx"
    click U_TXN "https://github.com/vedantshuklaaa/fundora/blob/main/app/user/transactions/page.tsx"
    click M_NAV "https://github.com/vedantshuklaaa/fundora/blob/main/app/mains/navbar/navbar.tsx"
    click M_DASH "https://github.com/vedantshuklaaa/fundora/blob/main/app/mains/dashboard/dashboard.tsx"
    click M_TXN "https://github.com/vedantshuklaaa/fundora/blob/main/app/mains/transactions/transactions.tsx"
    click UI_DIR "https://github.com/vedantshuklaaa/fundora/tree/main/components/ui/"
    click API_LOGIN "https://github.com/vedantshuklaaa/fundora/blob/main/app/api/login/route.ts"
    click API_SIGNUP "https://github.com/vedantshuklaaa/fundora/blob/main/app/api/signup/route.ts"
    click API_SEND "https://github.com/vedantshuklaaa/fundora/blob/main/app/api/sendRecieve/route.ts"
    click API_TXNS "https://github.com/vedantshuklaaa/fundora/blob/main/app/api/transactions/route.ts"
    click API_BAL "https://github.com/vedantshuklaaa/fundora/blob/main/app/api/dashboard/balance/route.ts"
    click API_PAN "https://github.com/vedantshuklaaa/fundora/blob/main/app/api/dashboard/pan/route.ts"
    click API_USER "https://github.com/vedantshuklaaa/fundora/blob/main/app/api/user/route.ts"
    click API_UF "https://github.com/vedantshuklaaa/fundora/blob/main/app/api/userFetch/route.ts"
    click AUTH "https://github.com/vedantshuklaaa/fundora/blob/main/lib/auth.ts"
    click UTILS "https://github.com/vedantshuklaaa/fundora/blob/main/lib/utils.ts"
    click PRISMA_CLIENT "https://github.com/vedantshuklaaa/fundora/blob/main/lib/generated/prisma/index.js"
    click SCHEMA "https://github.com/vedantshuklaaa/fundora/blob/main/prisma/schema.prisma"
    click MIGR "https://github.com/vedantshuklaaa/fundora/tree/main/prisma/migrations/"
    click STATIC "https://github.com/vedantshuklaaa/fundora/tree/main/public/"
    click GLOBALS "https://github.com/vedantshuklaaa/fundora/blob/main/app/globals.css"

    %% Styles
    classDef frontend fill:#cfe8ff,stroke:#0366d6,stroke-width:1px
    classDef server fill:#d1f8d1,stroke:#228B22,stroke-width:1px
    classDef database fill:#ffe1a8,stroke:#FF8C00,stroke-width:1px
    classDef static fill:#f0f0f0,stroke:#666666,stroke-width:1px
```
