Skip to main content

Overview

ClipSync is built with modern web technologies focused on performance, real-time capabilities, and progressive web app features. The stack prioritizes developer experience and production readiness.

Core Technologies

React 19

React

Version: 19.0.0The latest version of React with improved performance and new features.

Why React 19?

  • Automatic batching improvements
  • Enhanced concurrent features
  • Better server component support
  • Improved hydration performance
React’s component-based architecture allows for:
  • Easy state management with hooks
  • Reusable UI patterns
  • Efficient re-rendering
Rich ecosystem with mature libraries:
  • React Query for server state
  • Extensive component libraries
  • Strong TypeScript support

Key React Features Used

import { useEffect, useState } from "react";
import { useQuery } from "@tanstack/react-query";

// Hooks for state management
const [sessionCode, setSessionCode] = useState("");

// Effects for side effects and subscriptions
useEffect(() => {
    const channel = supabase.channel("clipboard").subscribe();
    return () => supabase.removeChannel(channel);
}, [sessionCode]);
Reference: src/App.jsx:1-2, src/App.jsx:7

Vite

Vite

Version: 6.2.0Next-generation frontend build tool with lightning-fast HMR.

Why Vite?

Instant Server StartVite serves code via native ES modules, no bundling required during development.Lightning Fast HMRHot Module Replacement updates instantly regardless of app size.

Vite Configuration

vite.config.js:1-52
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import { VitePWA } from 'vite-plugin-pwa'

export default defineConfig({
  plugins: [
    react(),
    VitePWA({
      registerType: 'autoUpdate',
      workbox: {
        globPatterns: ["**/*"],
      },
      manifest: {
        name: "ClipSync",
        short_name: "ClipSync",
        description: "A web app for syncing clipboard across devices.",
        theme_color: "#000000",
        background_color: "#000000",
        display: "standalone"
      }
    })
  ],
})
Reference: vite.config.js:1-52

Supabase

Supabase

Version: @supabase/supabase-js 2.49.1Open source Firebase alternative providing backend-as-a-service.

Why Supabase?

Real-time

Built-in WebSocket support for instant synchronization

Storage

Integrated file storage with CDN delivery

Database

PostgreSQL database with REST API

Auth Ready

Authentication system (not used yet, but ready for future)

Open Source

Self-hostable with no vendor lock-in

Developer DX

Excellent TypeScript support and documentation

Supabase Features Used

1

Client Initialization

src/config/supabase.js:1-7
import { createClient } from "@supabase/supabase-js";

const SUPABASE_URL = import.meta.env.VITE_SUPABASE_URL;
const SUPABASE_ANON_KEY = import.meta.env.VITE_SUPABASE_ANON_KEY;

const supabase = createClient(SUPABASE_URL, SUPABASE_ANON_KEY);
2

Database Operations

// Query data
await supabase.from("clipboard").select("*").eq("session_code", code);

// Insert data
await supabase.from("clipboard").insert([{...}]);

// Delete data
await supabase.from("clipboard").delete().eq("id", id);
3

Realtime Subscriptions

const channel = supabase
    .channel("clipboard")
    .on("postgres_changes", { event: "*", schema: "public", table: "clipboard" }, callback)
    .subscribe();
4

File Storage

// Upload file
await supabase.storage.from("clipboard").upload(path, file);

// Delete file
await supabase.storage.from("clipboard").remove([filename]);

UI & Styling

TailwindCSS

Tailwind CSS

Version: 3.xUtility-first CSS framework for rapid UI development.

Why Tailwind?

Build complex interfaces without writing custom CSS:
<div className="flex items-center gap-2 p-4 rounded-lg 
                bg-gray-900 text-white hover:bg-gray-800 
                active:scale-95 transition">
  <Send size={18} /> Send to Clipboard
</div>
Reference: src/App.jsx:613

Tailwind Configuration

tailwind.config.js:1-11
export default {
  content: [
    "./index.html",
    "./src/**/*.{js,ts,jsx,tsx}",
  ],
  theme: {
    extend: {},
  },
  plugins: [],
}
Reference: tailwind.config.js:1-11

Lucide React

Lucide React

Version: 0.477.0Beautiful, consistent icon library with 1000+ icons.

Icons Used

src/App.jsx:2
import { 
    Copy, ClipboardList, Trash2, Send, 
    ChevronDown, ChevronRight, LogOut, 
    Moon, Sun, Edit, FileUp, FileImage, 
    Paperclip, Search, Share 
} from "lucide-react";
Tree-shakeable: Only icons you import are included in the bundle.Customizable: Size, color, and stroke width can be adjusted:
<Copy size={19} className="text-blue-500" />

State Management

React Query (TanStack Query)

TanStack React Query

Version: @tanstack/react-query 5.68.0Powerful data synchronization for React.

Why React Query?

Handles caching, background updates, and stale data automatically.
src/App.jsx:375-383
const { data } = useQuery({
    queryKey: ["counter"],
    queryFn: updateCounter,
    enabled: true,
    refetchOnWindowFocus: false,
    refetchOnReconnect: false,
    retry: 2,
    refetchInterval: 1000 * 60 * 5  // Refetch every 5 minutes
})
Keeps data fresh without manual intervention:
  • Configurable refetch intervals
  • Window focus refetching
  • Network reconnect refetching
