# ismaelherreradev/tasky architecture

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

- Interactive diagram: https://gitdiagram.com/ismaelherreradev/tasky
- Repository: https://github.com/ismaelherreradev/tasky

## Overview

##### Main Components

A. Frontend Layer:
- Next.js 14 Application Structure
- Landing Pages (src/app/(landing))
- Platform Pages (src/app/(plataform))
- Authentication Pages (src/app/(clerk))
- UI Components (src/components)

B. Authentication Layer:
- Clerk Authentication Service
- Role-based Access Control
- Organization Management

C. Backend Layer:
- tRPC API Routes (src/server/api)
- Router Handlers for:
- Boards
- Cards
- Lists
- Activity Logs

D. Database Layer:
- Turso (LibSQL)
- Drizzle ORM
- Schema Management

**┌─ Client Layer ─────────────────────┐**
- Next.js 14 Frontend               │
- Public Routes                  │
- Protected Routes               │
- UI Components                  │

- Authentication Layer ─────────────┤
- Clerk Authentication              │
- User Management               │
- Organization Management       │
- Role-based Access             │

- API Layer ────────────────────────┤
- tRPC API                          │
- Board Router                   │
- Card Router                    │
- List Router                    │
- Logs Router                    │

- Data Layer ────────────────────────┤
- Turso Database                     │
- Drizzle ORM                    │
- Schema Management              │

##### Key Relationships to Highlight

- Client-to-API: Show tRPC connection between frontend and API layer
- Authentication Flow: Demonstrate how Clerk integrates with protected routes
- Data Flow: Illustrate how requests flow from UI through API to database
- Activity Logging: Show how system events are captured and stored

##### Technical Stack Callouts

A technical stack sidebar showing:
- Next.js 14
- Clerk
- tRPC
- Drizzle
- Turso
- TailwindCSS
- shadcn/ui

##### Additional Elements

- Version information
- Deployment targets (Vercel, Netlify, Docker)
- Scaling considerations

- How the application's components interact
- Where different types of logic reside
- How data flows through the system
- Security boundaries and authentication flows
- Integration points with external services

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Client["Client Layer"]
        Landing["Landing Pages"]
        Platform["Platform Pages"]
        Auth["Auth Pages"]
        UI["UI Components"]
        Theme["Theme Provider"]
    end

    subgraph AuthLayer["Authentication Layer"]
        Clerk["Clerk Service"]
        OrgMgmt["Organization Management"]
        Middleware["Auth Middleware"]
        RBAC["Role-based Access"]
    end

    subgraph APILayer["API Layer"]
        tRPCRoot["tRPC Root"]
        tRPCClient["tRPC Client"]
        tRPCServer["tRPC Server"]
        
        subgraph Routers["API Routers"]
            BoardRouter["Board Router"]
            CardRouter["Card Router"]
            ListRouter["List Router"]
            LogsRouter["Logs Router"]
        end
    end

    subgraph DataLayer["Data Layer"]
        Turso["Turso Database"]
        Drizzle["Drizzle ORM"]
        Schema["Schema Definition"]
        Migrations["DB Migrations"]
    end

    %% Relationships
    Landing --> tRPCClient
    Platform --> tRPCClient
    Auth --> Clerk
    UI --> Theme

    Clerk --> Middleware
    Middleware --> RBAC
    OrgMgmt --> RBAC

    tRPCClient --> tRPCRoot
    tRPCServer --> tRPCRoot
    tRPCRoot --> Routers

    BoardRouter --> Drizzle
    CardRouter --> Drizzle
    ListRouter --> Drizzle
    LogsRouter --> Drizzle

    Drizzle --> Turso
    Schema --> Drizzle
    Migrations --> Turso

    %% Styling
    classDef frontend fill:#3b82f6,color:#fff
    classDef auth fill:#22c55e,color:#fff
    classDef api fill:#f97316,color:#fff
    classDef database fill:#a855f7,color:#fff

    class Landing,Platform,Auth,UI,Theme frontend
    class Clerk,OrgMgmt,Middleware,RBAC auth
    class tRPCRoot,tRPCClient,tRPCServer,BoardRouter,CardRouter,ListRouter,LogsRouter api
    class Turso,Drizzle,Schema,Migrations database

    %% Click Events
    click Landing "https://github.com/ismaelherreradev/tasky/tree/main/src/app/(landing)"
    click Platform "https://github.com/ismaelherreradev/tasky/tree/main/src/app/(plataform)"
    click Auth "https://github.com/ismaelherreradev/tasky/tree/main/src/app/(clerk)"
    click UI "https://github.com/ismaelherreradev/tasky/tree/main/src/components/ui"
    click Theme "https://github.com/ismaelherreradev/tasky/blob/main/src/components/theme-provider.tsx"
    click Middleware "https://github.com/ismaelherreradev/tasky/blob/main/src/middleware.ts"
    click OrgMgmt "https://github.com/ismaelherreradev/tasky/tree/main/src/app/(plataform)/organization"
    click tRPCRoot "https://github.com/ismaelherreradev/tasky/blob/main/src/server/api/root.ts"
    click BoardRouter "https://github.com/ismaelherreradev/tasky/blob/main/src/server/api/routers/board/_router.ts"
    click CardRouter "https://github.com/ismaelherreradev/tasky/blob/main/src/server/api/routers/card/_router.ts"
    click ListRouter "https://github.com/ismaelherreradev/tasky/blob/main/src/server/api/routers/list/_router.ts"
    click LogsRouter "https://github.com/ismaelherreradev/tasky/blob/main/src/server/api/routers/logs/_router.ts"
    click Drizzle "https://github.com/ismaelherreradev/tasky/blob/main/src/server/db/index.ts"
    click Schema "https://github.com/ismaelherreradev/tasky/blob/main/src/server/db/schema.ts"
    click Migrations "https://github.com/ismaelherreradev/tasky/tree/main/drizzle/"
    click tRPCClient "https://github.com/ismaelherreradev/tasky/blob/main/src/trpc/react.tsx"
    click tRPCServer "https://github.com/ismaelherreradev/tasky/blob/main/src/trpc/server.ts"
```
