# devmhimran/todo-drag-and-drop architecture

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

- Interactive diagram: https://gitdiagram.com/devmhimran/todo-drag-and-drop
- Repository: https://github.com/devmhimran/todo-drag-and-drop

## Overview

##### Main Components Identification

The project is a full-stack Next.js application with the following key components:

a) Frontend Layer:
- Next.js App Router structure
- React Components
- Client-side state management

b) Backend Layer:
- Server Actions
- Database Layer (Prisma)

**[Client Layer]**
- ↓
**[Next.js App Router]**
- ↓
**[Server Actions Layer]**
- ↓
**[Database Layer]**

##### Client Layer (Top)
- Todos Components (AllTodo.tsx, Todo.tsx)
- DefaultProvider.tsx

##### Next.js App Router (Middle-Top)
- page.tsx
- layout.tsx
- Route handling

##### Server Actions Layer (Middle-Bottom)
- FetchText actions
- UpdateText actions

##### Database Layer (Bottom)
- Prisma ORM
- Database Schema

- Use blue for client-side components
- Use green for server-side components
- Use orange for database-related components
- Use purple for Next.js routing components

D. Connection Types:

- Double lines for API calls

##### Specific Implementation Details

Key architectural elements:

a) Client-Server Boundary:
- How Server Actions bridge this boundary

b) Data Flow Indicators:
- How Todo components interact with Server Actions
- Prisma's interaction with the database

c) State Management:
- How DefaultProvider manages application state
- Data flow between components

##### Technical Stack Callouts

- Next.js 14+
- Prisma ORM
- TypeScript
- Tailwind CSS

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Styles and classes
    classDef client fill:#3b82f6,color:white
    classDef server fill:#22c55e,color:white
    classDef database fill:#f97316,color:white
    classDef router fill:#a855f7,color:white
    classDef styling fill:#ec4899,color:white

    %% Legend
    subgraph Legend
        C1[Client Components]:::client
        S1[Server Components]:::server
        D1[Database Components]:::database
        R1[Router Components]:::router
        ST1[Styling Components]:::styling
    end

    %% Client Layer
    subgraph "Client Layer"
        AllTodos[AllTodo Component]
        Todo[Todo Component]
        DefaultProvider[Default Provider]
    end
    
    %% Next.js App Router
    subgraph "Next.js Router Layer"
        Layout[Layout]
        Page[Page]
    end

    %% Server Actions Layer
    subgraph "Server Actions Layer"
        FetchText[Fetch Text Actions]
        UpdateText[Update Text Actions]
    end

    %% Database Layer
    subgraph "Database Layer"
        PrismaORM[Prisma ORM]
        DBSchema[Database Schema]
    end

    %% Styling Layer
    subgraph "Styling Layer"
        GlobalCSS[Global CSS]
        TailwindConfig[Tailwind Config]
    end

    %% Relationships
    DefaultProvider --> AllTodos
    AllTodos --> Todo
    Page --> AllTodos
    Layout --> Page
    Todo --> FetchText
    Todo --> UpdateText
    FetchText --> PrismaORM
    UpdateText --> PrismaORM
    PrismaORM --> DBSchema
    GlobalCSS --> Layout
    TailwindConfig --> GlobalCSS

    %% Styling
    class AllTodos,Todo,DefaultProvider client
    class Layout,Page router
    class FetchText,UpdateText server
    class PrismaORM,DBSchema database
    class GlobalCSS,TailwindConfig styling

    %% Click Events
    click AllTodos "https://github.com/devmhimran/todo-drag-and-drop/blob/main/src/components/shared/Todos/AllTodo.tsx"
    click Todo "https://github.com/devmhimran/todo-drag-and-drop/blob/main/src/components/shared/Todos/Todo.tsx"
    click DefaultProvider "https://github.com/devmhimran/todo-drag-and-drop/blob/main/src/components/shared/providers/DefaultProvider.tsx"
    click Layout "https://github.com/devmhimran/todo-drag-and-drop/blob/main/src/app/layout.tsx"
    click Page "https://github.com/devmhimran/todo-drag-and-drop/blob/main/src/app/page.tsx"
    click FetchText "https://github.com/devmhimran/todo-drag-and-drop/blob/main/src/actions/fetch-text/FetchText.ts"
    click UpdateText "https://github.com/devmhimran/todo-drag-and-drop/blob/main/src/actions/update-text/UpdateText.ts"
    click DBSchema "https://github.com/devmhimran/todo-drag-and-drop/blob/main/prisma/schema.prisma"
    click PrismaORM "https://github.com/devmhimran/todo-drag-and-drop/blob/main/prisma/db/prisma.ts"
    click GlobalCSS "https://github.com/devmhimran/todo-drag-and-drop/blob/main/src/app/globals.css"
    click TailwindConfig "https://github.com/devmhimran/todo-drag-and-drop/blob/main/tailwind.config.ts"
```
