# oleksiiyovenko/trello_copy architecture

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

- Interactive diagram: https://gitdiagram.com/oleksiiyovenko/trello_copy
- Repository: https://github.com/oleksiiyovenko/trello_copy

## Overview

##### Project type and purpose
- This is a full-stack Next.js (v13+) web application with both marketing (public) pages and an authenticated platform/dashboard.
- It provides Trello-like boards, lists, and cards features, with user authentication via Clerk, data persistence via Prisma (likely backed by PostgreSQL), payments/subscriptions via Stripe, and image fetches via Unsplash.

##### File structure
- Top-level folders:
- app/         → Next.js “App Router” routes, split into (marketing) and (platform) layouts
- actions/     → Server Actions (Next.js server-side functions) for CRUD on boards, lists, cards
- components/  → Shared UI components, modals, form elements, providers (React Query, modal)
- lib/         → Server-side utility modules (db connection, audit log, safe action wrapper, Stripe, Unsplash, etc.)
- prisma/      → ORM schema (schema.prisma)
- hooks/       → Client hooks for UI state & data fetching
- app/api/     → API Routes (webhooks, card logs)
- middleware.ts, next.config.ts, tsconfig.json, etc. for configuration

##### README
- Confirms a standard create-next-app scaffold.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Client Side
    subgraph "Client (Browser)" 
        direction TB
        Marketing["Marketing Pages"]:::client
        Platform["Platform Pages"]:::client
        SharedUI["Shared UI Components"]:::client
        QueryProvider["React Query Provider"]:::client
    end

    %% Server Side
    subgraph "Next.js Server" 
        direction TB
        AppRouter["App Router (Layouts & Routes)"]:::server
        Middleware["Middleware (Auth Guard)"]:::server
        subgraph "Business Logic"
            direction TB
            ServerActions["Server Actions"]:::server
            APIRoutes["API Routes"]:::server
        end
        subgraph "Utilities & DB"
            direction TB
            DBClient["Prisma Client"]:::db
            SafeAction["Safe Action Wrapper"]:::server
            AuditLog["Audit Logging Utility"]:::server
            StripeLib["Stripe SDK"]:::server
            UnsplashLib["Unsplash Helper"]:::server
        end
    end

    %% Database
    Database["Database (PostgreSQL)"]:::db

    %% External Services
    Clerk["Clerk Auth Service"]:::external
    StripeService["Stripe Payment Service"]:::external
    UnsplashService["Unsplash Image Service"]:::external

    %% Flows
    Marketing -->|"renders via"| AppRouter
    Platform -->|"renders via"| AppRouter
    SharedUI -->|used by| Marketing
    SharedUI -->|used by| Platform
    QueryProvider -->|wraps| Marketing
    QueryProvider -->|wraps| Platform

    AppRouter -->|calls| ServerActions
    AppRouter -->|routes to| APIRoutes
    AppRouter -->|invokes| Middleware

    ServerActions -->|uses| SafeAction
    ServerActions -->|logs via| AuditLog
    ServerActions -->|queries| DBClient
    ServerActions -->|creates checkout| StripeLib
    ServerActions -->|fetches images| UnsplashLib

    APIRoutes -->|webhook events| StripeLib
    APIRoutes -->|logs & fetch card logs| DBClient

    StripeService -.->|webhook| APIRoutes
    StripeLib -->|calls| StripeService

    UnsplashLib -->|requests| UnsplashService
    DBClient -->|executes SQL| Database

    AppRouter -->|redirects to/from| Clerk

    %% Click Events
    click Marketing "https://github.com/oleksiiyovenko/trello_copy/blob/master/app/(marketing)/page.tsx"
    click Platform "https://github.com/oleksiiyovenko/trello_copy/blob/master/app/(platform)/layout.tsx"
    click SharedUI "https://github.com/oleksiiyovenko/trello_copy/tree/master/components/"
    click QueryProvider "https://github.com/oleksiiyovenko/trello_copy/blob/master/components/providers/query-provider.tsx"
    click AppRouter "https://github.com/oleksiiyovenko/trello_copy/blob/master/app/layout.tsx"
    click Marketing "https://github.com/oleksiiyovenko/trello_copy/blob/master/app/(marketing)/layout.tsx"
    click Platform "https://github.com/oleksiiyovenko/trello_copy/blob/master/app/(platform)/layout.tsx"
    click ServerActions "https://github.com/oleksiiyovenko/trello_copy/tree/master/actions/board-actions/"
    click ServerActions "https://github.com/oleksiiyovenko/trello_copy/tree/master/actions/list-actions/"
    click ServerActions "https://github.com/oleksiiyovenko/trello_copy/tree/master/actions/card-actions/"
    click ServerActions "https://github.com/oleksiiyovenko/trello_copy/blob/master/actions/stripe-redirect/index.ts"
    click APIRoutes "https://github.com/oleksiiyovenko/trello_copy/blob/master/app/api/webhook/route.ts"
    click APIRoutes "https://github.com/oleksiiyovenko/trello_copy/blob/master/app/api/cards/[cardId]/route.ts"
    click APIRoutes "https://github.com/oleksiiyovenko/trello_copy/blob/master/app/api/cards/[cardId]/logs/route.ts"
    click Middleware "https://github.com/oleksiiyovenko/trello_copy/blob/master/middleware.ts"
    click DBClient "https://github.com/oleksiiyovenko/trello_copy/blob/master/lib/db.ts"
    click Database "https://github.com/oleksiiyovenko/trello_copy/blob/master/prisma/schema.prisma"
    click Clerk "https://github.com/oleksiiyovenko/trello_copy/blob/master/app/(platform)/(clerk)/sign-in/[[...sign-in]]/page.tsx"
    click Clerk "https://github.com/oleksiiyovenko/trello_copy/blob/master/app/(platform)/(clerk)/sign-up/[[...sign-up]]/page.tsx"
    click Clerk "https://github.com/oleksiiyovenko/trello_copy/blob/master/app/(platform)/(clerk)/select-org/[[...select-org]]/page.tsx"
    click StripeLib "https://github.com/oleksiiyovenko/trello_copy/blob/master/lib/stripe.ts"
    click UnsplashLib "https://github.com/oleksiiyovenko/trello_copy/blob/master/lib/usplash.ts"
    click AuditLog "https://github.com/oleksiiyovenko/trello_copy/blob/master/lib/create-audit-log.ts"
    click SafeAction "https://github.com/oleksiiyovenko/trello_copy/blob/master/lib/create-safe-action.ts"

    %% Styles
    classDef client fill:#D0E8FF,stroke:#0384fc,stroke-width:1px
    classDef server fill:#DFF7D8,stroke:#2CA02C,stroke-width:1px
    classDef external fill:#FFE3B8,stroke:#FF8C00,stroke-width:1px
    classDef db fill:#E0E0E0,stroke:#666666,stroke-width:1px
```
