# luciferakj/clipdrop architecture

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

- Interactive diagram: https://gitdiagram.com/luciferakj/clipdrop
- Repository: https://github.com/luciferakj/clipdrop

## Overview

ClipDrop is a temporary text-and-file sharing service with optional authenticated device management and polling-based clipboard sync. The main workflow is upload and configure content, create a share, then retrieve it through its code; authenticated users also manage shares/devices and sync clipboard text. Arrows cite shown calls or explicit README relationships. Several routes and sync helpers are represented from the README and source index rather than inspected excerpts, so uncertain implementation links are omitted.

Main entry points: [`lib/prisma.ts`](https://github.com/luciferakj/clipdrop/blob/main/lib/prisma.ts) (Postgres metadata), [`app/api/upload/route.ts`](https://github.com/luciferakj/clipdrop/blob/main/app/api/upload/route.ts) (Create share API), [`app/s/[code]/page.tsx`](https://github.com/luciferakj/clipdrop/blob/main/app/s/%5Bcode%5D/page.tsx) (Receive page), [`app/dashboard/page.tsx`](https://github.com/luciferakj/clipdrop/blob/main/app/dashboard/page.tsx) (Uploads dashboard)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_sharing["Share lifecycle"]
  node_uploader["Upload form<br/>[UploadZone.tsx]"]
  node_upload_transport["Upload transport<br/>[uploadService.ts]"]
  node_upload_api["Create share API<br/>[route.ts]"]
  node_share_result["Share link result<br/>[ShareResult.tsx]"]
  node_receive_page["Receive page<br/>[page.tsx]"]
  node_share_api["Retrieve share API<br/>[route.ts]"]
  node_text_viewer["Text preview<br/>[TextViewer.tsx]"]
  node_home["Home entry<br/>[page.tsx]"]
end

subgraph group_workspace["User workspace"]
  node_dashboard_page["Uploads dashboard<br/>[page.tsx]"]
  node_dashboard_list["Share management<br/>[DashboardList.tsx]"]
  node_share_card["Share actions<br/>[ShareCard.tsx]"]
  node_delete_api["Delete share API<br/>[route.ts]"]
  node_devices_page["Devices dashboard<br/>[page.tsx]"]
  node_device_list["Device management<br/>[DeviceList.tsx]"]
  node_device_client["Device client<br/>[deviceClient.ts]"]
  node_device_api["Device API<br/>[route.ts]"]
  node_device_item_api["Device item API<br/>[route.ts]"]
end

subgraph group_sync["Clipboard sync"]
  node_sync_hook["Sync engine"]
  node_sync_provider["Sync status provider"]
  node_sync_client["Sync API client"]
  node_clipboard_api["Clipboard API<br/>[route.ts]"]
end

subgraph group_platform["Data and services"]
  node_database[("Postgres metadata<br/>[prisma.ts]")]
  node_cloudinary["Cloudinary files<br/>[cloudinary.ts]"]
  node_validation["Input validation<br/>[validation.ts]"]
  node_cleanup["Expiry cleanup<br/>[route.ts]"]
end

node_visitor(("Visitor"))
node_clerk(("Clerk identity"))

node_visitor -->|"opens"| node_home
node_home -->|"renders"| node_uploader
node_uploader -->|"starts upload"| node_upload_transport
node_upload_transport -->|"POSTs payload"| node_upload_api
node_upload_api -->|"validates content"| node_validation
node_upload_api -->|"stores files"| node_cloudinary
node_upload_api -->|"creates share"| node_database
node_upload_api -.->|"returns code"| node_share_result
node_visitor -->|"opens link"| node_receive_page
node_receive_page -.->|"requests content"| node_share_api
node_share_api -->|"reads and updates"| node_database
node_receive_page -->|"renders preview"| node_text_viewer
node_clerk -->|"authenticates"| node_dashboard_page
node_dashboard_page -->|"loads shares"| node_database
node_dashboard_page -->|"renders"| node_dashboard_list
node_dashboard_list -->|"renders cards"| node_share_card
node_share_card -.->|"deletes share"| node_delete_api
node_delete_api -->|"deletes record"| node_database
node_devices_page -->|"loads devices"| node_database
node_devices_page -->|"renders"| node_device_list
node_device_list -->|"uses requests"| node_device_client
node_device_client -->|"registers device"| node_device_api
node_device_list -.->|"manages device"| node_device_item_api
node_device_api -->|"reads and writes"| node_database
node_device_item_api -->|"updates device"| node_database
node_sync_hook -->|"pushes and pulls"| node_sync_client
node_sync_hook -->|"sets status"| node_sync_provider
node_sync_client -->|"calls endpoint"| node_clipboard_api
node_clipboard_api -->|"reads and writes"| node_database
node_cleanup -->|"sweeps expired"| node_database
node_cleanup -->|"removes files"| node_cloudinary

click node_uploader "https://github.com/luciferakj/clipdrop/blob/main/components/UploadZone.tsx"
click node_upload_transport "https://github.com/luciferakj/clipdrop/blob/main/lib/uploadService.ts"
click node_upload_api "https://github.com/luciferakj/clipdrop/blob/main/app/api/upload/route.ts"
click node_share_result "https://github.com/luciferakj/clipdrop/blob/main/components/ShareResult.tsx"
click node_receive_page "https://github.com/luciferakj/clipdrop/blob/main/app/s/%5Bcode%5D/page.tsx"
click node_share_api "https://github.com/luciferakj/clipdrop/blob/main/app/api/share/%5Bcode%5D/route.ts"
click node_text_viewer "https://github.com/luciferakj/clipdrop/blob/main/components/share/TextViewer.tsx"
click node_home "https://github.com/luciferakj/clipdrop/blob/main/app/page.tsx"
click node_dashboard_page "https://github.com/luciferakj/clipdrop/blob/main/app/dashboard/page.tsx"
click node_dashboard_list "https://github.com/luciferakj/clipdrop/blob/main/components/dashboard/DashboardList.tsx"
click node_share_card "https://github.com/luciferakj/clipdrop/blob/main/components/dashboard/ShareCard.tsx"
click node_delete_api "https://github.com/luciferakj/clipdrop/blob/main/app/api/dashboard/delete/route.ts"
click node_devices_page "https://github.com/luciferakj/clipdrop/blob/main/app/dashboard/devices/page.tsx"
click node_device_list "https://github.com/luciferakj/clipdrop/blob/main/components/devices/DeviceList.tsx"
click node_device_client "https://github.com/luciferakj/clipdrop/blob/main/lib/deviceClient.ts"
click node_device_api "https://github.com/luciferakj/clipdrop/blob/main/app/api/devices/route.ts"
click node_device_item_api "https://github.com/luciferakj/clipdrop/blob/main/app/api/devices/%5Bid%5D/route.ts"
click node_sync_hook "https://github.com/luciferakj/clipdrop/blob/main/hooks/useClipboardSync.ts"
click node_sync_provider "https://github.com/luciferakj/clipdrop/blob/main/components/providers/ClipboardSyncStatusProvider.tsx"
click node_sync_client "https://github.com/luciferakj/clipdrop/blob/main/lib/clipboardSyncClient.ts"
click node_clipboard_api "https://github.com/luciferakj/clipdrop/blob/main/app/api/clipboard/route.ts"
click node_database "https://github.com/luciferakj/clipdrop/blob/main/lib/prisma.ts"
click node_cloudinary "https://github.com/luciferakj/clipdrop/blob/main/lib/cloudinary.ts"
click node_validation "https://github.com/luciferakj/clipdrop/blob/main/lib/validation.ts"
click node_cleanup "https://github.com/luciferakj/clipdrop/blob/main/app/api/cron/cleanup/route.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_uploader,node_upload_transport,node_upload_api,node_share_result,node_receive_page,node_share_api,node_text_viewer,node_home toneBlue
class node_dashboard_page,node_dashboard_list,node_share_card,node_delete_api,node_devices_page,node_device_list,node_device_client,node_device_api,node_device_item_api toneAmber
class node_sync_hook,node_sync_provider,node_sync_client,node_clipboard_api toneMint
class node_database,node_cloudinary,node_validation,node_cleanup toneRose
class node_visitor,node_clerk toneIndigo
```

## Components

### Share lifecycle

- [Upload form](https://github.com/luciferakj/clipdrop/blob/main/components/UploadZone.tsx): `components/UploadZone.tsx`
- [Upload transport](https://github.com/luciferakj/clipdrop/blob/main/lib/uploadService.ts): `lib/uploadService.ts`
- [Create share API](https://github.com/luciferakj/clipdrop/blob/main/app/api/upload/route.ts): `app/api/upload/route.ts`
- [Share link result](https://github.com/luciferakj/clipdrop/blob/main/components/ShareResult.tsx): `components/ShareResult.tsx`
- [Receive page](https://github.com/luciferakj/clipdrop/blob/main/app/s/%5Bcode%5D/page.tsx): `app/s/[code]/page.tsx`
- [Retrieve share API](https://github.com/luciferakj/clipdrop/blob/main/app/api/share/%5Bcode%5D/route.ts): `app/api/share/[code]/route.ts`
- [Text preview](https://github.com/luciferakj/clipdrop/blob/main/components/share/TextViewer.tsx): `components/share/TextViewer.tsx`
- [Home entry](https://github.com/luciferakj/clipdrop/blob/main/app/page.tsx): `app/page.tsx`

### User workspace

- [Uploads dashboard](https://github.com/luciferakj/clipdrop/blob/main/app/dashboard/page.tsx): `app/dashboard/page.tsx`
- [Share management](https://github.com/luciferakj/clipdrop/blob/main/components/dashboard/DashboardList.tsx): `components/dashboard/DashboardList.tsx`
- [Share actions](https://github.com/luciferakj/clipdrop/blob/main/components/dashboard/ShareCard.tsx): `components/dashboard/ShareCard.tsx`
- [Delete share API](https://github.com/luciferakj/clipdrop/blob/main/app/api/dashboard/delete/route.ts): `app/api/dashboard/delete/route.ts`
- [Devices dashboard](https://github.com/luciferakj/clipdrop/blob/main/app/dashboard/devices/page.tsx): `app/dashboard/devices/page.tsx`
- [Device management](https://github.com/luciferakj/clipdrop/blob/main/components/devices/DeviceList.tsx): `components/devices/DeviceList.tsx`
- [Device client](https://github.com/luciferakj/clipdrop/blob/main/lib/deviceClient.ts): `lib/deviceClient.ts`
- [Device API](https://github.com/luciferakj/clipdrop/blob/main/app/api/devices/route.ts): `app/api/devices/route.ts`
- [Device item API](https://github.com/luciferakj/clipdrop/blob/main/app/api/devices/%5Bid%5D/route.ts): `app/api/devices/[id]/route.ts`

### Clipboard sync

- [Sync engine](https://github.com/luciferakj/clipdrop/blob/main/hooks/useClipboardSync.ts): `hooks/useClipboardSync.ts`
- [Sync status provider](https://github.com/luciferakj/clipdrop/blob/main/components/providers/ClipboardSyncStatusProvider.tsx): `components/providers/ClipboardSyncStatusProvider.tsx`
- [Sync API client](https://github.com/luciferakj/clipdrop/blob/main/lib/clipboardSyncClient.ts): `lib/clipboardSyncClient.ts`
- [Clipboard API](https://github.com/luciferakj/clipdrop/blob/main/app/api/clipboard/route.ts): `app/api/clipboard/route.ts`

### Data and services

- [Postgres metadata](https://github.com/luciferakj/clipdrop/blob/main/lib/prisma.ts): `lib/prisma.ts`
- [Cloudinary files](https://github.com/luciferakj/clipdrop/blob/main/lib/cloudinary.ts): `lib/cloudinary.ts`
- [Input validation](https://github.com/luciferakj/clipdrop/blob/main/lib/validation.ts): `lib/validation.ts`
- [Expiry cleanup](https://github.com/luciferakj/clipdrop/blob/main/app/api/cron/cleanup/route.ts): `app/api/cron/cleanup/route.ts`

### Other components

- **Visitor**
- **Clerk identity**

## Connections

- Visitor → Home entry: opens (evidence: `app/page.tsx`)
- Home entry → Upload form: renders (evidence: `app/page.tsx`)
- Upload form → Upload transport: starts upload (evidence: `components/UploadZone.tsx`)
- Upload transport → Create share API: POSTs payload (evidence: `lib/uploadService.ts`)
- Create share API → Input validation: validates content (evidence: `app/api/upload/route.ts`)
- Create share API → Cloudinary files: stores files (evidence: `app/api/upload/route.ts`)
- Create share API → Postgres metadata: creates share (evidence: `app/api/upload/route.ts`)
- Create share API → Share link result: returns code
- Visitor → Receive page: opens link (evidence: `app/s/[code]/page.tsx`)
- Receive page → Retrieve share API: requests content
- Retrieve share API → Postgres metadata: reads and updates (evidence: `app/api/share/[code]/route.ts`)
- Receive page → Text preview: renders preview (evidence: `app/s/[code]/page.tsx`)
- Clerk identity → Uploads dashboard: authenticates (evidence: `app/dashboard/page.tsx`)
- Uploads dashboard → Postgres metadata: loads shares (evidence: `app/dashboard/page.tsx`)
- Uploads dashboard → Share management: renders (evidence: `app/dashboard/page.tsx`)
- Share management → Share actions: renders cards (evidence: `components/dashboard/DashboardList.tsx`)
- Share actions → Delete share API: deletes share
- Delete share API → Postgres metadata: deletes record (evidence: `app/api/dashboard/delete/route.ts`)
- Devices dashboard → Postgres metadata: loads devices (evidence: `app/dashboard/devices/page.tsx`)
- Devices dashboard → Device management: renders (evidence: `app/dashboard/devices/page.tsx`)
- Device management → Device client: uses requests (evidence: `components/devices/DeviceList.tsx`)
- Device client → Device API: registers device (evidence: `lib/deviceClient.ts`)
- Device management → Device item API: manages device
- Device API → Postgres metadata: reads and writes (evidence: `app/api/devices/route.ts`)
- Device item API → Postgres metadata: updates device (evidence: `app/api/devices/[id]/route.ts`)
- Sync engine → Sync API client: pushes and pulls (evidence: `hooks/useClipboardSync.ts`)
- Sync engine → Sync status provider: sets status (evidence: `hooks/useClipboardSync.ts`)
- Sync API client → Clipboard API: calls endpoint (evidence: `lib/clipboardSyncClient.ts`)
- Clipboard API → Postgres metadata: reads and writes (evidence: `app/api/clipboard/route.ts`)
- Expiry cleanup → Postgres metadata: sweeps expired (evidence: `app/api/cron/cleanup/route.ts`)
- Expiry cleanup → Cloudinary files: removes files (evidence: `app/api/cron/cleanup/route.ts`)
