# amirsheikhmagomedov/taskfocus architecture

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

- Interactive diagram: https://gitdiagram.com/amirsheikhmagomedov/taskfocus
- Repository: https://github.com/amirsheikhmagomedov/taskfocus

## Overview

##### Main Components

A. Frontend Layer:
- Client-side Components (from /components directory)
- Core UI components (Header, Container, Logo)
- Task Management components (TaskFocusApp, TaskList)
- Authentication components (SignIn/SignUp pages)
- Overlay components for modal interactions

B. API Layer (from /app/api directory):
- Authentication endpoints (/api/auth)
- User management endpoints (/api/(user))
- Task management endpoints (/api/tasks)
- Task list management endpoints (/api/tasklists)
- Email service endpoint (/api/send-email)

C. Data Layer:
- Prisma ORM (indicated by /prisma directory)
- Database (schema defined in prisma/schema.prisma)
- State Management (using store/store.ts)

D. External Services:
- Authentication providers (GitHub, Google)
- Email service
- Vercel deployment

**[Client Layer]**
- ↕
**[API Layer]**
- ↕
**[Data Layer]**

##### Specific Elements

- State management connection
- Client-side routing

- Related endpoints (auth, tasks, tasklists)
- NextAuth.js integration
- Middleware connections

- Prisma ORM connection
- Database tables/relations
- State management store

##### Important Flows to Highlight

A. Authentication Flow:
**User → NextAuth.js → External Providers → Database**

B. Task Management Flow:
**Components → API Routes → Prisma → Database**

##### Key Architectural Patterns to Emphasize

- API Route Pattern: Show how the app/api directory structure maps to endpoints
- Component Composition: Illustrate the hierarchy of React components
- Data Flow: Demonstrate the flow from UI to database and back

##### Technical Stack Callouts

- Next.js 13+ (App Router)
- Prisma ORM
- NextAuth.js
- TypeScript
- Tailwind CSS

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Client
        UI[UI Components]
        TC[Task Components]
        AC[Auth Components]
        OC[Overlay Components]
        SM["State Management"]:::store
        
        UI --> TC
        UI --> AC
        UI --> OC
        SM --> UI
        SM --> TC
    end

    subgraph "API Layer"
        AE["/api/auth"]:::api
        UE["/api/(user)"]:::api
        TE["/api/tasks"]:::api
        TLE["/api/tasklists"]:::api
        EE["/api/send-email"]:::api
    end

    subgraph "Data Layer"
        PR["Prisma ORM"]:::data
        DB[(Database)]:::data
    end

    subgraph "External Services"
        GH["GitHub Auth"]:::external
        GO["Google Auth"]:::external
        EM["Email Service"]:::external
    end

    %% Component Details
    UI --> |Contains| H["Header"]:::component
    UI --> |Contains| C["Container"]:::component
    UI --> |Contains| L["Logo"]:::component

    TC --> |Main| TFA["TaskFocusApp"]:::component
    TC --> |Lists| TL["Task List"]:::component

    AC --> |Auth| AP["Auth Provider"]:::component
    AC --> |Pages| SP["Sign In/Up Pages"]:::component

    OC --> |Overlays| NLO["New List Overlay"]:::component
    OC --> |Overlays| RTO["Rename Task Overlay"]:::component

    %% Data Flow
    TC --> TE
    TC --> TLE
    AC --> AE
    AC --> UE
    OC --> TE
    OC --> TLE

    AE --> PR
    UE --> PR
    TE --> PR
    TLE --> PR
    EE --> EM

    PR --> DB

    AE --> GH
    AE --> GO

    %% Styles
    classDef api fill:#90EE90
    classDef component fill:#ADD8E6
    classDef data fill:#FFD700
    classDef external fill:#DDA0DD
    classDef store fill:#FF6B6B

    %% Click Events
    click H "https://github.com/AmirSheikhmagomedov/TaskFocus/blob/main/components/Header.tsx"
    click C "https://github.com/AmirSheikhmagomedov/TaskFocus/blob/main/components/Container.tsx"
    click L "https://github.com/AmirSheikhmagomedov/TaskFocus/blob/main/components/Logo.tsx"
    click TFA "https://github.com/AmirSheikhmagomedov/TaskFocus/blob/main/components/TaskFocusApp.tsx"
    click TL "https://github.com/AmirSheikhmagomedov/TaskFocus/tree/main/components/task-list"
    click AP "https://github.com/AmirSheikhmagomedov/TaskFocus/blob/main/components/providers/NextAuthProvider.tsx"
    click SP "https://github.com/AmirSheikhmagomedov/TaskFocus/blob/main/components/pages/SignInPage.tsx"
    click NLO "https://github.com/AmirSheikhmagomedov/TaskFocus/blob/main/components/overlays/NewListInputOverlay.tsx"
    click RTO "https://github.com/AmirSheikhmagomedov/TaskFocus/blob/main/components/overlays/RenameTaskOverlay.tsx"
    click AE "https://github.com/AmirSheikhmagomedov/TaskFocus/blob/main/app/api/auth/[...nextauth]"
    click UE "https://github.com/AmirSheikhmagomedov/TaskFocus/tree/main/app/api/(user)"
    click TE "https://github.com/AmirSheikhmagomedov/TaskFocus/tree/main/app/api/tasks"
    click TLE "https://github.com/AmirSheikhmagomedov/TaskFocus/tree/main/app/api/tasklists"
    click EE "https://github.com/AmirSheikhmagomedov/TaskFocus/blob/main/app/api/send-email/route.ts"
    click PR "https://github.com/AmirSheikhmagomedov/TaskFocus/blob/main/prisma/schema.prisma"
    click SM "https://github.com/AmirSheikhmagomedov/TaskFocus/blob/main/store/store.ts"
```
