# kunal12kumar/sahayakosh architecture

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

- Interactive diagram: https://gitdiagram.com/kunal12kumar/sahayakosh
- Repository: https://github.com/kunal12kumar/sahayakosh

## Overview

##### Project type and purpose
- This is a monolithic, full-stack Next.js application that provides a web portal for borrowers and lenders.
- The purpose is to offer landing pages, user authentication (both borrower and lender), dashboards, loan application and loan opportunity flows, backed by a MongoDB database and Cloudinary for media.

##### File structure
- Top-level files:
- package.json, package-lock.json: Node dependencies
- next.config.mjs, jsconfig.json, eslint.config.mjs: Next.js and code-style configs
- public/: static assets (images, etc.)
- src/app: Next.js App Router directories
- Landingpage (Aboutus, HowItWork, Review, Tutorial, contactus, globe, slideronfrontpage) – public UI pages
- auth: login and multi-step registration flows for borrower & lender
- api/authenticate: Next.js Serverless API routes for borrowerlogin, borrowersignup, lenderlogin, lendersignup
- borrower / lender dashboards, loanapplication, loanopportunity, root page
- layout.js, globals.css: app-wide layout and styling
- src/components/ui: reusable UI components (carousel, timeline, navbar, etc.)
- src/data: static JSON (e.g., globe.json)
- src/dbconfig: MongoDB configuration (mongodbconfig.js)
- src/models: Mongoose schemas (borrowerregistrationschema.js, lenderschema.js)
- src/lib: utility code (cloudinary integration, helper functions)

##### README
- Confirms it’s a Next.js app bootstrapped with create-next-app.
- Standard dev commands, Next.js font optimization, and Vercel deployment.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Client Layer
    Browser["Browser / Client"]:::client

    %% Presentation Layer
    subgraph "Presentation Layer"
        direction TB
        LandingUI["Landing Pages UI"]:::presentation
        AuthUI["Authentication UI Flow"]:::presentation
        BorrowerDash["Borrower Dashboard Page"]:::presentation
        LenderDash["Lender Dashboard Page"]:::presentation
        LoanAppUI["Loan Application Flow UI"]:::presentation
        LoanOppUI["Loan Opportunity Flow UI"]:::presentation
        UIComponents["Reusable UI Components"]:::presentation
        StaticData["Static Data (Globe)"]:::presentation
    end

    %% API Layer
    subgraph "API Routes Layer"
        direction TB
        BorrowerLogin["Borrower Login API"]:::api
        BorrowerSignup["Borrower Signup API"]:::api
        LenderLogin["Lender Login API"]:::api
        LenderSignup["Lender Signup API"]:::api
    end

    %% Business Logic Layer
    subgraph "Business Logic Layer"
        direction TB
        Utils["Utility Functions Module"]:::business
        CloudinaryModule["Cloudinary Integration Module"]:::business
    end

    %% Data Layer
    subgraph "Data Layer"
        direction TB
        DBConfig["MongoDB Configuration"]:::data
        BorrowerModel["Mongoose Model - Borrower Registration"]:::data
        LenderModel["Mongoose Model - Lender Schema"]:::data
        MongoDB["MongoDB Database"]:::data
    end

    %% External Services
    Cloudinary["Cloudinary Service"]:::external

    %% Connections
    Browser --> LandingUI
    Browser --> AuthUI
    Browser --> BorrowerDash
    Browser --> LenderDash
    Browser --> LoanAppUI
    Browser --> LoanOppUI

    LandingUI --> UIComponents
    AuthUI --> UIComponents
    BorrowerDash --> UIComponents
    LenderDash --> UIComponents
    LoanAppUI --> UIComponents
    LoanOppUI --> UIComponents
    LandingUI --> StaticData

    AuthUI --> BorrowerLogin
    AuthUI --> BorrowerSignup
    AuthUI --> LenderLogin
    AuthUI --> LenderSignup

    BorrowerLogin --> Utils
    BorrowerSignup --> Utils
    LenderLogin --> Utils
    LenderSignup --> Utils

    Utils --> DBConfig
    DBConfig --> MongoDB
    Utils --> BorrowerModel
    Utils --> LenderModel
    BorrowerModel --> MongoDB
    LenderModel --> MongoDB

    CloudinaryModule --> Cloudinary
    Utils --> CloudinaryModule

    %% Click Events
    click LandingUI "https://github.com/kunal12kumar/sahayakosh/tree/main/src/app/Landingpage"
    click AuthUI "https://github.com/kunal12kumar/sahayakosh/tree/main/src/app/auth"
    click BorrowerDash "https://github.com/kunal12kumar/sahayakosh/blob/main/src/app/borrowerdashboard/page.js"
    click LenderDash "https://github.com/kunal12kumar/sahayakosh/blob/main/src/app/lenderdashboard/page.js"
    click LoanAppUI "https://github.com/kunal12kumar/sahayakosh/blob/main/src/app/loanapplication/page.js"
    click LoanOppUI "https://github.com/kunal12kumar/sahayakosh/blob/main/src/app/loanopportunity/page.js"
    click BorrowerLogin "https://github.com/kunal12kumar/sahayakosh/blob/main/src/app/api/authenticate/borrowerlogin/route.js"
    click BorrowerSignup "https://github.com/kunal12kumar/sahayakosh/blob/main/src/app/api/authenticate/borrowersignup/route.js"
    click LenderLogin "https://github.com/kunal12kumar/sahayakosh/blob/main/src/app/api/authenticate/lenderlogin/route.js"
    click LenderSignup "https://github.com/kunal12kumar/sahayakosh/blob/main/src/app/api/authenticate/lendersignup/route.js"
    click DBConfig "https://github.com/kunal12kumar/sahayakosh/blob/main/src/dbconfig/mongodbconfig.js"
    click BorrowerModel "https://github.com/kunal12kumar/sahayakosh/blob/main/src/models/borrowerregistrationschema.js"
    click LenderModel "https://github.com/kunal12kumar/sahayakosh/blob/main/src/models/lenderschema.js"
    click CloudinaryModule "https://github.com/kunal12kumar/sahayakosh/blob/main/src/lib/cloudinary.js"
    click Utils "https://github.com/kunal12kumar/sahayakosh/blob/main/src/lib/utils.js"
    click UIComponents "https://github.com/kunal12kumar/sahayakosh/tree/main/src/components/ui"
    click StaticData "https://github.com/kunal12kumar/sahayakosh/blob/main/src/data/globe.json"

    %% Styles
    classDef client fill:#D0E8FF,stroke:#2B7CE9,color:#000
    classDef presentation fill:#E0FFD6,stroke:#37A000,color:#000
    classDef api fill:#FFD8B8,stroke:#FF6F00,color:#000
    classDef business fill:#FFF4B2,stroke:#D4A000,color:#000
    classDef data fill:#EBDFFF,stroke:#8E44AD,color:#000
    classDef external fill:#F0F0F0,stroke:#AAAAAA,color:#000
```
