# patelyash7/money-mingle-client architecture

> Architecture diagram of the GitHub repository patelyash7/money-mingle-client, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-22). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/patelyash7/money-mingle-client
- Repository: https://github.com/patelyash7/money-mingle-client

## Overview

##### Main System Components

A. Frontend Layer:
- Next.js Application (React-based)
- Into three main sections:
- Public/Landing Pages
- Authentication Pages (/(auth) route)
- Dashboard Pages (/(dashboard) route)
- Banking Pages (/(bank) route)

B. Backend Layer:
- API Routes (/api directory)
- Authentication System (NextAuth.js)
- Database Layer (Prisma ORM)
- Email Service Integration (indicated by sendEmail.ts)

C. External Services:
- Banking Integration System
- Email Service Provider
- Database (likely PostgreSQL based on Prisma usage)

##### Component Organization

A. Client-Side Components:
- Landing Components
- Authentication Components
- Dashboard Components
- Wallet Management
- Bank Transfers
- Transaction History
- UI Components Layer

B. Server-Side Components:
- API Routes
- Authentication Services
- Transaction Services
- Bank Integration Services
- Database Services

##### Key Interactions to Highlight

- Authentication Flow
- Transaction Flow
- Bank Account Verification Flow
- Wallet Operations Flow

##### Specific Implementation Details

**Frontend:**
- User Authentication (SignIn/SignUp)
- Bank Account Management
- Wallet Operations
- Transaction History
- Profile Management

**Backend:**
- API Routes
- Authentication Middleware
- Database Operations
- External Service Integrations

##### Data Flow Patterns

- User Authentication Flow
- Bank Transaction Flow
- Wallet Transaction Flow
- P2P Transfer Flow

##### Security Layer

Security components:
- Authentication Middleware
- PIN Verification
- Token Management
- Password Management

##### State Management

Stores from the /store directory:
- User State
- Payment User State
- Transaction State
- Top Friends State

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Frontend
        Landing["Landing Pages"]
        Auth["Authentication Pages"]
        Dashboard["Dashboard Interface"]
        Banking["Banking Interface"]
        Wallet["Wallet Operations"]
        Trans["Transaction Components"]
        UI["UI Components"]
    end

    subgraph API_Layer
        APIRoutes["API Routes"]
        AuthSystem["Authentication System"]
        BankAPI["Banking API"]
        WalletAPI["Wallet API"]
        TransAPI["Transaction API"]
    end

    subgraph Security
        Middleware["Middleware"]
        PinVerification["PIN Verification"]
        PasswordMgmt["Password Management"]
    end

    subgraph State
        UserState["User State"]
        PaymentState["Payment User State"]
        TransState["Transaction State"]
        FriendsState["Top Friends State"]
    end

    subgraph Services
        EmailService["Email Service"]
        Database[(Database)]
        PrismaORM["Prisma ORM"]
        ExternalBank["External Banking Services"]
    end

    %% Frontend Connections
    Landing --> APIRoutes
    Auth --> AuthSystem
    Dashboard --> WalletAPI
    Banking --> BankAPI
    Wallet --> WalletAPI
    Trans --> TransAPI

    %% API Layer Connections
    APIRoutes --> PrismaORM
    AuthSystem --> PrismaORM
    BankAPI --> ExternalBank
    WalletAPI --> PrismaORM
    TransAPI --> PrismaORM

    %% Security Layer
    Middleware --> AuthSystem
    PinVerification --> WalletAPI
    PasswordMgmt --> AuthSystem

    %% State Management
    UserState --> Dashboard
    PaymentState --> Wallet
    TransState --> Trans
    FriendsState --> Dashboard

    %% Services Connections
    PrismaORM --> Database
    AuthSystem --> EmailService
    BankAPI --> EmailService

    %% Styling
    classDef frontend fill:#a8d5ff
    classDef api fill:#98ff98
    classDef security fill:#ffb366
    classDef state fill:#ffff99
    classDef service fill:#ff9999

    class Landing,Auth,Dashboard,Banking,Wallet,Trans,UI frontend
    class APIRoutes,AuthSystem,BankAPI,WalletAPI,TransAPI api
    class Middleware,PinVerification,PasswordMgmt security
    class UserState,PaymentState,TransState,FriendsState state
    class EmailService,Database,PrismaORM,ExternalBank service

    %% Click Events
    click Landing "https://github.com/PatelYash7/money-mingle-client/tree/main/src/components/landing/*"
    click Auth "https://github.com/PatelYash7/money-mingle-client/tree/main/src/app/(auth)/*"
    click Dashboard "https://github.com/PatelYash7/money-mingle-client/tree/main/src/app/(dashboard)/*"
    click Banking "https://github.com/PatelYash7/money-mingle-client/tree/main/src/app/(bank)/*"
    click Wallet "https://github.com/PatelYash7/money-mingle-client/tree/main/src/components/wallet/*"
    click Trans "https://github.com/PatelYash7/money-mingle-client/blob/main/src/components/TransactionCard.tsx"
    click UI "https://github.com/PatelYash7/money-mingle-client/tree/main/src/components/ui/*"
    click AuthSystem "https://github.com/PatelYash7/money-mingle-client/blob/main/src/app/api/auth/[...nextauth]/route.ts"
    click BankAPI "https://github.com/PatelYash7/money-mingle-client/blob/main/src/app/api/create-bankAccount/route.ts"
    click WalletAPI "https://github.com/PatelYash7/money-mingle-client/blob/main/src/app/api/verify-wallet/route.ts"
    click TransAPI "https://github.com/PatelYash7/money-mingle-client/blob/main/src/app/api/get-transactions/route.ts"
    click Middleware "https://github.com/PatelYash7/money-mingle-client/blob/main/src/middleware.ts"
    click PinVerification "https://github.com/PatelYash7/money-mingle-client/blob/main/src/components/enter-pin.tsx"
    click PasswordMgmt "https://github.com/PatelYash7/money-mingle-client/blob/main/src/action/update-password.ts"
    click UserState "https://github.com/PatelYash7/money-mingle-client/blob/main/src/store/user.ts"
    click PaymentState "https://github.com/PatelYash7/money-mingle-client/blob/main/src/store/PaymentUser.ts"
    click TransState "https://github.com/PatelYash7/money-mingle-client/blob/main/src/store/transaction.ts"
    click FriendsState "https://github.com/PatelYash7/money-mingle-client/blob/main/src/store/TopFriends.ts"
    click EmailService "https://github.com/PatelYash7/money-mingle-client/blob/main/src/lib/sendEmail.ts"
    click PrismaORM "https://github.com/PatelYash7/money-mingle-client/blob/main/prisma/schema.prisma"
    click APIRoutes "https://github.com/PatelYash7/money-mingle-client/tree/main/src/app/api/*"
```
