# vishalx360/taskflow-space architecture

> Architecture diagram of the GitHub repository vishalx360/taskflow-space, 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/vishalx360/taskflow-space
- Repository: https://github.com/vishalx360/taskflow-space

## Overview

##### Main Components

a. Client-Side Layer:
- Next.js Frontend (src/modules/*)
- UI Components (src/modules/ui/*)
- Context Providers (src/contexts/*)
- Client-side Libraries (src/lib/*)

b. API Layer:
- tRPC API Routes (src/server/api/routers/*)
- Authentication Routes (src/pages/api/auth/*)
- Webhook Handlers (src/pages/api/webhook/*)

c. Server-Side Layer:
- Authentication System (NextAuth)
- tRPC Handlers
- Email Service
- Pusher Real-time Updates

d. Data Layer:
- Neon PostgreSQL Database
- Prisma ORM
- Redis Cache

**┌─ Client Layer ─────────────────────────┐**
- Next.js Pages                        │
- React Components                     │
- UI Components                        │
- ┬────────────────────┘
- ↓
**┌─ API Layer ──────────────────────────┐**
- tRPC Routes                        │
- Auth Routes                        │
- Webhooks                          │
- ┬──────────────────┘
- ↓
**┌─ Service Layer ────────────────────────┐**
- Authentication                       │
- Real-time Updates (Pusher)          │
- Email Service                       │
- ┬────────────────────┘
- ↓
**┌─ Data Layer ──────────────────────────┐**
- Neon PostgreSQL                     │
- Redis Cache                         │
- Prisma ORM                         │
- ┘

##### Key Relationships to Highlight

a. Frontend Module Relationships:
- Dashboard → Board → TaskList → TaskCard
- Settings → Various Setting Sections
- Authentication Flow

b. API Interactions:
- tRPC Router connections
- Authentication flows
- Real-time update paths

c. Data Flow:
- Client → API → Service → Database
- Real-time updates via Pusher
- Cache interactions

##### Implementation Details

- Clear component labels

##### Additional Elements

- Database schema relationships
- Authentication flow
- Real-time update flow
- Workspace collaboration model

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Styles
    classDef frontend fill:#3498db,color:white
    classDef api fill:#2ecc71,color:white
    classDef service fill:#f1c40f,color:black
    classDef data fill:#e74c3c,color:white
    classDef external fill:#9b59b6,color:white

    %% Client Layer
    subgraph ClientLayer
        Frontend["Next.js Frontend"]:::frontend
        UIComponents["UI Components"]:::frontend
        ContextProviders["Context Providers"]:::frontend
        ClientLibs["Client Libraries"]:::frontend
        
        subgraph Pages
            Dashboard["Dashboard"]:::frontend
            Board["Board View"]:::frontend
            Auth["Authentication Pages"]:::frontend
        end
        
        Frontend --> Pages
        Frontend --> UIComponents
        Frontend --> ContextProviders
        Frontend --> ClientLibs
    end

    %% API Layer
    subgraph APILayer
        TRPC["tRPC Routes"]:::api
        AuthRoutes["Auth Routes"]:::api
        Webhooks["Webhook Handlers"]:::api
    end

    %% Service Layer
    subgraph ServiceLayer
        NextAuth["NextAuth.js"]:::service
        PusherService["Pusher Service"]:::service
        EmailService["Email Service"]:::service
        
        PusherServer["Pusher Server"]:::service
        PusherClient["Pusher Client"]:::service
        EmailTemplates["Email Templates"]:::service
        
        PusherService --> PusherServer
        PusherService --> PusherClient
        EmailService --> EmailTemplates
    end

    %% Data Layer
    subgraph DataLayer
        PostgreSQL["Neon PostgreSQL"]:::data
        Redis["Redis Cache"]:::data
        Prisma["Prisma ORM"]:::data
        
        Prisma --> PostgreSQL
    end

    %% Connections
    ClientLayer --> APILayer
    APILayer --> ServiceLayer
    ServiceLayer --> DataLayer
    PusherClient -.-> Frontend
    Redis -.-> APILayer

    %% Click Events
    click UIComponents "https://github.com/vishalx360/taskflow-space/tree/main/src/modules/ui/*"
    click ContextProviders "https://github.com/vishalx360/taskflow-space/tree/main/src/contexts/*"
    click ClientLibs "https://github.com/vishalx360/taskflow-space/tree/main/src/lib/*"
    click Frontend "https://github.com/vishalx360/taskflow-space/tree/main/src/modules/*"
    click TRPC "https://github.com/vishalx360/taskflow-space/tree/main/src/server/api/routers/*"
    click AuthRoutes "https://github.com/vishalx360/taskflow-space/blob/main/src/pages/api/auth/[...nextauth].ts"
    click Webhooks "https://github.com/vishalx360/taskflow-space/tree/main/src/pages/api/webhook/*"
    click NextAuth "https://github.com/vishalx360/taskflow-space/blob/main/src/server/auth.ts"
    click EmailService "https://github.com/vishalx360/taskflow-space/blob/main/src/utils/SendEmail.ts"
    click PusherServer "https://github.com/vishalx360/taskflow-space/blob/main/src/lib/pusherServer.ts"
    click PusherClient "https://github.com/vishalx360/taskflow-space/blob/main/src/lib/pusherClient.ts"
    click Prisma "https://github.com/vishalx360/taskflow-space/blob/main/prisma/schema.prisma"
    click Redis "https://github.com/vishalx360/taskflow-space/blob/main/src/lib/redisClient.ts"
    click Dashboard "https://github.com/vishalx360/taskflow-space/tree/main/src/pages/dashboard/*"
    click Board "https://github.com/vishalx360/taskflow-space/tree/main/src/pages/board/*"
    click Auth "https://github.com/vishalx360/taskflow-space/blob/main/src/pages/signin.tsx"
    click EmailTemplates "https://github.com/vishalx360/taskflow-space/tree/main/src/utils/email-templates/*"

    %% Legend
    subgraph Legend
        Frontend_L["Frontend"]:::frontend
        API_L["API"]:::api
        Service_L["Service"]:::service
        Data_L["Data"]:::data
        External_L["External"]:::external
    end
```