Built-in loading and error state management:
  • No need for manual loading flags
  • Automatic retry logic
  • Error boundaries support

Setup

src/main.jsx:1-14
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'

const queryClient = new QueryClient()

createRoot(document.getElementById('root')).render(
  <QueryClientProvider client={queryClient}>
    <App />
  </QueryClientProvider>,
)
Reference: src/main.jsx:1-14

PWA Features

vite-plugin-pwa

vite-plugin-pwa

Version: 0.21.1Zero-config PWA plugin for Vite.

PWA Capabilities

Installable

Users can install ClipSync as a native app on any device

Offline Support

Service Worker caches assets for offline access

Auto Updates

Automatically updates when new version is available

Native Feel

Standalone display mode without browser chrome

Configuration

vite.config.js:9-49
VitePWA({
  registerType: 'autoUpdate',  // Auto-update service worker
  workbox: {
    globPatterns: ["**/*"],    // Cache all assets
  },
  includeAssets: ["**/*"],
  manifest: {
    name: "ClipSync",
    short_name: "ClipSync",
    description: "A web app for syncing clipboard across devices.",
    icons: [
      {
        src: "/favicon/web-app-manifest-512x512.png",
        sizes: "512x512",
        type: "image/png",
        purpose: "maskable"
      }
    ],
    start_url: "/",
    display: "standalone",
    theme_color: "#000000",
    background_color: "#000000"
  }
})
Reference: vite.config.js:9-49

Utility Libraries

File & Image Handling

browser-image-compression

Version: 2.0.2Client-side image compression using Web Workers.
Usage:
src/compressedFileUpload.jsx:1-17
import imageCompression from "browser-image-compression";

export async function compressImage(
    imageFile,
    maxSizeMB = 0.2,
    maxWidthOrHeight = 1920,
    useWebWorker = true
) {
    const options = { maxSizeMB, maxWidthOrHeight, useWebWorker }
    const compressedFile = await imageCompression(imageFile, options);
    return new File([compressedFile], imageFile.name, {...});
}
Benefits:
  • Reduces upload bandwidth by 90%
  • Non-blocking compression using Web Workers
  • Maintains image quality while reducing size

UI Enhancement Libraries

react-hot-toast

Version: 2.5.2Lightweight, customizable toast notifications.
Usage:
src/App.jsx:3
import toast, { Toaster } from 'react-hot-toast';

// Show notifications
toast.success("Clipboard updated successfully!");
toast.error("An error occurred");
const toastId = toast.loading("Uploading file...");
toast.success("Done!", { id: toastId });
Features:
  • Promise-based for async operations
  • Dark mode support
  • Customizable styling

Development Tools

ESLint

ESLint

Version: 9.21.0Code quality and consistency enforcement.

Configuration

eslint.config.js:7-38
export default [
  { ignores: ['dist'] },
  {
    files: ['**/*.{js,jsx}'],
    languageOptions: {
      ecmaVersion: 2020,
      globals: globals.browser,
    },
    plugins: {
      react,
      'react-hooks': reactHooks,
      'react-refresh': reactRefresh,
    },
    rules: {
      ...js.configs.recommended.rules,
      ...react.configs.recommended.rules,
      ...react.configs['jsx-runtime'].rules,
      ...reactHooks.configs.recommended.rules,
      'react/jsx-no-target-blank': 'off',
    },
  },
]
Reference: eslint.config.js:7-38

Plugins Used

React-specific linting rules for best practices
Enforces Rules of Hooks (dependencies, no conditional hooks, etc.)
Ensures Fast Refresh works correctly

PostCSS & Autoprefixer

PostCSS

Versions: postcss 8.5.3, autoprefixer 10.4.20CSS transformation and vendor prefix automation.
Automatically adds browser vendor prefixes to ensure cross-browser compatibility:
/* Input */
.box { display: flex; }

/* Output */
.box { 
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex; 
}

Package Scripts

Reference: package.json:6-10
{
  "scripts": {
    "dev": "vite",
    "build": "vite build",
    "lint": "eslint .",
    "preview": "vite preview"
  }
}

npm run dev

Start development server with hot reload

npm run build

Build optimized production bundle

npm run lint

Check code for errors and style issues

npm run preview

Preview production build locally

Technology Decisions Summary

  • Larger ecosystem and community
  • Better TypeScript support
  • More mature tooling (React Query, testing libraries)
  • Team familiarity
  • 10-100x faster dev server startup
  • Instant HMR regardless of app size
  • Simpler configuration
  • Better DX with native ESM
  • Faster development (no backend code needed)
  • Built-in realtime via WebSockets
  • Integrated file storage
  • Free tier suitable for MVP
  • Easy to migrate to self-hosted later
  • Smaller bundle size (no runtime)
  • Faster development with utilities
  • Consistent design system
  • Better performance (no runtime styles)

Next Steps

Architecture

Understand the system architecture

Local Setup

Set up your development environment

Build docs developers (and LLMs) love