# m-manish-thakur/dribble-clone architecture

> Architecture diagram of the GitHub repository m-manish-thakur/dribble-clone, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-23). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/m-manish-thakur/dribble-clone
- Repository: https://github.com/m-manish-thakur/dribble-clone

## Overview

##### Main Components

A. Frontend Layer:
- Next.js Application (Client-Side)
- Auth Pages (/auth/signin, /auth/signup)
- Main Application Pages (/[username], /account)
- Components (Common, UI, Account)
- UI Components Layer (Shadcn UI integration)

B. Backend Layer:
- Next.js API Routes (/api)
- Authentication endpoints
- User management endpoints
- Middleware (src/middleware.js)
- Service Layer (src/lib)

C. Data Layer:
- Prisma ORM
- PostgreSQL Database
- User Model
- Profile Model
- Session Model
- Followers/Following Models

D. Authentication System:
- NextAuth.js integration
- Google OAuth provider
- Email/Password authentication

##### Component Relationships

- Frontend → API Routes (HTTP requests)
- API Routes → Prisma Client
- Prisma Client → PostgreSQL
- NextAuth → Authentication Providers
- Middleware → API Routes (for request validation)

##### Specific Implementation Details

- Image Upload System (src/utils/uploadImage.js)
- Email Services (src/lib/emailServices.js)
- Input Validation (src/lib/emailValidator.js)

**[Client Layer (Browser)]**
- ↓
**[Next.js Frontend]**
- ↓
**[API Routes Layer]**
- ↓
**[Service Layer]**
- ↓
**[Data Access Layer]**
- ↓
**[Database Layer]**

##### Notes for Implementation

- Use clear boundaries between different layers
- File structure organization where relevant
- Scalability points
- Security boundaries
- Error handling flows

Remember to emphasize the full-stack nature of Next.js in this application, showing how it handles both client and server-side concerns in a unified way.

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Client
        Browser["Web Browser"]
    end

    subgraph NextFrontend["Next.js Frontend"]
        direction TB
        AuthPages["Authentication Pages"]:::frontend
        MainPages["Main Application Pages"]:::frontend
        CommonComp["Common Components"]:::frontend
        UIComp["UI Components Layer"]:::frontend
        AccManage["Account Management"]:::frontend
        FProvider["Frontend Provider"]:::frontend
    end

    subgraph APILayer["API Layer"]
        direction TB
        AuthAPI["Authentication API"]:::api
        UserAPI["User Management API"]:::api
        MW["Middleware"]:::api
    end

    subgraph ServiceLayer["Service Layer"]
        direction TB
        PrismaClient["Prisma Client"]:::service
        ImageUpload["Image Upload System"]:::service
        EmailServ["Email Services"]:::service
        InputValid["Input Validation"]:::service
    end

    subgraph DataLayer["Data Layer"]
        direction TB
        Schema["Database Schema"]:::data
        Migrations["Database Migrations"]:::data
        PostgreSQL[(PostgreSQL DB)]:::database
    end

    subgraph Auth["Authentication System"]
        direction TB
        NextAuth["NextAuth.js"]:::auth
        GoogleOAuth["Google OAuth"]:::auth
        EmailAuth["Email/Password Auth"]:::auth
    end

    %% Connections
    Browser --> NextFrontend
    NextFrontend --> APILayer
    APILayer --> ServiceLayer
    ServiceLayer --> DataLayer
    Auth --> APILayer
    MW --> APILayer
    PrismaClient --> PostgreSQL

    %% Click Events
    click AuthPages "https://github.com/m-Manish-Thakur/dribble-clone/tree/master/src/app/auth"
    click MainPages "https://github.com/m-Manish-Thakur/dribble-clone/tree/master/src/app/(v0)"
    click CommonComp "https://github.com/m-Manish-Thakur/dribble-clone/tree/master/src/components/Common"
    click UIComp "https://github.com/m-Manish-Thakur/dribble-clone/tree/master/src/components/ui"
    click AccManage "https://github.com/m-Manish-Thakur/dribble-clone/tree/master/src/components/account"
    click AuthAPI "https://github.com/m-Manish-Thakur/dribble-clone/blob/master/src/app/api/auth/[...nextauth]"
    click UserAPI "https://github.com/m-Manish-Thakur/dribble-clone/tree/master/src/app/api/user"
    click MW "https://github.com/m-Manish-Thakur/dribble-clone/blob/master/src/middleware.js"
    click PrismaClient "https://github.com/m-Manish-Thakur/dribble-clone/blob/master/src/lib/prisma.js"
    click Schema "https://github.com/m-Manish-Thakur/dribble-clone/blob/master/prisma/schema.prisma"
    click Migrations "https://github.com/m-Manish-Thakur/dribble-clone/tree/master/prisma/migrations"
    click ImageUpload "https://github.com/m-Manish-Thakur/dribble-clone/blob/master/src/utils/uploadImage.js"
    click EmailServ "https://github.com/m-Manish-Thakur/dribble-clone/blob/master/src/lib/emailServices.js"
    click InputValid "https://github.com/m-Manish-Thakur/dribble-clone/blob/master/src/lib/emailValidator.js"
    click FProvider "https://github.com/m-Manish-Thakur/dribble-clone/blob/master/src/utils/Provider.jsx"

    %% Styling
    classDef frontend fill:#2196F3,color:white
    classDef api fill:#4CAF50,color:white
    classDef service fill:#FF9800,color:white
    classDef data fill:#FFC107,color:black
    classDef database fill:#795548,color:white
    classDef auth fill:#9C27B0,color:white

    %% Legend
    subgraph Legend
        Frontend["Frontend Component"]:::frontend
        API["API Component"]:::api
        Service["Service Component"]:::service
        Data["Data Component"]:::data
        DB["Database"]:::database
        AuthComp["Auth Component"]:::auth
    end
```
